我是一名试图摆弄 C++ 的 Java、Python 程序员。我有以下代码片段 -
#include <windows.h>
bool IsInsideVMWare()
{
bool rc = true;
__try
{
__asm
{
push edx
push ecx
push ebx
mov eax, 'VMXh'
mov ebx, 0 // any value but not the MAGIC VALUE
mov ecx, 10 // get VMWare version
mov edx, 'VX' // port number
in eax, dx // read port
// on return EAX returns the VERSION
cmp ebx, 'VMXh' // is it a reply from VMWare?
setz [rc] // set return value
pop ebx
pop ecx
pop edx
}
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
rc = false;
}
return rc;
}
我收到以下编译错误 -
__try' undeclared (first use this function)
__except' 未声明(首先使用此函数)
那条模糊的信息甚至意味着什么?因为 try 未声明我应该先尝试使用它?
编辑:
IDE -Codeblocks
编译器 -GCC