void WriteToMemory(uintptr_t addressToWrite, char* valueToWrite, int byteNum)
{
unsigned long OldProtection;
VirtualProtect((LPVOID)(addressToWrite), byteNum, PAGE_EXECUTE_READWRITE, &OldProtection);
memcpy( (LPVOID)addressToWrite, valueToWrite, byteNum);
VirtualProtect((LPVOID)(addressToWrite), byteNum, OldProtection, NULL);
}
void Patch(){
char* Nop = "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90";
//Autorize patch
WriteToMemory(0xFFFFFFFF, Nop, 1);
ExitThread(0);
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
CreateThread(0,0,(LPTHREAD_START_ROUTINE)Patch,0,0,0);
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}