Jesus 'n Jim

A mainly PC (some Mac) site w/Software, Computer Repair Info, How-To's on Using Computers
Technical Support 1-360-521-2060 (my business line cell)

Get Windows Version Information using GetVersionEx(), data included

 

The program GetVersionEx can be found here under the Software section. This page is dedicated to windows version info that GetVersionEx would return.

http://support.microsoft.com/kb/92936/
in windows 3.1 things switched to the function GetVersion() which returned a DWORD: the high byte was the major version, and the low byte was the minor version number.

but I think after Win32s GetVersionEx() was introduced, which can take two different types of structures, depending on whether or not you need the Service Pack major+minor version number or not.

major and minor version numbers for 2000-7/2008/2008 R2

major and minor version numbers and build numbers for 95-ME

information about win32

information about win32s being platformid==0

information about windows nt 3.51:

http://support.microsoft.com/kb/158238 lists the OS's for Windows ME through Windows 95. it comes from the registry string HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion[VersionNumber] and you don't bother with the appended A's and B's because that is in a different entry.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion[CurrentVersion] seems to contain the version number for windows NT-family OS's, such as NT, XP, 2000, Vista, 2008 and 7 I think.

dwPlatformID.dwMajorVersion.dwMinorVersion.dwBuildNumber

0.3?.1? Win32s on windows 3.1? (someone please get the info and email me back.)
0.3?.11? Win32s on windows 3.11? (someone please get the info and email me back.)
today's win32 code is unuseable on Win32s!

1.4.0.950 95       (yes, can be either)
1.4.0.950 95 (SP1) (yes, can be either)
1.4.0.1111 95 OEM SR2
1.4.3.1212 95 OEM SR2.1
1.4.3.1213 95 OEM SR2.1
1.4.3.1214 95 OEM SR2.1 (yes, can be either)
1.4.3.1214 95 OEM SR2.5 (yes, can be either)
1.4.10.1998 98
1.4.10.2222 98 SE
1.4.90.3000 ME

2.3.1 NT 3.1 Workstation  ([should be] OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION)
2.3.1 NT 3.1 Server  ([should be] OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION)
2.3.51 NT 3.51 Workstation  ([should be] OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION)
2.3.51 NT 3.51 Server  ([should be] OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION)
2.4.0 NT 4.0 WorkStation  ([should be] OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION)
2.4.0 NT 4.0 Server  ([should be] OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION)
2.5.0 2000 Pro  ([should be] OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION)
2.5.0 2000 Pro Advanced Server  ([should be] OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION)
2.5.1.2600 XP (GetSystemMetrics(SM_MEDIACENTER) != 0 for Media Center, wSuiteMask&VER_SUITE_PERSONAL != 0 for Home otherwise Pro)
2.5.2 Server 2003 R2 (GetSystemMetrics(SM_SERVERR2) != 0) - Note: you can probably also check  && OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION
2.5.2 Server 2003 (GetSystemMetrics(SM_SERVERR2) == 0) - Note: you can probably also check  && OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION
2.6.0 Server 2008 (OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION)
2.6.0 Vista (OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION)
2.6.1 7 (OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION)
2.6.1 Server 2008 R2 (OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION) - Note: you can probably also check  GetSystemMetrics(SM_SERVERR2) != 0

win32s

But Win32s (windows 3.1 with Win32s) has some issues with today's 32-bit executeables, so installers beware. The last version of Visual C++ that could generate Win32s code was 4.1.
http://www.vim.org/htmldoc/os_win32.html
http://msdn.microsoft.com/en-us/library/aa697418%28VS.71%29.aspx
Win32 console-mode programs are unusable on Win32s. My attempts at a Win32 console mode program that called GetVersionEx() and GetSystemMetrics() failed on Win32s. It appears console mode support is available on win9x/ME. It will be difficult to find Windows 3.x apps these days, much less a compiler (VC++ 4.1 or lower) for it.

check out this text file on version numbers and their corresponding windows version names.