Thread: Working with memory addresses

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    14

    Question Working with memory addresses

    For some time, I`ve been using Cheat Engine to cheat on games, its pretty fun .
    This program is modifying memory addresses, like health, money etc.

    Anyway I became curious about it, I searched on google about how it works, and stuff like that. But I wasn`t able to find anything. The only thing I know about it, it`s that it has to do with pointers ...

    The memory addresses are shown in HEX. If I`d want to make my own cheat engine, would I have to use HEX in my code too ? If so, how ?

    I`m very confused and I appreciate every piece of knowledge... So if you got any idea, please post it here ...

    Thanks in advance!

    P.S. I`m not English ( nor American ), therefore, I guess I made some mistakes in my post. Please let me know if you spot any, so that I can correct myself right away.
    Thank you very much, in advance, again !
    Last edited by Fujy; 01-16-2010 at 04:11 PM.

  2. #2
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Don't know how it works. Haven't tried it.

    You can generally read the memory addresses of the program running. Somewhere there will be probably the variable that holds your health. The question is where?

    One approach is to simply hit the player (lets assume Firs Person Shooter like Quake) and check how the memory addresses change. You should check for addresses going from positive to zero or negative. That is probably your health. Now you can set it at whatever number you need and hope it works (it might not).

    Another approach is to deassembly the game. But then you would need to figure out which is what. The variables won't be named.

    I would guess using a combination of the two. Find in which memory address variables are held. Then check each variable how it behaves and guess which is what.

    I can get into more details if you want. But give us an example of how the program works, cause I am bored to test it to see how "advance" it is.

  3. #3
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    Did you look at the source? Cheat Engine
    Here's a forum for discussing the techniques used. Cheat Engine :: View Forum - General Gamehacking

    Sorry I have no idea how it works, but maybe these links will be helpful.

  4. #4
    Registered User
    Join Date
    Jan 2010
    Posts
    14

    Smile

    Quote Originally Posted by C_ntua View Post
    You can generally read the memory addresses of the program running.
    That`s what I`m trying to learn . To search for memory addresses and to change them.
    Have you got any idea on how to do that ?
    Quote Originally Posted by C_ntua View Post
    One approach is to simply hit the player (lets assume Firs Person Shooter like Quake) and check how the memory addresses change. You should check for addresses going from positive to zero or negative. That is probably your health. Now you can set it at whatever number you need and hope it works (it might not).
    Cheat Engine works, basicaly, like that.
    If you see your health ( for example ) as a number, ( you know the exact value of it ), you can search for it. Then hit the player. Now we search for the new value, among the addresses that we found the last time. And "filter" the values like this, until we get only one value.

    But if we don`t, ( we see a health bar, for example) we search for "An unknown value." ( I think it searches for all the addresses ). Then hit the player. And then search for decreased values ( or heal the player, and search for increased values ). Then "filter"the values like this, until we get only one value.

    This is how Cheat Engine works. The program lets you edit the found memory addresses, by the way.

    Quote Originally Posted by C_ntua View Post
    I would guess using a combination of the two. Find in which memory address variables are held. Then check each variable how it behaves and guess which is what.
    Yep!
    We can guess the variables, or "filter" the addresses like I said above.

    Thanks


    Quote Originally Posted by User Name: View Post
    Did you look at the source? Cheat Engine
    Here's a forum for discussing the techniques used. Cheat Engine :: View Forum - General Gamehacking

    Sorry I have no idea how it works, but maybe these links will be helpful.
    Thank you for the source, it`s got lots of files, lots. I will swim through them for a while, perhaps I`ll find something ... .

    Thank you for the other link too, seems interesting.
    Last edited by Fujy; 01-17-2010 at 04:24 AM.

  5. #5
    Registered User
    Join Date
    Mar 2009
    Posts
    399
    If you want to write a game trainer yourself, you can have a look at this tutorial: C++ Win32 Basic Trainer Tutorial 1 - The World of Game Hacking

    Look at the MSDN docs for: OpenProcess(), ReadProcessMemory() and WriteProcessMemory().

    Reading the memory of another process is platform specific, but I'm assuming this is for Windows games. In *nix you can use ptrace to attach yourself to another process.

  6. #6
    Registered User
    Join Date
    Jan 2010
    Posts
    14

    Talking

    Yay ! Thanks a lot !
    Exactly what I was looking for!

    Except one thing : Searching for memory addresses...
    I can write and read from memory addresses, but I have to know them. So how could I search for addresses ?

    Umm... I will ask the guys in the last link about it, but if you want to boost your posts... well... I don`t mind you helping me out here .
    Last edited by Fujy; 01-17-2010 at 02:27 PM.

  7. #7
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    The general policy on this board is not to help individuals who are trying to create cheats and hacks for games. especially since this generally has NOTHING to do with C++.

  8. #8
    Registered User
    Join Date
    Jan 2010
    Posts
    14
    Quote Originally Posted by Elkvis View Post
    especially since this generally has NOTHING to do with C++
    I`ve got no idea of why you think it doesn`t have anything to do with C++. ó.Ó
    After all, those "hacks" are made in C++. I quoted "hacks", because I said that I`m only curious :

    Quote Originally Posted by Fujy View Post
    For some time, I`ve been using Cheat Engine to cheat on games, its pretty fun .

    . . .

    Anyway I became curious about it, I searched on google about how it works, and stuff like that...
    Memory addresses may serve, in principal, to cheating on games, but that doesn`t mean everyone wants to use it for that purpose.

    In my case, educational purposes.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  2. Novice Pointers/Class Question
    By C++Gamer in forum C++ Programming
    Replies: 8
    Last Post: 06-28-2006, 05:36 PM
  3. Memory Leak Help
    By (TNT) in forum Windows Programming
    Replies: 3
    Last Post: 06-19-2006, 11:22 AM
  4. Is it necessary to write a specific memory manager ?
    By Morglum in forum Game Programming
    Replies: 18
    Last Post: 07-01-2002, 01:41 PM
  5. Im so lost at . .
    By hermit in forum C Programming
    Replies: 18
    Last Post: 05-15-2002, 01:26 AM