#define CANCEL_COMMON_DIALOG_HOOK(name) \
void __declspec(naked) ##name##CancelCommonDialogHook(void) \
{ \
__asm \
{ \
add esp, [k##name##CancelCommonDialogStackOffset] \
jz RESTORE \
jmp [k##name##CancelCommonDialogNewFileRetnAddr] \
RESTORE: \
pushad \
call DoSavePluginCommonDialogHook \
test eax, eax \
jnz REMOVE \
popad \
jmp [k##name##CancelCommonDialogRestoreRetnAddr] \
REMOVE: \
popad \
jmp [k##name##CancelCommonDialogRemoveRetnAddr] \
} \
}
Using the above macro causes the compiler to throw this error:
error C2400: inline assembler syntax
error in ‘second operand’; found
‘RESTORE’
What have I done incorrectly ?
EDIT:
void __declspec(naked) #name##CancelCommonDialogHook(void) \
{ \
__asm add esp, [k##name##CancelCommonDialogStackOffset] \
__asm jz RESTORE \
__asm jmp [k##name##CancelCommonDialogNewFileRetnAddr] \
RESTORE: \
__asm pushad \
__asm call DoSavePluginCommonDialogHook \
__asm test eax, eax \
__asm jnz REMOVE \
__asm popad \
__asm jmp [k##name##CancelCommonDialogRestoreRetnAddr] \
REMOVE: \
__asm popad \
__asm jmp [k##name##CancelCommonDialogRemoveRetnAddr] \
}
The above code doesn’t work either:
error C2447: ‘{‘ : missing function
header (old-style formal list?) error
C2014: preprocessor command must start
as first nonwhite space
Fixed it by enclosing the function body in another scope.