Say I got something like this..
bool isPatched;
I have a few other GUI’s where I set isPatched= true; and isPatched= false;, isPatched = !isPatched;
void __declspec( naked ) test(void) { //
__asm {
PUSHAD
PUSHFD
MOV EAX, isPatched
CMP EAX, 0
je noPatched
MOV EAX, DWORD PTR DS:[ESI+0x77C]
MOV John.oldA, EAX
MOV EAX, John.A
MOV DWORD PTR DS:[ESI+0x77C], EAX
JMP finish
noPatched:
PUSH EDX
MOV DWORD PTR DS:[ESI+0x77C], EDX
finish:
POPFD
POPAD
JMP gotoAddressBack
}
}
Is it possible to use bool operator in inline assembly?
I think it thinks isPatched is a label.. from this error message.
error C2094: label 'isPatched' was undefined
You want to
TESTorCMP.TESTis the easiest in this case:Depending on other cases you can also use
SUB,SETccorMOVccYour issue is one of scoping,
isPatchedis not in scope when used by the ASM, so it assumes it to be aDWORD, and then fails to find a memory label (the symbol name) for it when generating the addresses. You also need to use the correct operand size forboolas well.A dirty litte test for MSVC
this outputs 1 when
bistrue, or 0 whenbisfalse.