I've got not even a question I think that this is some kind of confirmation, that I understand the subject correctly.
I'm doing some reverse engeneering study and here is what I have.
Let's say we have structure/class, which looks like this:
struct {
char str[n]
int x
float a
}
And we have an array of these structures in the memory of process we are looking at.
So, what I have is Pointer to the array of pointers to structures.
And now could you please correct me if I'm wrong. To read the x value of the first element of this array(actual structure, not the pointer), I have to follow these steps:
- Read the value that pointer points at(4 bytes).
- Without any offsets read the value that previously read value points at, also 4 bytes(this will lead me to the address where the structure starts)
- Now I have to add the offset to this which is equal to n. And read the value from the address from step 2(step2result+n+1).
Am I right? Will I get the actual X that the first structure contains? To get the X value from the second I just have to add the offset in step2(+4 bytes)?
I think that I'm doing this right but I actually cant reach the structures from the pointers. Pointer to the array is 100% right I'd say.
Thanks for reading, would be waiting for an answers. If you need any more information just ask for that.
p.s. not getting anything cracked or whatever everything just for educational purposes
Addition:
OK, my try to simplify this just only made it harder to explain and understand. Now I'm gonna try to fix it.
One structure describes the NPC parameters in the game. The whole structure has a size of 0x1200. The first 16 bytes is just ID info, then after this information goes string which is 64 bytes, it's the name. Then goes coordinate for X/Y/Z. Everything after these doesnt matter.
It wasnt so hard to find, here's a screenshot how it looks like:
/
So I can find the other structures just with adding or subtracting the 0x1200 to the address where that structure starts.
I searched for the address where the structure starts and found a pointer to that.
Then I scanned for accesses to that found pointer and got something like that:
mov [eax+edx*4+00320], ecx
Then I searched for the eax
value and found the pointer which points at eax
That's why I thought that this is the array of the pointers.
Hope I just explained this a bit more specifically.