Question

I just want to known how to get BIO information in C++. I tried following option but each one has its drawback.

  1. From Registry: But I found some system where HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS is missing may be it is virtual machine.
  2. Using WMI: But It is not necessary that WMI will run on all the systems, because in certain cases either the service is disabled or the WMI object is missing!!

I need one permanent solution that gives me BIO information in c++.

Was it helpful?

Solution

Trying to detect if you are in a virtual OS is done in various ways and depends on the virtualization software being used.

There are many different questions about this already on stackoverflow.

In no particular order, here are some articles, they cover a variety of the different virtualization pieces used:

Detect virtualized OS from an application?

detect if application running on virtual box

64-bit windows VMware detection

How to identify that you're running under a VM?

http://www.codeproject.com/Articles/9823/Detect-if-your-program-is-running-inside-a-Virtual

OTHER TIPS

Whilst Salgar beat me to it, one of the more "safe" methods is to use the CPUID instruction, which generally works on modern VM's. I know that KVM, Microsoft and Xen uses a CPUID leaf around 0x40000000 that gives back "You are in a virtual machine". Not 100% sure if VMWare also supports the same one - on a "real" machine, these are reserved and not used.

Here's a page that discusses several options besides CPUID: http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/detecting-x86-virtual-machines.html and there are several links for further reading.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top