   Hijacking a function in a dll which an exe loads
  I've been trying to use this direct3d hooking sample to hook irrlicht to get stats about my games rendering.The sample only works if the exe itself loads d3d. In my case i use irrlicht for rendering so my app loads irrlicht which loads d3d9.dllIs there a way that i can modify this code to allow me to get the d3d9 device when an app loads d3d9 through another dll?I've tried plenty of googling but I could'nt find anything...Any help would be appreciated.Thanks   
  Google for IAT hooking (Import Address Table hooking).  The short answer is that suppose you have some exe called A.EXE which import from B.DLL, C.DLL, and D.DLL.   Also, B.DLL and C.DLL both independently import from D.DLL.  In this case, A.EXE, B.DLL, and C.DLL all have their own independent table that they do lookups through when mapping a function imported from D.DLL to an address that it can use to actually jump toA robust IAT hooking solution accounts for this by recursively enumerating all possible modules and imports and hooking all of them, not just the one imported by the EXE.To translate this to your above example, if you only apply an IAT hook to your EXE, you're not hooking irrlicht's copy of the IAT, only your EXEs.  Since irrlicht is importing from d3d as well, it also has its own IAT that you need to hook.   ;  There shouldn't be any difference - the only thing I can think of is that irrlicht loads d3d9.dll from the Windows directory rather than the current directory for some reason. What does Process Monitor show?EDIT: Never mind, I thought you were using a proxy DLL for some reason...   