Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Pointers and offsets

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
flojboj
How do I cheat?
Reputation: 0

Joined: 18 Aug 2023
Posts: 1

PostPosted: Fri Aug 18, 2023 12:06 pm    Post subject: Pointers and offsets Reply with quote

I am learning the concept of pointers and offsets. But I can't figure out why, is the first offset +0x10 in both 32bit and 64bit architecture - see the attachment

Does the base pointer always have offset 0x10 or are there any data stored? If I am correct, 0x10 offset is 16 bytes. But the pointer itself needs only 8 bytes for 64bit architecture and 4 bytes for 32 architecture.[/url]



test.png
 Description:
 Filesize:  143.53 KB
 Viewed:  1305 Time(s)

test.png


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4710

PostPosted: Fri Aug 18, 2023 1:28 pm    Post subject: Reply with quote

There's nothing special about 0x10. It's just how far the value is offset from the start of the structure it's located in. In that image, it's just an example. You could make up any number you want and it would be equally valid for pedagogical purposes.

Values are often grouped into structures. These structures can also have other related values stored in them as well.

For example:
Code:
struct Location {
    float x;
    float y;
    float z;
};
In this C struct, the float `x` is the very first member of the structure. It's at the very beginning of the struct, so its offset from the beginning of the struct is 0. `y` is offset 4 bytes from the start (floats take up 4 bytes), and `z` is offset 8 bytes from the start.

Floats take up 4 bytes regardless of if you're compiling for a 32-bit or 64-bit target, so it doesn't matter in this case.

If a structure has any pointers in it (e.g. vtable), then offsets could be different since addresses are 8 bytes in 64-bit targets instead of 4 for 32-bit targets.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites