[英]Encountered error while Defining __asm Blocks as C Macros
When I try to define a multi-instruction shared byte obfuscating code with c macro, there is an error when compiling, the error codes are C2414 and C2400 If the c macro definition is not used, it can be compiled successfully当我尝试用c宏定义多指令共享字节混淆码时,编译时出现错误,错误码分别为C2414和C2400 如果c宏定义没有使用,可以编译成功
#include <stdio.h>
#define test __asm{\
__asm jmp $+5\
}
#define test1 __asm{\
__asm _emit 0xeb\
__asm _emit 0xff\
__asm _emit 0xc0\
__asm _emit 0x48\
}
int main()
{
test1;
}
How can I use this obfuscating code inside a c macro?如何在 c 宏中使用此混淆代码?
According to this then multiple __asm
on a single line should be ok. 据此,单行上的多个
__asm
应该没问题。 But after compiling your code in MSVC, the actual problem reported is:但是在 MSVC 中编译代码后,报告的实际问题是:
(15): error C2059: syntax error: 'bad suffix on number'(15):错误 C2059:语法错误:“数字后缀错误”
And then we realize that your macro expands to __asm _emit 0xeb__asm _emit 0xff
and so on, where 0xeb__asm
is gibberish.然后我们意识到您的宏扩展为
__asm _emit 0xeb__asm _emit 0xff
等等,其中0xeb__asm
是乱码。 Adding a space to each row like 0xeb \
made your code compile cleanly.为每一行添加一个空格,如
0xeb \
使您的代码可以干净地编译。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.