views:

109

answers:

1

I already know how to detect VMWare and VirtualPC, but I want to know how to do this in Kernel Virtual Machine. I would like the code to be in C or C++.

+1  A: 

This page implies that it's enough to check the kernel's boot messages, if Linux is your hosted OS:

 # dmesg | grep -i virtual
 CPU: AMD QEMU Virtual CPU version 0.9.1 stepping 03

That should be easy enough to implement in C.

unwind
but if windows is the guest OS, this will not work
Microgen
@Microgen: That's true, I'll edit.
unwind
if you run a wmi query on win32_computersystem you will see that the manufacturer and model store vm vendor. but i dont know how to run a wmi query in c
Microgen
To use WMI in C, you have to go through COM.
Joe Gauterin
can you provide sample code?
Microgen