The demo is for Halo Trial only.
This is a sample source I wrote. A thread is created, which waits for Halo. it hooks the function that executes console commands via DetourFunction on attach, then starts a while loop. In the while loop (which loops forever), waits for a keypress of numpad1, which executes the string you input. I used "cheat_all_weapons" but you may use any console / devmode command you want. Make sure that devmode and console are both enabled or else this will not work.
Written in C++ and compiled with Microsoft Visual C++ Express Edition 2008. This is under the GNU General Public License. If you wish to use this code, you must leave it open sourced. This is to NOT be posted at any other website without permission!
The following is a direct copy and paste of the full source. This is a DLL project and must be compiled as so and injected with a DLL injector.
You will need Microsoft Detours 1.5 to use DetourFunction.
Code:
/********************************************************************************
Console Demo -- Halo Trial Console Remote Execute
Copyright (C) 2008 Del
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************
File: main.cpp
Project: Console Demo
Author: Steve(Del)
Date: September 23, 2008
Game: Halo Trial
Version: --
Tools Used: Microsoft Visual C++ 2008 Express Edition
OllyDbg
Credits: K@N@VEL
Information: Website -- www.deltronzero.com
E-mail -- deltronzero@hotmail.com
*********************************************************************************/
#include <windows.h>
#include <detours.h>
//------------------------------------------------------------------------------
typedef void (*pConsoleCMD)(const char * cCommand);
pConsoleCMD oConsoleCMD;
//------------------------------------------------------------------------------
void hkConsoleCMD(const char * cCommand)
{
__asm PUSH 0;
__asm MOV EDI, cCommand;
__asm CALL DWORD PTR DS:[oConsoleCMD];
__asm ADD ESP, 0x4;
}
//------------------------------------------------------------------------------
DWORD __stdcall dwHook(LPVOID lpArgs)
{
DWORD dwHalo = NULL;
do
{
Sleep(120);
dwHalo = (DWORD)GetModuleHandleA("halo.exe");
}
while( dwHalo == NULL );
oConsoleCMD = (pConsoleCMD)DetourFunction((PBYTE)0x004C4970,(PBYTE)&hkConsoleCMD );
while(1)
{
if (GetAsyncKeyState(VK_NUMPAD1)&1)
hkConsoleCMD("cheat_all_weapons");
}
return 0;
}
//------------------------------------------------------------------------------
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ulReason, LPVOID lpReserved )
{
if( ulReason == DLL_PROCESS_ATTACH )
{
CreateThread( 0, 0, dwHook, 0, 0, 0 );
}
return TRUE;
}
//------------------------------------------------------------------------------