The Gamehacking Foundation Classes [GHF]

05/20/2010 19:57 MrSm!th#16
Quote:
Originally Posted by high9 View Post
Make sure that you can unhook without deleting the detours instructions. It annoys me that with ms detours you cannot remove a detour inside the detour because it removes the instructions.
huh? what do you mean by this? unhooking without deleting the instructions? o.O
the E9 instruction? what should I do with them instead of replacing them by the original ones? o.ô
05/20/2010 20:37 high9#17
I mean, when you detour you generally copy the instructions (trampoline) you are overwriting with the jump. Don't delete the copied instructions. That way when you unhook it can still execute the copied instructions and get back.
05/20/2010 21:14 MrSm!th#18
Quote:
Originally Posted by high9 View Post
I mean, when you detour you generally copy the instructions (trampoline) you are overwriting with the jump. Don't delete the copied instructions. That way when you unhook it can still execute the copied instructions and get back.
ah, so you mean, the trampoline should not be deleted?
ok, this idea is new for me :D Could you give me an example? In which real world situation you could need this? If you can, I will add a flag for keeping the trampoline.

edit:

Ok, tomorrow I will finish the getOpLen method and I will be able to post the full detours class


edit2:

ah, now I remember!

to the include guards again:

Everything works fine, if the header is only included in one .cpp.
But if I include it in a second file I get an "already defined"-error.
The include guards are only to avoid double defining in one .cpp file and pragma once works global!
05/22/2010 02:04 high9#19
Quote:
Originally Posted by MrSm!th View Post
ah, so you mean, the trampoline should not be deleted?
ok, this idea is new for me :D Could you give me an example? In which real world situation you could need this? If you can, I will add a flag for keeping the trampoline.

edit:

Ok, tomorrow I will finish the getOpLen method and I will be able to post the full detours class


edit2:

ah, now I remember!

to the include guards again:

Everything works fine, if the header is only included in one .cpp.
But if I include it in a second file I get an "already defined"-error.
The include guards are only to avoid double defining in one .cpp file and pragma once works global!
If you delete the trampoline when the hooked function is executing it has no way of returning.
05/23/2010 00:37 MrSm!th#20
Errm, the tramoline is only deleted, when the function is unhooked, so this is no problem ;)


edit:

Ok, I just added the source.

I hope you will download it and give feedback ;)
05/23/2010 21:07 skamara#21
hey man i wana join.i no c# and learnt the basics of c++ in a week so was born to code. but i prefer c# so i would like to join. i can already find pointers,detect wherther a program is running etc
05/23/2010 21:41 MrSm!th#22
ohhh sorry! i found some critical logical mistakes in the code.

now the GHF::Detours class is without any bug (at least i hope so)


Quote:
hey man i wana join.i no c# and learnt the basics of c++ in a week so was born to code. but i prefer c# so i would like to join. i can already find pointers,detect wherther a program is running etc
sorry, but like i said, it is written in c++.
if you have a good knowledge in object oriented techniques, you can help me with design decisions anyway ;)

(we dont need any pointer scanning or something like this)