Jump to content
  • Advertisement
Sign in to follow this  
Muhammad Haggag

[C++] Direct3D hooking sample

This topic is 2908 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

Hi there, thank you for this resource it should prove extremely useful however I have two questions if some one could please answer: (I am a beginner)

> Firstly when I download the sample files and run launcher.exe it says “usage: launcher filename” could some one just briefly interpret this describing how this application is used exactly. For example I have a game installed in my C:\ named abc.exe what is the command I would enter for the launcher to work and hook?

> Secondly can this method be used to interact with game textures for example changing them or recognising coordinates or does it simply draw directly above the game with no means of interaction?


Thank you.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by cykino
> Firstly when I download the sample files and run launcher.exe it says “usage: launcher filename” could some one just briefly interpret this describing how this application is used exactly. For example I have a game installed in my C:\ named abc.exe what is the command I would enter for the launcher to work and hook?

launcher abc.exe

Quote:
> Secondly can this method be used to interact with game textures for example changing them or recognising coordinates or does it simply draw directly above the game with no means of interaction?

You can do anything. I only demonstrated modifying the behavior of Present to draw a colored quad.

Share this post


Link to post
Share on other sites
Ive tried to test this and I cannot seem to get it to work. I have no problems with the compilation. But when I launch Egyptian_Addiction.exe and then run Launcher.exe "Egyptian_Addiction.exe" nothing happens. Am I doing something in the wrong order?

EDIT: I read the OP just a little bit more and saw what I needed to do. It is working now.

Thanks,
Soul

[Edited by - DaSoul on January 21, 2006 11:34:37 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Pipo DeClown
The sample file is gone, NeXe is destroyed?! Doh!
The staff are aware of this and it should be sorted out fairly soon I hope. NeXe (or the other hosted sites) are not gone forever [smile]

Jack

Share this post


Link to post
Share on other sites
Is there a way to just hook the specific function EndScene() in the vtable instead of creating a wrapper class?

ie, couldn't you do something like:


__stdcall HRESULT MyEndScene(void * this) {
IDirect3DDevice9 * device = (IDirect3DDevice9 *)this;
// do some rendering calls
return device->EndScene();
}


It just seems like creating a whole class for one little function is a lot of extra code.

Share this post


Link to post
Share on other sites
Quote:
Original post by ApolloEx
Is there a way to just hook the specific function EndScene() in the vtable instead of creating a wrapper class?

ie, couldn't you do something like:


__stdcall HRESULT MyEndScene(void * this) {
IDirect3DDevice9 * device = (IDirect3DDevice9 *)this;
// do some rendering calls
return device->EndScene();
}


It just seems like creating a whole class for one little function is a lot of extra code.


Assuming you inserted a pointer to that function into the vtable, that would result in infinite recursion. Think about what device->EndScene(); is doing.

Share this post


Link to post
Share on other sites
Quote:
Original post by Washu
Quote:
Original post by ApolloEx
Is there a way to just hook the specific function EndScene() in the vtable instead of creating a wrapper class?

ie, couldn't you do something like:


__stdcall HRESULT MyEndScene(void * this) {
IDirect3DDevice9 * device = (IDirect3DDevice9 *)this;
// do some rendering calls
return device->EndScene();
}


It just seems like creating a whole class for one little function is a lot of extra code.


Assuming you inserted a pointer to that function into the vtable, that would result in infinite recursion. Think about what device->EndScene(); is doing.


Whoops. Should have called a function pointer to the old address.

Share this post


Link to post
Share on other sites
Assuming you know the layout of the vtable though (which you do since it's based on COM) then yes, you could change the implementation such that you didn't need to implement that interface. On the other hand, typically if you are going to hijack one function, you'll probably need to hijack others.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!