Reputation: 319
In the following code, rEDX, rEBX, rEBP, rESI and rEDI
are the members of the structure scratch_space
. scratch_space_arg
is an object of the structure scratch_space
.
lea eax, scratch_space_arg
mov [ecx+[eax].rEDX], edx
mov [ecx+[eax].rEBX], ebx
mov [ecx+[eax].rEBP], ebp
mov [ecx+[eax].rESI], esi
mov [ecx+[eax].rEDI], edi
This code gives me an:
error C2426: '[' : illegal operator in 'first operand'
for all the mov
statements. Any idea how I can resolve this?
PS: I used this article to access the struct
members.
Upvotes: 3
Views: 1399
Reputation: 753930
I recommend disassembling some C code that references the structure elements:
struct scratch_space scratch_space_arg = { 0, 0, 0, 0, 0 };
int rEDX = scratch_space_arg.rEDX;
int rEBX = scratch_space_arg.rEBX;
int rEBP = scratch_space_arg.rEBP;
int rESI = scratch_space_arg.rESI;
int rEDI = scratch_space_arg.rEDI;
printf("%d %d %d %d %d\n", rEDX, rEBX, rEBP, rESI, rEDI);
Then you'll know the correct notation to use yourself.
Upvotes: 2