-
Автор темы
- #1
ULONG_PTR pPatch1 = MainBase + 0x918D00; //calc_recoil_func
ULONG_PTR pPatch2 = MainBase + 0x919210; //calc_spread_func
ULONG_PTR pPatch3 = MainBase + 0x934E3B; //add some random
patch_code(pPatch1, (BYTE*)"\xc3\x90\x90\x90", 4);
patch_code(pPatch2, (BYTE*)"\xc3\x90\x90\x90", 4);
patch_code(pPatch3, (BYTE*)"\x90\x90\x90\x90\x90\x90\x90\x90", 8);
...
bool patch_code(ULONG_PTR ptr, const BYTE*code, size_t len)
{
DWORD dwback, dummy;
VirtualProtect((void*)ptr, len, PAGE_EXECUTE_READWRITE, &dwback);
memcpy((void*)ptr, code, len);
VirtualProtect((void*)ptr, len, dwback, &dummy);
FlushInstructionCache(GetCurrentProcess(), (void*)ptr, len);
return true;
}
Profit
ULONG_PTR pPatch2 = MainBase + 0x919210; //calc_spread_func
ULONG_PTR pPatch3 = MainBase + 0x934E3B; //add some random
patch_code(pPatch1, (BYTE*)"\xc3\x90\x90\x90", 4);
patch_code(pPatch2, (BYTE*)"\xc3\x90\x90\x90", 4);
patch_code(pPatch3, (BYTE*)"\x90\x90\x90\x90\x90\x90\x90\x90", 8);
...
bool patch_code(ULONG_PTR ptr, const BYTE*code, size_t len)
{
DWORD dwback, dummy;
VirtualProtect((void*)ptr, len, PAGE_EXECUTE_READWRITE, &dwback);
memcpy((void*)ptr, code, len);
VirtualProtect((void*)ptr, len, dwback, &dummy);
FlushInstructionCache(GetCurrentProcess(), (void*)ptr, len);
return true;
}
Profit
Последнее редактирование: