This repository showcases to you how to successfully hook DirectX 7 (ddraw.dll), in order to draw your own application.
It only fulfills documentary and educational purposes.
The two interfaces responsible for rendering and drawing your stuff onto your game are IDirectDraw7 and IDirectDrawSurface7.
As of creating this respository, i did not really have alot of understanding of how hooking functions, especially drawing functions, worked.
However due to the broad amount of information (Linked down below), i was able to figure out alot of it.
After digging through the internet, i have come to the conclusion that the IDirectDrawSurface7::Blt and IDirectDrawSurface7::Flip were indeed responsible for drawing information, which was all the information i needed in order to actually start coding.
In order to hopefully make this respository global for every DirectX 7 Game, it was decided upon not use any function pointers or pointers in general of any game, so that the project itself would stay loyal to its purpose.
How did i hook the functions?
By getting its function pointer through the virtual Table of DirectX 7 (same as many DirectX 9 Hookers work). Lookup ddraw.h to understand where the function pointers are located in the structure.
Only thing worth noting is in order to get a IDirectDrawSurface7 pointer, we hook the IDirectDraw7::CreateSurface function and then we can detour its functions aswell.
The code might be sloppy, i am open for improvements, however it does work.
In order to compile this project, use C++14, with the x86 option turned on.
It does not work with 64 Bit.
This project compiles to a .dll, that you can then inject into your game with any available DLL-Injector.
Contributions are always welcome!
Worth noting:
- unknowncheats - (giving a broad idea on how it works).
- Detours