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
2010-01-21 13:00:25
but if windows is the guest OS, this will not work
Microgen
2010-01-21 13:10:17
@Microgen: That's true, I'll edit.
unwind
2010-01-21 13:11:12
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
2010-01-21 13:20:40
To use WMI in C, you have to go through COM.
Joe Gauterin
2010-01-21 13:46:07
can you provide sample code?
Microgen
2010-01-21 14:50:37