Connecting Tech Pros Worldwide Help | Site Map

reliable way to get windows version. data please?

jmichae3's Avatar
Newbie
 
Join Date: Aug 2009
Posts: 7
#1: Aug 14 '09
http://support.microsoft.com/kb/158238 lists the OS's for Windows ME through Windows 95.

it comes from the key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion[VersionNumber]
and you don't bother with the appended A's and B's because that is in a different entry.


Microsoft doesn't have such a list for newer OS's, unfortunately.

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.

question is, for those OS's, what is the value of CurrentVersion?
for XP it's "5.1"
for 2003 it's "5.2"
for 2000 it's "5.0"
for NT 4.0 it's "4.0" I think
for NT 3.1, 3.5, 3.51, I don't know.
for Vista? 6.0?
for 2008? 6.1?
for 7? 7.0?
somebody help me out here. I am trying to write installers and code, and the detection is important.


It would be a whole lot simpler to use ProductName in the same key because it has name strings, but I am not sure if it is available on all boxen in "Windows NT" key on the NT family boxen and the "Windows" key on the 95-me boxen.
someone please verify. I can verify on 98SE and XP.
Member
 
Join Date: May 2009
Posts: 81
#2: Aug 15 '09

re: reliable way to get windows version. data please?


The most "reliable" way to get the local OS's version is through the Windows API. If you don't fancy using C/VB then look up the MS documentation on the registry:
http://technet.microsoft.com/en-us/l...8WS.10%29.aspx
Newbie
 
Join Date: Jul 2008
Posts: 26
#3: Aug 26 '09

re: reliable way to get windows version. data please?


Yes, the right way is with Win32 api (see Win32 group for C code, official)
jmichae3's Avatar
Newbie
 
Join Date: Aug 2009
Posts: 7
#4: Aug 29 '09

re: reliable way to get windows version. data please?


I am looking for something I can use to write installers with and base simple code off of. reading the registry is the only thing that commonly works right across the 2 applications I am thinking of. win32/DLL calls are out because the language is broken (Auto-it3). I know about GetVersionEx(). nobody has answered my question. I have incomplete answers to my data request still, but i think I found a partial answer:

http://msdn.microsoft.com/en-us/library/ms724834%28VS.85%29.aspx#

gives the list of data (version numbers) for querying the version number, regardless of the method used. all methods go to the registry anyway.
what varies is where the information is stored in what OS sometimes.
jmichae3's Avatar
Newbie
 
Join Date: Aug 2009
Posts: 7
#5: Aug 29 '09

re: reliable way to get windows version. data please?


guys, regardless of the method used, I still needed the data anyway. thanks for the effort. I found what I was looking for and posted it so I can help others who need the same information. the only thing I don't have is version number major and minor information on Windows NT 3.51 and Windows NT 3.1. I *think* I have Win32s, which I think is 0.0 If I am wrong please correct me with an article, preferably one from Microsoft.

if you don't know about the MSDN, it is at http://msdn.microsoft.com and contains developer information. technet contains technician/IT information, and generally you can find it all from the search bar at microsoft.com.

here is what I have so far (need more specifics on NT 3.x):


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
http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

major and minor version numbers and build numbers for 95-ME
http://support.microsoft.com/kb/158238

http://support.microsoft.com/kb/158238 lists the OS's for Windows ME through Windows 95.
it comes from the key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion[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.dwBuild Number

1.0.0 Win32s
1.4.0.950 95
1.4.0.950 95 (SP1)
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.5
1.4.10.1998 98
1.4.10.2222 98 SE
1.4.90.3000 ME

2.3 NT 3.1 or NT 3.51
2.4.0 NT 4.0
2.5.0 2000
2.5.1 XP
2.5.2 Server 2003 R2 (GetSystemMetrics(SM_SERVERR2) == 0)
2.5.2 Server 2003 (GetSystemMetrics(SM_SERVERR2) != 0)
2.7.3 XP MCE
2.6.1 7 (OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION)
2.6.1 Server 2008 R2 (OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION)
2.6.0 Server 2008 (OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION
2.6.0 Vista (OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION)
jmichae3's Avatar
Newbie
 
Join Date: Aug 2009
Posts: 7
#6: Aug 29 '09

re: reliable way to get windows version. data please?


correction: 0.?.? Win32s
don't know major and minor version number for win32s.
http://support.microsoft.com/kb/210200
jmichae3's Avatar
Newbie
 
Join Date: Aug 2009
Posts: 7
#7: Aug 29 '09

re: reliable way to get windows version. data please?


correction 2.5.1 XP (GetSystemMetrics(SM_MEDIACENTER) != 0 for Media Center, wSuiteMask&VER_SUITE_PERSONAL != 0 for Home otherwise Pro)

XP MCE is NOT 2.7.3
jmichae3's Avatar
Newbie
 
Join Date: Aug 2009
Posts: 7
#8: Aug 30 '09

re: reliable way to get windows version. data please?


this should be my final report, at least until another OS beyond 7 comes out.

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
http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

major and minor version numbers and build numbers for 95-ME
http://support.microsoft.com/kb/158238

information about win32
http://support.microsoft.com/kb/189249

information about win32s being platformid==0
http://support.microsoft.com/kb/210200

information about windows nt 3.51:
http://msdn.microsoft.com/en-us/libr...8VS.60%29.aspx


http://support.microsoft.com/kb/158238 lists the OS's for Windows ME through Windows 95.
it comes from the key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion[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.dwBuild Number

0.3?.1? Win32s on windows 3.1? (someone please get the info and email me back. today's win32 code is unuseable on Win32s!)
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
1.4.0.950 95 (SP1)
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.5
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


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/libr...8VS.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.
jmichae3's Avatar
Newbie
 
Join Date: Aug 2009
Posts: 7
#9: Aug 30 '09

re: reliable way to get windows version. data please?


this information I researched will also be posted at http://JesusnJim.com/programming/GetVersionEx.html
Reply

Tags
windows version detection