Hello again
I have a little question about a struct i am little confused
Original code works not
or [eax]._struct.dwArray[ecx*4-6],
patch i with Olly to 4+4 works why?
or dword ptr [eax+ecx*4+4],
4-6 is 2
and
4+4 8
or not?
Regards,
We would need to see a little more code to know what you are trying to do...
Tested with ML 6.14 ... 10.0 and JWasm:
include \masm32\include\masm32rt.inc
.data
rc RECT <12, 34, 56, 78>
.code
start:
mov edi, offset rc
m2m ebx, 2
print str$(rc.left), " = left", 13, 10
or [edi.RECT.left][ebx*4-8], -1
print str$(rc.left), " = left", 13, 10
print str$(rc.top), " = top", 13, 10
or [edi].RECT.left[ebx*4-4], -1
inkey str$(rc.top), " = top"
exit
end start
4-6 is minus 2
Yes that i think
but i can write as well
or [eax]._struct.dwArray[ecx*4-6]
to
or [eax]._struct.dwArray[ecx*2] ??
No.
I can't tell what the question is. Perhaps this will help?
All these give the same value, namely [eax]._struct.dwArray[2] :
IF ecx = 2: [eax]._struct.dwArray[ecx*4-6]
IF ecx = 1: [eax]._struct.dwArray[ecx*4-2]
IF ecx = 0: [eax]._struct.dwArray[ecx*4+2]
So by adjusting ecx appropriately any of these three expressions could be used
you have to show us how "_struct" is defined
MYSTRUCT STRUCT
stuff dd ?
MYSTRUCT STRUCT
that defines a structure type
.data?
MyStruct MYSTRUCT <>
that defines a structure in the data? section
mov edx,offset MyStruct
mov eax,[edx].MYSTRUCT.stuff
or
mov eax,MyStruct.stuff
are both valid ways to acess it