Page 1 of 1

Retrieving Array Data

PostPosted: Fri Apr 29, 2011 1:57 pm
by PsychoTron
I've hooked a function that returns the address of an array.

0x00DBA498 <- This exist in the .exe, and should be my array.

Code: Select all
int Data = GetCharacterData(index); // Returns 0x00DBA498

int* arr = &Data;
int Length = sizeof(arr)/sizeof(int*);

for (int i = 0; i < Length; i++)
{
   UInt32 Temp = arr[i];
   Log("Data: " + UInt32ToString(Temp));
}


I've tried a number of different methods, but none seem to work as expected. (char*, inline asm([value+1]), *var, (type*)var, &var, etc, etc, etc,.)

It should be 1088 byte array containing the stats, etc, of a character.

Perhaps the info I got was just wrong, but regardless, the way C++ handles arrays is a bit confusing, so I still need to know how to do it properly, I'm sure I'll come across this again.

---

Edit: It wasn't an array at all, it was a start index for reading global values. (ie, just read offset + 1byte, to get this data, offset + 2byte to get that data, etc, etc,.)

I didn't decode that bit, someone else did, and they obviously misread what was happening. (Their data is generally correct, so I didn't bother double checking it.)

Re: Retrieving Array Data

PostPosted: Sat Apr 30, 2011 8:06 am
by L. Spiro
It is the address of a structure.
The offsets are offsets from the base of the structure, and the data order is defined by the order of the members in the structure during the time it was actually coded.


L. Spiro

Re: Retrieving Array Data

PostPosted: Sun May 01, 2011 12:06 am
by PsychoTron
L. Spiro wrote:It is the address of a structure.
The offsets are offsets from the base of the structure, and the data order is defined by the order of the members in the structure during the time it was actually coded.


L. Spiro


So, that's what a structure looks like in ASM. :)

That makes sense, I doubt they would be referenced the way they are if they were just regular global values.

Thanks, that should help me out quite a bit. :)