Jump to content
  • Advertisement
Sign in to follow this  

Hooking Direct3DCreate9 fail

This topic is 2204 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

SDLLHook D3DHook =
false, NULL,
{ "Direct3DCreate9", MyDirect3DCreate9},
// Hook function.
IDirect3D9* WINAPI MyDirect3DCreate9(UINT sdk_version)
// Let the world know we're working.

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);

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!