Sign in to follow this  
farmdve

DirectX 9 hooking.

Recommended Posts

farmdve    194
I used this code right here [url="https://github.com/tgascoigne/D3D-Hook-Test"]https://github.com/t...e/D3D-Hook-Test[/url] to hook Directx's EndScene method.

The code is hooking properly, but the new EndScene method is just never called...at all.

This is the new function

[code]HRESULT WINAPI D3DEndScene_hook(IDirect3DDevice9* device)
{
__asm pushad;
MessageBoxA(NULL, "DX", "DX", MB_ICONEXCLAMATION);
__asm popad;
return D3DEndScene_orig(device);
}[/code]

Basically a popup should appear every time EndScene is called, but it isn't. I am not sure where I am wrong.

Since the game uses LoadLibraryA to load d3d9.dll, I also used code from [url="http://www.rohitab.com/discuss/topic/34411-run-time-directx-hooking-using-code-injection-and-vtable/"]http://www.rohitab.c...ion-and-vtable/[/url] to get the address of the loaded d3d9.dll and patch that.

EDIT:Fixed the problem, the code on github called device->Release(); Edited by farmdve

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this