Welcome to the UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats.
You have to register before you can post and see and access any of the advanced forum features, please click the register link to proceed to the registration form. To start viewing threads or posts, select a forum that you want to visit from the selection below.
Direct3D hacking programming reversing
You are Unregistered, please register to gain Full access.
I wanted to make a chams hack for d3d9, so i searched in the web and found much tutorials about this stuff.
Firstly i wanted to hook all the functions without vTable but everybody says try it with its better....
So i decided to do this with help (web,tutorials...) but im stucking here because only Endscene and Beginscene is hooked here and i dont know why :S
So please help a noob and make him happy =)
Thanks to all who are trying to help me^^
PS: and maybe u can help me with explaining it what i made wrong ()=)
//---------------------------------------------------------------------------------------------------------------------------------
LPDIRECT3DDEVICE9 npDevice; //pDevice is stored here so we can hook through the VTable
//---------------------------------------------------------------------------------------------------------------------------------
UINT myStride = 0;
//---------------------------------------------------------------------------------------------------------------------------------
ofstream myfile; //Used for logging to a text file
//---------------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------------
HRESULT WINAPI hkEndScene(LPDIRECT3DDEVICE9 pDevice)
{
myfile << "EndScene is hooked\n"; //Check log
while(!npDevice) {
npDevice = pDevice; //Here we store pDevice so we can re-hook with a VTable hook later.
}
DX_Init(VTable);
HOOK(EndScene,VTable[ES]); //Hook EndScene as a device discovery hook
while(!npDevice) {
Sleep(50); //Sleep until npDevice is not equal to NULL
}
UNHOOK(EndScene, VTable[ES]); //Unhook as soon as we have a valid pointer to pDevice
*(PDWORD)&oDrawIndexedPrimitive = VTable[DIP];
*(PDWORD)&oEndScene = VTable[ES];
*(PDWORD)&oReset = VTable[RES];
*(PDWORD)&oBeginScene = VTable[BS];
*(PDWORD)&oSetStreamSource = VTable[SSS];
Is very, very, very, stupid.
Having file io getting called 54000 times a minute is just going to wreak havoc in so many ways.
What the fk???
So many things wrong.
This code was written as a base, it was not designed to be used as it is exactly, those logs are just so you know when all is working, obviously you take them out.
1. Depending on the game at hand, some Direct3D extension functions used restore the virtual method table and erase your detouring.
2. I wanted to break the longest function name record, did I win?
With no disrespect intended towards JoshRose's contribution, if you want something more easier to follow and understand (do you intend on trying to understand what you are doing?) then you can look at this example.
This code was written as a base, it was not designed to be used as it is exactly, those logs are just so you know when all is working, obviously you take them out.
is used to keep overwriting the address incase something has patched it back.
You know you could add a simple time code check and if it gets out of sync for over a second or two with no response from reset or end scene, then you re-hook.
You know you could add a simple time code check and if it gets out of sync for over a second or two with no response from reset or end scene, then you re-hook.
Instead of wasting away re hooking for no reason.
If you research the scenario then you will find out it constantly gets erased within one second of you writing to the table. There is reason for repeative patching and no waste or resources (although someone must have a really poor system for that simple thread to effect their performance).
Quote:
Originally Posted by MurxXxel
and pm you if i have questions =)
If you have questions then you ask them in the forum, not in private messages.
__________________
I've learned that something constructive comes from every defeat.
Sometimes i say things i shouldn't, and sometimes i say what other people are thinking.
Real programmer's don't document, if it was hard to write, it should be hard to understand.
First learn computer science and all the theory, next develop a programming style, then forget all that and just hack.
1) Some A/C will unhook VMT the first time and kick the second so it depends on the game if you can even do a straight up VMT hook (I see no mention of game).
2) Why hook SetStreamSource when you can simply call GetStreamSource in DIP to get the stride. Roverturbo posted an example of that here in the past and of course less hooks means less chance of detection.
__________________
I'm like a virus, you can delete me but I am never really gone.
Links die, searching does not. (Fravia : searchlores.org)
Solving problems requires effort not a college degree.