Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are static pointers in RAM and how can they exist?

I've been studying C++ Game Hacking via tutorials for a week or two and I almost get it all. However, there's on thing that keeps bothering me over and over again.

To customize a value (f.e. player's health) we must search the memory address with Cheat Engine (or such) and set the value to something else. These memory addresses are obviously different every time we start the program, cause it wont always use the same spot in RAM.

To solve this problem, people will try to find a static pointer to the memory address which contains the value; how are the pointers static, how can they reserve a static address from RAM?

like image 458
Markus Meskanen Avatar asked Sep 16 '25 13:09

Markus Meskanen


1 Answers

Actually, it's not the pointer to the game variable that is static, but the offset of the variable's address, in reference to the address of another data.

If the game you want to "hack" is always storing data in the same, solid structure, then it's possible to find these offsets. When you know the offsets, then the only thing you need to do when the game starts is to find the address which the offsets are referencing to, instead of performing multiple scans - one for each variable.

Edit:

Additionaly, programs are very likely to be given the same virtual address space every time you run them, so in practice it would look like the variables with static offsets have the same addresses every time you run the program (further reading here, and there).

like image 61
podkova Avatar answered Sep 19 '25 05:09

podkova