Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hooking into DirectX application

Tags:

c#

.net

directx

I'm currently trying to display some information (as an overlay) to the user inside a DirectX-based game, much like the frame count which Fraps displayed, but I have no clue where to start. I don't expect a full solution to my problem, just a few hints where I can start and where to get more information about the topic ;)

Thanks in advance.

PS: The project I'm working on is written in C# (.NET 3.5)

PPS: To clarify: I mean hooking into any random DX-based game. Start my app, start any game, display some kind of overlay.

like image 923
fresskoma Avatar asked Feb 28 '23 01:02

fresskoma


1 Answers

Well one way is to place a d3d9.dll alongside the executable. The DLL search pattern will ALWAYS search the current directory first.

Now its just the "small" matter of implementing the DirectX interface to pass through everything to the REAL d3d9.dll. After you've done this then every time the user calls present you can inject some rendering of your own. In the case of the frame rate example you can measure the time between present calls.

Intercepting loading of the D3D9.dll without placing your own DLL in the way is a LOT more complex.

Other sorts of info here:

http://www.codeproject.com/Articles/20084/A-More-Complete-DLL-Injection-Solution-Using-Creat

like image 115
Goz Avatar answered Mar 07 '23 05:03

Goz