I have the following
struct john {
int oldA;
int A;
} myJohn;
DWORD gotoAddressBack = 0x00401000;
void __declspec( naked ) test(void) {
__asm {
MOV myJohn.oldA, DWORD PTR DS:[ESI+0x77C]
MOV DWORD PTR DS:[ESI+0x77C], myJohn.A
JMP gotoAddressBack
}
}
You can tell that both MOV’s generate the error C2415: improper operand type.
As you can see what I want to do is store [ESI+0x77C]’s value into myJohn.oldA
Then I want to replace the same [ESI+0x77C]’s value with myJohn.A
There is no memory/memory operand for
MOVinstruction. You should use a register for such usages. This is something like that:BTW, I really suspect that you really have to deal with segment registers under modern OSes (due to virtual memory, i.e. you can use direct addresses). You should check your code after above changes.