Sign in to follow this  

Hooking DirectX

This topic is 4812 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 a directx function, Direct3DCreate9, from a MMORPG. I have sucessfully injected my dll into the MMORPGS process. A required step in hooking is getting the HMODULE of the dll you are trying to hook. In my dll, I am calling GetModuleHandle("d3d9.dll") without any sucess. I assume this means that d3d9.dll is not actually mapped into the MMORPG? Anyone know why this is? and if there is a way around it? Any help would be appreciated. -Dev578

Share this post


Link to post
Share on other sites
Interesting...I remember you from this. Hooking is a tough subject - I'm glad to see you have stuck with it [smile]

Anyways, which MMORPG? You should really make sure that it actually uses DX9.0 *before* you start. Also, you will need to know which revision number (ie 9.0a, 9.0b, 9.0c). In other words, you will need to hook into the exact same version of the device - if they're using IDirect3DDevice8, you'll have to use IDirect3DDevice8. If they're using the 9.0b IDirect3DDevice9, you'll have to use the 9.0b IDirect3DDevice9.

Share this post


Link to post
Share on other sites
I'm trying to hook DAOC's call to Direct3DCreate9. I don't think I'm at at the point yet where I need to worry about the IDirect3DDevice. I am having trouble hooking the function itself, once I successfully hook the function, then I will hook the IDirect3DDevice from it. As I said, GetModuleHandle("d3d9.dll") does not work, meaning d3d9 is not in memory. I thought DAOC used DirectX 9, right? Any ideas of what I am doing wrong? Any help is appreciated.

-Dev578

Share this post


Link to post
Share on other sites
Yes, DAOC uses Direct3D 9.0. You may want to find which DLLs the executable is loading, by using Spy++. You can also open the exe as a workspace in Visual Studio, debug it, and check the message output.

Btw, I looked into the code from the DAOC project I did, and here is it's website. I made the radar thingy.

Share this post


Link to post
Share on other sites
i think there are two ways for you to do the hooking.
1. is create an dll, export the d3dcreat9 from it, and rename it to d3d9.dll, place it in the host application's directory or system folder, when it get loaded, try to load the real d3d9.dll and forward the call when needed.
2. you can inject some dll into any application's process space(with certain registry setting? I can't remember the detail), and modify the reloc table of the process to hijack the entry point of d3dcreate9. I have never done this before, just heard about there is such a way. Let me know if you find more detail on this, i am also quite interested to know more about this.

Share this post


Link to post
Share on other sites

This topic is 4812 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.

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