Hey, Im using readprocessmemory to get information on a game, but for some reason it skips two bytes..

part of my structure is similar to

WORD a;
DWORD b;
DWORD c;
DWORD d;

and i read the following memory into it:
00 00 FF FF FF FF 02 00 00 00 FF FF FF FF

i get the result

a=00 00
b= FF FF 02 00 // should be  FF FF FF FF 
c= 00 00 FF FF
d= FF FF ?? ??

does anyone know why it would skip 4 bytes??

i read everything at once, and i have everything in the rest of the struct working, and just happen to notice this issue...

thanks
M

Just a guess, but if you are trying to read the contents of a structure perhaps there are holes in the structure, such as the packing factor is something other than 1.

#pragma pack(1)
struct mystuff
{
   WORD a;
    DWORD b;
   // etc
};
#pragma pack()
commented: Expert analysis +1
commented: *nods* +35

thanks! that worked great...

you just know the answer to everything dont you?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.