sers\97003\AppData\Local\Temp\ccuToHew.s: Assembler messages: C:\Users\97003\AppData\Local\Temp\ccuToHew.s:25: Error: invalid instruction suffix for `push' C:\Users\97003\AppData\Local\Temp\ccuToHew.s:31: Error: operand type mismatch for `call'
时间: 2023-07-24 15:16:11 浏览: 180
抱歉,看起来在转换汇编指令时出现了一些问题。尝试使用以下代码,它应该可以在MinGW-w64中正常编译和运行:
```cpp
#include <windows.h>
#define vPushData 0x10
#define vCall 0x12
#define vEnd 0xff
char *str = "Hello World";
BYTE bVmData[] = {
vPushData, 0x00, 0x00, 0x00, 0x00,
vPushData, 0x00, 0x00, 0x00, 0x00,
vPushData, 0x00, 0x00, 0x00, 0x00,
vPushData, 0x00, 0x00, 0x00, 0x00,
vCall, 0x00, 0x00, 0x00, 0x00,
vEnd
};
void __declspec(naked) VM(void* pvmData)
{
__asm
{
mov ecx, dword ptr[pvmData]
__vstart:
mov al, byte ptr[ecx]
cmp al, vPushData
je __vPushData
cmp al, vCall
je __vCall
cmp al, vEnd
je __vEnd
int 3
__vPushData:
inc ecx
mov edx, dword ptr[ecx]
push edx
add ecx, 4
jmp __vstart
__vCall:
inc ecx
mov edx, dword ptr[ecx]
call edx
add ecx, 4
jmp __vstart
__vEnd:
ret
}
}
int main(int argc, char* argv[])
{
*(DWORD*)(bVmData + 5) = (DWORD)str;
*(DWORD*)(bVmData + 10) = (DWORD)str;
*(DWORD*)(bVmData + 20) = (DWORD)MessageBoxA;
VM(bVmData);
return 0;
}
```
请确保你的编译器和工具链设置正确,并且已正确安装并配置了MinGW-w64。如果仍然遇到问题,请提供更多详细的错误信息和环境信息,以便我能更好地帮助你。
阅读全文