Jump to content
  • Advertisement
Sign in to follow this  
nuclear123

program to detect h00ks/detours/hijacked functions

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

im curious as to how this can be done? say i wanted to make a program that will then scan for hooks made by a program! any advice/knowledge would be greatfull on where to start or how i could perform such a task!

hook/detour/hijacked function

Share this post


Link to post
Share on other sites
Advertisement
it isn't exactly what you asked for, but a good way to detect if people are screwing with your memory is to have important variables defined in several places and make sure every so often that they are all equal to each other.

For instance you could have 3 variables holding the player's health, stored in different areas of memory.

Every time your program changed the health, it could change all 3 places.

Then, every so many game loops you could check that all 3 places match up to the same value.

To get trickier, you could do things like semi-encrypt the data in each place and "unencrypt" for the comparison. Just be careful that your "encryption" is reversable 100% of the way. If you divide a number by 2 to "encrypt" it, then later multiply it by 2 to see if it's the right number, you have lost data in the division, even with floating point numbers.

You might do something like this (assuming ints) for your 3 health variables.. (pseudocode)

Writing:


void SetHealth(int NewHealth)
{
Health = NewHealth;
SecureHealth1 = NewHealth + 20;
SecureHealth2 = NewHealth ^ 42;
}



Verifying:


bool HealthHasBeenTamperedWith(void)
{
return (Health != SecureHealth1 - 20) || (Health != SecureHealth2 ^ 42);
}



Doing this sort of thing can help thwart people who try to edit memory while the game is running to do cheats that way.

Share this post


Link to post
Share on other sites
thanks for the usefull insight :)! as for hookshark yes i've heard of this...i just doubt i have the sufficient knowledge to reverse it to understand how it works :(. If any others have advice/info plz let me know -thx

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!