[C/C++] Calculate a pointer's structure


Hello people, I am going to show you how to write your own structures.

What is a structure?
A structure is nothing more then a collection of offsets.
Every structure has its own size.

For example, the current cPlayerInfo structure has a size that cannot be modified, 0x1CF8.

Values
By most things, the standard value of a item in a structure is 4.
This value can be modified by using different types.
Here is a list:



Creating a GAP
A GAP will be used to go to a specific offset. Note that a gap cannot be a negative value so everything needs to be in order!

Example of a gap:



The real work
We are going to make a cPlayer structure for example.
We have the following offsets:


To start, we need to jump directly to 0x102E4.
Grab calc.exe, set it on programmer mode (for windows 7) and tick Hex. Type in 102E4 and then tick Dec. Your answer will be 66276.
So we create a GAP to 0x102E4.


but wait! how do we continue!?
With a little bit of calculating.
Your next value will be 0x102E4 + 4 (size of float) = 0x102E8. This value is not enough to reach .102EC so we will create another, and another, and so on.

Now we create another gap to 10358.
Calc -> 102F4 + 4 = 102F8. 10358 -102F8 = 60


The size of the structure is the last offset you used. In this case it will be 1035C (201534 bytes)

Finalize

Now we clean up our code if you don't need the explaination anymore, put the size after the breakpoint and it will look like this:

And there it is! your own structure!

If you have questions, I will try to answer them!

Credit to: Spike2147

0 comments:

Post a Comment

 

Copyright © 2011 Mbojo4Lab | Design by Kenga Ads-template