| View previous topic :: View next topic |
| Author |
Message |
DanyDollaro Master Cheater
Reputation: 3
Joined: 01 Aug 2019 Posts: 334
|
Posted: Mon Aug 26, 2019 8:14 am Post subject: I didn't understand exactly how a pointer works |
|
|
I know that a pointer points to a specific address in memory, but for example, I found this pointer on CSGO (Point to the Player's Health):
| Code: | offset 1: +230
"Server.dll" + 00A0618C |
to what I know is the base addres (and + 00A0618C is an offset) which added to offset 1 (+230) leads back to the address of life.
but the things I didn't understand are:
how does "server.dll" + 00A0618C always have the value of (Addres of Health-230)?
and why doubling the offset of 230 in 2 offset from 118 do not lead to the same value?
|
|
| Back to top |
|
 |
FreeER Grandmaster Cheater Supreme
Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Mon Aug 26, 2019 11:30 am Post subject: |
|
|
Because programs are hardcoded to have certain structures that take a certain amount of memory and things get created in the same order and loaded in the same way etc. barring things like updates and ASLR (but that just shifts whole modules around, not the stuff in the modules).
Sure it would be possible to randomize these things, but that would make things a bit slower and you still have to have _some_ known way to track down where things are every time so it'd be discovered soon enough by those who know enough to read the code and understand what it's doing and why it's working like it is.
having 2 half offsets is not the same as having 1 because adding offsets changes how many levels there are for multi-level pointers, each level is itself a pointer. If you change it from a single level pointer that reads an address (ie pointer) from memory at a static address and adds some number (an offset) to get the final dynamic address to a second level pointer with two offsets then after adding the first offset it then reads an address from that dynamic address before adding the second offset to get the final dynamic address but if that's not how the game was hard coded to store it then it's not going to work.
_________________
|
|
| Back to top |
|
 |
DanyDollaro Master Cheater
Reputation: 3
Joined: 01 Aug 2019 Posts: 334
|
Posted: Mon Aug 26, 2019 1:15 pm Post subject: |
|
|
| Thank you very much for your answer, but I still haven't clear the concept of "change how many levels there are for multi-level pointers" if I have a pointer with two offsets of 118, why if I add a third offset of 0 it changes the same? if I take a pointer and add the 2 offsets from 118 and then a third offset of 0, the pointer should not be the same?
|
|
| Back to top |
|
 |
FreeER Grandmaster Cheater Supreme
Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Mon Aug 26, 2019 1:49 pm Post subject: |
|
|
Well if you look at C code you'd have multi-level pointers something like this
GameStruct* thegame = new GameStruct;
inside of the game you'll have a pointer to the player eg. thegame->player;
and inside of the player you'll have a health value theplayer->health;
the compiler is going to output code that puts thegame in the same relative place every time but the new GameStruct is going to be somewhat randomly allocated (because it's dynamic) which affects everything in it as well.
thegame will then probably have a static offset from the start of the thread if it's not a global variable with a static offset from the module. The player pointer will have the same offset from the start of the game struct and the health will have the same offset from the start of the player struct.
Adding an offset equates to adding a pointer to the path that you need to read from.
If you don't know anything about how programs are programmed then these concepts are a lot harder to understand.
_________________
Last edited by FreeER on Tue Aug 27, 2019 6:38 am; edited 1 time in total |
|
| Back to top |
|
 |
DanyDollaro Master Cheater
Reputation: 3
Joined: 01 Aug 2019 Posts: 334
|
Posted: Tue Aug 27, 2019 12:17 am Post subject: |
|
|
I usually use pointers in C ++ but the concept of the multilevel pointer was not clear to me.
Anyway thanks for the explanation of the structure, it was enough for me to know this
|
|
| Back to top |
|
 |
|