返回列表 发帖
一般是利用 虚拟机的特性来检测 虚拟机是否存在的
另外据说 也可以检测 某些代码的执行时间来判断是否在虚拟机内

另:给出几个检测 虚拟机的代码
复制内容到剪贴板
代码:
//检测 VPC的代码
#include <windows.h>

// IsInsideVPC&#39;s exception filter
DWORD __forceinline IsInsideVPC_exceptionFilter(LPEXCEPTION_POINTERS ep)
{
PCONTEXT ctx = ep->ContextRecord;

ctx->Ebx = -1; // Not running VPC
ctx->Eip += 4; // skip past the "call VPC" opcodes
return EXCEPTION_CONTINUE_EXECUTION; // we can safely resume execution since we skipped faulty instruction
}

// high level language friendly version of IsInsideVPC()
bool IsInsideVPC()
{
bool rc = false;

__try
{
  _asm push ebx
  _asm mov ebx, 0 // Flag
  _asm mov eax, 1 // VPC function number

  // call VPC
  _asm __emit 0Fh
  _asm __emit 3Fh
  _asm __emit 07h
  _asm __emit 0Bh

  _asm test ebx, ebx
  _asm setz [rc]
  _asm pop ebx
}
// The except block shouldn&#39;t get triggered if VPC is running!!
__except(IsInsideVPC_exceptionFilter(GetExceptionInformation()))
{
}

return rc;
}
复制内容到剪贴板
代码:
//检测 VMWare的代码
bool IsInsideVMWare()
{
bool rc = true;

__try
{
  __asm
  {
   push  edx
   push  ecx
   push  ebx

   mov  eax, &#39;VMXh&#39;
   mov  ebx, 0 // any value but not the MAGIC VALUE
   mov  ecx, 10 // get VMWare version
   mov  edx, &#39;VX&#39; // port number

   in   eax, dx // read port
           // on return EAX returns the VERSION
   cmp  ebx, &#39;VMXh&#39; // 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;
}
帖子152 精华0 积分3681 阅读权限100 性别男 在线时间1005 小时 注册时间2005-6-27 最后登录2008-7-22 查看详细资料TOP 让女孩一夜变的更有女人味

doublej
晶莹剔透§烈日灼然

TOP

返回列表