【发布时间】:2010-07-27 08:27:35
【问题描述】:
我有一个内联汇编函数检测程序是否在虚拟机上运行。但是在 64 位内联汇编中不再可用,现在这里是 x64 内在函数。有没有其他检测方法?
这是适用于 32 位 VMWare 的代码
bool IsInsideVMWare(void) {
bool rc = true;
__尝试
{
__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(filter(GetExceptionCode()))
{ rc = 假; }
返回 rc; }
【问题讨论】:
标签: 64-bit vmware virtual-machine detect