Crossfire Crashing after Injection
Hey,
Can someone telle me why my Game (crossfire.exe) is crashing after injecting my code.
(I know the source code as it stands here would not do mutch to the game i just wanted to try injecting it into the game.)
Code:
#include <windows.h>
#define TestAd 0x0
#define TestAd2 0xA1A160
bool meow = false;
void Patch()
{
while (1)
{
DWORD Array1 = *(DWORD*)(TestAd + 0x00);
if (GetAsyncKeyState(VK_F1) & 1)
meow = (!meow);
if (meow)
{
memcpy((void*)(TestAd + 0x00), "\x00\x00\x00", 3);
}
else
{
memcpy((void*)(TestAd + 0x00), "\x00\x00\x00", 3);
}
if (GetAsyncKeyState(VK_F2) & 1)
{
*(DWORD*)(*(DWORD*)(*(DWORD*)(TestAd2)+0x00) + 0x00) = 00; //VALUE
}
Sleep(50);
}
}
BOOL WINAPI DllMain(HMODULE hDll, DWORD dwReason, LPVOID lpReserved)
{
DisableThreadLibraryCalls(hDll);
if (dwReason == DLL_PROCESS_ATTACH)
{
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Patch, 0, 0, 0);
}
return true;
}
I tryed my own injector and DX Cheat Mapper but Crossfire crashes instantly after injecting.