Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Hooking Direct3DCreate9 fail


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 kurlyak   Members   -  Reputation: 120

Like
0Likes
Like

Posted 06 August 2012 - 08:45 AM

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


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

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.
Windows programming is like going to the dentist: You know it’s good for you, but no one likes doing it.- Andre LaMothe.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS