Determine if the program is running within VMware

Source: Internet
Author: User

Many users now like to use virtual machines to test their software to avoid damage to the real machine environment. However, in the virtual machine, some features are limited, and even impossible to complete, so you need to determine the environment of the virtual machine in the program, if the program is running within the virtual machine, it will be the virtual machine can not be used under the function of the screen off.

To determine if the program is within a VMware virtual machine, you can do so using the following code:

function Isruninvmware (out errmsg:string): Boolean;
Begin
Result: = False;
Try
Asm
Push edx
Push ECX
Push EBX
mov eax, ' vmxh '
mov ecx, $0a
mov edx, ' VX '
in eax, DX
CMP ebx, ' vmxh '
Setz [Result]
Pop ebx
Pop ecx
Pop edx
End
Except
On E:exception do
ErrMsg: = E.message;
End
End

This code was compiled under Delphi2009, and the VMWare 5/6 test passed.

Determine if the program is running within VMware

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.