我有一个内联汇编程序函数检测程序是否在虚拟机上运行。但是在64位内联汇编中不再可用,现在在这里是x64内在函数。是否有另一种方法来检测它?检测虚拟化
下面是代码适用于32位的VMWare
布尔IsInsideVMWare(无效) {
布尔RC =真;
__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(过滤器(GetExceptionCode()))
{ RC = FALSE; }
return rc; }