Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to detect VPC programmatically inside a VM?

31 views
Skip to first unread message

Bo Berglund

unread,
May 9, 2007, 9:42:46 AM5/9/07
to
I need to modify a few programs I have written to work inside a
virtual machine running Windows. Thus I need to have a way to detect
that the program is running in a virtual machine (VPC2004 & 2007 only,
I don't care about VMWare).

My programs are written in Borland Delphi7 so I would need some kind
of Win32 API call or similar to embed into the Delphi program.

Has anyone here succeeded with this?

(I did use www.deja.com to search but found only references to VB
scripting and inline assembler in C++ programs ad similar.

The closest yet is the registry read of the SystemBiosVersion in
HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System.
Inside a VM with VPC2007 running Windows2000Pro that reads as:
"BIOS DATE: 02/22/06 20:54:49 Ver: 08.00.02"

Is this going to be valid for all time and for all Windows operating
systems, or is there a better way???


Bo Berglund
bo.berglund(at)nospam.telia.com

Sylvain Lafontaine fill the blanks, no spam please

unread,
May 9, 2007, 10:37:18 AM5/9/07
to
If you can call ActiveX objects from Delphi7 then probably the following
piece of code will work for you:

http://blogs.msdn.com/virtual_pc_guy/archive/2005/10/27/484479.aspx

This is a VB script but the important thing here is that it is using the WMI
objects/services.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


"Bo Berglund" <bober...@home.se> wrote in message
news:78j3431o939qghlch...@4ax.com...

Robert Comer

unread,
May 9, 2007, 10:57:48 AM5/9/07
to
http://blogs.msdn.com/virtual_pc_guy/archive/2005/10/27/484479.aspx

--
Bob Comer


On Wed, 09 May 2007 15:42:46 +0200, Bo Berglund <bober...@home.se>
wrote:

Karl E. Peterson

unread,
May 9, 2007, 11:43:19 AM5/9/07
to
Sylvain Lafontaine <sylvain aei ca (fill the blanks, no spam please)> wrote:
> If you can call ActiveX objects from Delphi7 then probably the following
> piece of code will work for you:
>
> http://blogs.msdn.com/virtual_pc_guy/archive/2005/10/27/484479.aspx
>
> This is a VB script but the important thing here is that it is using the WMI
> objects/services.

Unfortunately, WMI isn't always enabled. Can't count on it on systems that aren't
under your control.
--
.NET: It's About Trust!
http://vfred.mvps.org


Bo Berglund

unread,
May 9, 2007, 12:55:43 PM5/9/07
to
On Wed, 9 May 2007 08:43:19 -0700, "Karl E. Peterson" <ka...@mvps.org>
wrote:

>Sylvain Lafontaine <sylvain aei ca (fill the blanks, no spam please)> wrote:
>> If you can call ActiveX objects from Delphi7 then probably the following
>> piece of code will work for you:
>>
>> http://blogs.msdn.com/virtual_pc_guy/archive/2005/10/27/484479.aspx
>>
>> This is a VB script but the important thing here is that it is using the WMI
>> objects/services.
>
>Unfortunately, WMI isn't always enabled. Can't count on it on systems that aren't
>under your control.

And the other method in the blog was:
devcon hwids * | ....

But that does not pan pout either since devcon is not a recognized
command on my systems...

So I googled and found this likk for downloading devcon:
http://support.microsoft.com/kb/311272

However, it is not redistributable, so cannot be used....

Other ideas?
/Bo

Bo Berglund
bo.berglund(at)nospam.telia.com

Chris Barnabo

unread,
May 9, 2007, 8:01:26 PM5/9/07
to
In article <78j3431o939qghlch...@4ax.com>,
bober...@home.se says...

> I need to modify a few programs I have written to work inside a
> virtual machine running Windows. Thus I need to have a way to detect
> that the program is running in a virtual machine (VPC2004 & 2007 only,
> I don't care about VMWare).

Bo, there are a wide variety of methods that you can use to detect
whether you're running in a virtual machine with varying degrees of
accuracy. Tom Liston and Ed Skoudis at SANS did a paper on it fairly
recently (and ways by which the detection could theoretically be
circumvented), it's a good overview. You'll find it at:

http://handlers.sans.org/tliston/ThwartingVMDetection_Liston_Skoudis.pdf

-- Chris
________*________ Chris Barnabo, ch...@spagnet.com
____________ \_______________/ http://www.spagnet.com
\__________/ / /
__\ \_______/ /__ "The heck with the Prime Directive,
\_______________/(- let's destroy something!"

0 new messages