Page 1 of 1

Determining host operating system using VB 6

Posted: Wed 09 Jun 2010, 09:09
by elizas
Hi all,
I am sharing this topic with you.Hope u all find this very interesting.
Any suggestions are appreciated.

The first step is to make some simple declarations. Add the following code to your projects declarations.

Private Const VER_PLATFORM_WIN32s = 0
Private Const VER_PLATFORM_WIN32_WINDOWS = 1
Private Const VER_PLATFORM_WIN32_NT As Long = 2

Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As Any) As Long

Private Type OSVERSIONINFO
OSVSize As Long
dwVerMajor As Long
dwVerMinor As Long
dwBuildNumber As Long
PlatformID As Long
szCSDVersion As String * 128
End Type

After we are done with the above declaration we can have some methods/functions to determine current OS as shown below.

# 1.
Public Function IdentifyOperatingSystem() As String
Dim rOsVersionInfo As OSVERSIONINFO
Dim sOperatingSystem As String
sOperatingSystem = "NONE"
rOsVersionInfo.OSVSize = Len(rOsVersionInfo)
If GetVersionEx(rOsVersionInfo) Then
Select Case rOsVersionInfo.PlatformID

http://www.mindfiresolutions.com/Determ ... -6-189.php

Posted: Wed 09 Jun 2010, 13:46
by Sit Heel Speak
This seems interesting but I do not really know what I'm looking at.

I do not know Windows VB6 at all, so no doubt the questions below show my ignorance, but...

Is it the purpose of this program, to return the exact identity of the Windows OS under which, say, QEMU, is being run?

If yes, does it return the identity to Windows, or can it be adapted to return the information to Linux?

If I am on the right track...is there a way to identify exactly which Windows is being run, in the case where it is something newer than NT, i.e. does this code snippet return

XP
Vista
Windows Seven

or, better, information which is even more detailed, i.e. includes the subversion (e.g. "Windows Seven 64-bit Ultimate," Windows XP 32-bit Media Edition 2005", and the like)?

Posted: Wed 09 Jun 2010, 17:24
by Iguleder
It's called uname. And yes, you can get uname for Windows.