Remove Detour/Unhook
Here is the DetourFunction (in injected DLL):
I tried doing this:
But for some reason, the game crashes when I unload the DLL.
Any help is appreciated!
Code:
int initHook(void)
{
DWORD *vTable;
HMODULE hMod;
do{
hMod = GetModuleHandleA("d3d9.dll");
Sleep(50);
}while(!hMod);
DWORD addy = dwFindPattern((DWORD)hMod,0x128000,(PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86","xx????xx????xx");
if(addy)
{
memcpy(&vTable,(void *)(addy +0x2),4);
EndScene_orig = (EndSceneType)DetourFunction((PBYTE)vTable[42],(PBYTE)EndSceneDetour);
}
return true;
}
Code:
DetourRemove((PBYTE)EndScene_orig, (PBYTE)EndSceneDetour);
Any help is appreciated!

