08-30-2011، 12:04 PM
شناسایی ماشین مجازی یا همان vm در c++
کد:
#include <windows.h>
#include <iostream>
int main()
{
int flag = 0;
__try {
__asm {
push edx;
push ecx;
push ebx;
mov eax, 'VMXh';
mov ebx, 0; // This can be any value except
mov ecx, 10; // "CODE" to get the VMware Version
mov edx, 'VX'; // Port Number
in eax, dx; // Read port
//On return EAX returns the VERSION
cmp ebx, 'VMXh'; // is it VMware
setz [flag]; // set return value
pop ebx;
pop ecx;
pop edx;
}
}
__except(EXCEPTION_EXECUTE_HANDLER) {
flag = 0;
MessageBoxA(NULL, "No VMware Instance Detected", "No VMware", MB_OK);
}
if (flag != 0) { MessageBox(NULL, "VMware Detected", "VMware Detected", MB_OK); }
getchar();
}