Step 1: Create your basic DllMain function.
Code:
[php] BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
DisableThreadLibraryCalls(hModule);
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
MessageBoxA(0, "WOOO!! Vengeance!!", "Yup", 0);
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)&Hack, NULL, NULL, NULL);
}
}[/php]
Step 2A: Create the basic function to manipulate unauthorized Console commands.
Code:
[php]void __cdecl PushToConsole(const char* szCommand)
{
DWORD *LTClient = (DWORD*)(0x3778BFB0);
void* CONoff = (void*)*(DWORD*)(*LTClient + 0x208);
__asm
{
push szCommand;
call CONoff;
add esp, 4;
}
}
[/php]
Step 2B: The line:
Code:
[php]
DWORD *LTClient = (DWORD*)(0x3778BFB0);[/php]
Step 3: Now you can use your "PushToConsole" function to use commands, and bind them to hotkeys via GetASyncKeyState or some other form of keyboard hooking.
Code:
[php]for(;; )
{
if (GetASyncKeyState(VK_ADD) & 0x8000)
PushToConsole("windowed 1");
}
[/php]
And if you can't understand the last bit, you shouldn't be reading this anyways but that watches for you to hit a particular key, and executes a Console command that will put the game into Windowed Mode.
Happy hacking!
P.S. Current L.T.Client address at the time of this post is:
Code:
I did not discover any of this, I took this from several threads on MPGH, and de-dumbified it, and put it all in one place for people who understand the C/C++ language and just want to get a quick view/tutorial on how to make a Combat Arms hack.