This commit is contained in:
Huoji's
2023-10-04 06:01:28 +08:00
parent e356220383
commit 06acf8b24d
21 changed files with 773 additions and 457 deletions

View File

@@ -9,13 +9,13 @@ void* VMTHook::Hook(int index, void* hk)
{
// Store the index and original function address
hooked_funcs.insert(std::make_pair(index, vmt[index]));
printf("vmt hook at: %p \n", vmt[index]);
// Change the memory's access rights, patch the address to our hook, restore original rights
DWORD old;
VirtualProtect(&vmt[index], sizeof(void*), PAGE_EXECUTE_READWRITE, &old);
vmt[index] = hk;
VirtualProtect(&vmt[index], sizeof(void*), old, NULL);
return hooked_funcs[index];
}