I have another issue that I dont understand but I dont want to open a new thread for this.
I try to hook End Scene via MS Detours 1.5 but wow constantly crashes when DetourFunction is called.
What am I doing wrong here ?
Code:
HRESULT (__stdcall *Real_EndScene)(LPDIRECT3DDEVICE9);
HRESULT __stdcall My_EndScene(LPDIRECT3DDEVICE9 device)
{
return Real_EndScene(device);
}
UINT CALLBACK Install( LPVOID lpParam)
{
DWORD pDevice_1 = *(DWORD*)(0x00C5DF88);
DWORD pDevice_2 = *(DWORD*)(pDevice_1 + 0x397C); //This contains another pointer so we will dereference again
DWORD pDevice = *(DWORD*)pDevice_2; // Pointer to Class VMT
DWORD EndScene = *(DWORD*)(pDevice +0xA8); // Offset off EndScene within classes VMT
Real_EndScene = (HRESULT (__stdcall *)(LPDIRECT3DDEVICE9))DetourFunction((PBYTE)EndScene,(PBYTE)My_EndScene);
return 0;
}