Sign in to follow this  
kurlyak

Hooking Direct3DCreate9 fail

Recommended Posts

I am trying to hook Direct3DCreate9 function. I wrote some code (short variant).


[CODE]
SDLLHook D3DHook =
{
"D3D9.DLL",
false, NULL,
{
{ "Direct3DCreate9", MyDirect3DCreate9},
{ NULL, NULL }
}
};
// Hook function.
IDirect3D9* WINAPI MyDirect3DCreate9(UINT sdk_version)
{
// Let the world know we're working.
MessageBeep(MB_ICONINFORMATION);

MessageBox(NULL, "MyDirect3DCreate9", "Info", MB_OK);

OutputDebugString( "Direct3D-Hook: MyDirect3DCreate9 called.\n" );
Direct3DCreate9_t old_func = (Direct3DCreate9_t) D3DHook.Functions[D3DFN_Direct3DCreate9].OrigFn;
IDirect3D9* d3d = old_func(sdk_version);

return d3d? new MyDirect3D9(d3d) : 0;
}

.....................................
bool res = HookAPICalls(&D3DHook);
[/CODE]

I trying to use Launcher and DLL. In some programs my hook works fine, and in other programs it fail. In others program even not entry in func MyDirect3DCreate9() (see above). What is the matter?
Thanks in advance.

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