检测VMWare虚拟机
bool IsInsideVMWare_(){
bool r;
_asm
{
push edx
push ecx
push ebx
mov eax, 'VMXh'
mov ebx, 0 // any value but 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 // set return value
pop ebx
pop ecx
pop edx
}
return r;
}
bool FV_VMWare_VMX()
{
__try
{
return IsInsideVMWare_();
}
__except(1) // 1 = EXCEPTION_EXECUTE_HANDLER
{
return false;
}
}00401000/$51 PUSH ECX ;1.004070C0
00401001|.53 PUSH EBX
00401002|.52 PUSH EDX
00401003|.51 PUSH ECX
00401004|.53 PUSH EBX
00401005|.B8 68584D56 MOV EAX, 0x564D5868
0040100A|.BB 00000000 MOV EBX, 0x0
0040100F|.B9 0A000000 MOV ECX, 0xA
00401014|.BA 58560000 MOV EDX, 0x5658
00401019|.ED IN EAX, DX
0040101A|.81FB 68584D56 CMP EBX, 0x564D5868
00401020|.0F944424 13 SETE BYTE PTR SS:
00401025|.5B POP EBX
00401026|.59 POP ECX
00401027|.5A POP EDX
00401028|.8A4424 07 MOV AL, BYTE PTR SS:
0040102C|.5B POP EBX
0040102D|.59 POP ECX
0040102E\.C3 RETN
果断先收藏了再慢慢看……一直想找的代码 果断赞一个!! 支持收藏了,感谢飘云老大 感谢楼主分享!
页:
[1]