首页 > 学院 > 开发设计 > 正文

检测你的程序是否运行在虚拟机(VMware)

2019-11-18 17:59:12
字体:
来源:转载
供稿:网友

//------------------------------------------------------------------

构建一个函数,使用了汇编语言啊,嘿嘿!

// -------------------开始-----------------------------------------

function IsVMwarePResent(): LongBool; stdcall

begin
  
Result := False;
 
{$IFDEF CPU386}
  
try
    asm
            
mov     eax, 564D5868h
            mov     ebx, 00000000h
            mov     ecx, 0000000Ah
            mov     edx, 00005658h
            in      eax, dx
            cmp     ebx, 564D5868h
            jne     @@exit
            mov     Result, True
    @@exit:
    end;
  
except
    
Result := False;
  end;
{$ENDIF}
end;

//------------------form http://blog.csdn.net/laoli----------------------------------------------------------

//---------------------------测试一下-----------------------------------------------------------------------------------

rocedure TForm1.FormCreate(Sender: TObject);
begin
 if  IsVMwarePresent then
     ShowMessage('你运行在虚拟机')

     else
      ShowMessage('正常运行')
      end;

//---------------------------------------------------------------------------------------------------------------------------

//----------------先保存---------按F9,运行,晕!有提示信息.不理!再按F9,:正常运行',哈哈!



上一篇:OTA:使用本地IDE对象[D4]

下一篇:使用break与continue语句和for与continue语句

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
学习交流
热门图片

新闻热点

疑难解答

图片精选

网友关注