473,899 Members | 4,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reliable way to get windows version. data please?

jmichae3
7 New Member
http://support.microsoft.com/kb/158238 lists the OS's for Windows ME through Windows 95.

it comes from the key
HKEY_LOCAL_MACH INE\SOFTWARE\Mi crosoft\Windows \CurrentVersion[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_MACH INE\SOFTWARE\Mi crosoft\Windows NT\CurrentVersi on[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.
Aug 14 '09 #1
8 4860
unauthorized
81 New Member
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
Aug 15 '09 #2
george666
28 New Member
Yes, the right way is with Win32 api (see Win32 group for C code, official)
Aug 26 '09 #3
jmichae3
7 New Member
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.8 5%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.
Aug 28 '09 #4
jmichae3
7 New Member
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_MACH INE\SOFTWARE\Mi crosoft\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_MACH INE\SOFTWARE\Mi crosoft\Windows NT\CurrentVersi on[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.dw MajorVersion.dw MinorVersion.dw BuildNumber

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 (GetSystemMetri cs(SM_SERVERR2) == 0)
2.5.2 Server 2003 (GetSystemMetri cs(SM_SERVERR2) != 0)
2.7.3 XP MCE
2.6.1 7 (OSVERSIONINFOE X.wProductType == VER_NT_WORKSTAT ION)
2.6.1 Server 2008 R2 (OSVERSIONINFOE X.wProductType != VER_NT_WORKSTAT ION)
2.6.0 Server 2008 (OSVERSIONINFOE X.wProductType != VER_NT_WORKSTAT ION
2.6.0 Vista (OSVERSIONINFOE X.wProductType == VER_NT_WORKSTAT ION)
Aug 29 '09 #5
jmichae3
7 New Member
correction: 0.?.? Win32s
don't know major and minor version number for win32s.
http://support.microsoft.com/kb/210200
Aug 29 '09 #6
jmichae3
7 New Member
correction 2.5.1 XP (GetSystemMetri cs(SM_MEDIACENT ER) != 0 for Media Center, wSuiteMask&VER_ SUITE_PERSONAL != 0 for Home otherwise Pro)

XP MCE is NOT 2.7.3
Aug 29 '09 #7
jmichae3
7 New Member
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_MACH INE\SOFTWARE\Mi crosoft\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_MACH INE\SOFTWARE\Mi crosoft\Windows NT\CurrentVersi on[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.dw MajorVersion.dw MinorVersion.dw BuildNumber

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_WORKSTAT ION)
2.3.1 NT 3.1 Server ([should be] OSVERSIONINFOEX .wProductType != VER_NT_WORKSTAT ION)
2.3.51 NT 3.51 Workstation ([should be] OSVERSIONINFOEX .wProductType == VER_NT_WORKSTAT ION)
2.3.51 NT 3.51 Server ([should be] OSVERSIONINFOEX .wProductType != VER_NT_WORKSTAT ION)
2.4.0 NT 4.0 WorkStation ([should be] OSVERSIONINFOEX .wProductType == VER_NT_WORKSTAT ION)
2.4.0 NT 4.0 Server ([should be] OSVERSIONINFOEX .wProductType != VER_NT_WORKSTAT ION)
2.5.0 2000 Pro ([should be] OSVERSIONINFOEX .wProductType == VER_NT_WORKSTAT ION)
2.5.0 2000 Pro Advanced Server ([should be] OSVERSIONINFOEX .wProductType != VER_NT_WORKSTAT ION)
2.5.1.2600 XP (GetSystemMetri cs(SM_MEDIACENT ER) != 0 for Media Center, wSuiteMask&VER_ SUITE_PERSONAL != 0 for Home otherwise Pro)
2.5.2 Server 2003 R2 (GetSystemMetri cs(SM_SERVERR2) != 0) - Note: you can probably also check && OSVERSIONINFOEX .wProductType != VER_NT_WORKSTAT ION
2.5.2 Server 2003 (GetSystemMetri cs(SM_SERVERR2) == 0) - Note: you can probably also check && OSVERSIONINFOEX .wProductType != VER_NT_WORKSTAT ION
2.6.0 Server 2008 (OSVERSIONINFOE X.wProductType != VER_NT_WORKSTAT ION)
2.6.0 Vista (OSVERSIONINFOE X.wProductType == VER_NT_WORKSTAT ION)
2.6.1 7 (OSVERSIONINFOE X.wProductType == VER_NT_WORKSTAT ION)
2.6.1 Server 2008 R2 (OSVERSIONINFOE X.wProductType != VER_NT_WORKSTAT ION) - Note: you can probably also check GetSystemMetric s(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 GetSystemMetric s() 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.
Aug 30 '09 #8
jmichae3
7 New Member
this information I researched will also be posted at http://JesusnJim.com/programming/GetVersionEx.html
Aug 30 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1709
by: Pieter Linden | last post by:
Hi, I'm probably asking for the moon, but I was wondering if it were possible to return the OS version information from a *remote* computer on a network. I can get all the hostnames, their IP addresses and the MAC addresses bound to that IP address no problem. What I would *really* like is to be able to query the remote registry or whatever for the Windows version, so if it's something like Win2000 and any SP below 3, I can update to...
3
2173
by: James | last post by:
I can get the windows version number from System.Environment.OSVersion e.g. "Windows NT 5.1.2600.0" for XP SP2. I was wondering whether this tells you the type of windows it is or if you have to use something else? E.g. for windows 2000 do you just get a version number, or can you tell if it is Professional, Server, Advanced Server, Datacenter Server.
0
3041
by: John Dyer | last post by:
We need to be able to set the version information for .net exe's and dll's after the build has happened. This is so we do not need to check out files that have not changed just to "tweak" the version data. I am trying to emulate the functionality that Dev Studio has where I have been able to change the version information by loading in a dll or exe and selecting the version resource. I then am able to "drill" down to the version...
1
1133
by: Richard | last post by:
Hi all, I'm doing some custom RAS work and I need to marshal the struct definition below. The marshaling is no problem, however how can I acheive the effect of the windows version pre-processor check in C#? typedef struct tagRASDIALEXTENSIONS { DWORD dwSize; DWORD dwfOptions; HWND hwndParent;
1
1913
by: Joachim | last post by:
Hi I wonder how you through a Visual Studio C++ 6.0 program can detect the Windows version, e g XP, 2000 or 98 Thanks Joachim
1
1580
by: Praveen | last post by:
Hi All, Can anybody tell from where i can download the latest Postgress Windows version? Thanks, Praveen
1
6178
by: Norman Chong | last post by:
Hi group, I want to get some information about the Windows version and ServicePack. I used the WinAPI but got the following problem: When I try to pass my OSVERSIONINFOEX structure ByRef to the getVersionEx API-function, the structure remains empty. Shouldn't this contain the values after the call?? Does anybody know what's wrong in my code (Or maybe in my way of thinking)??
6
5064
by: Newbie Coder | last post by:
C++.NET 2003 ONLY Hi all, I need to check to see that the user is using Windows 2000 or later on program startup. If not, to disable one radiobutton I have searched Google & all I get is C++ or earlier code, but nothing that compiles in my version of C++.
1
2847
by: vineetbindal | last post by:
I am using GridView in silver light application i am following some example blogg something scoutt's blog. i need to have access to my grid view in my cs file, when i type in "using System.Windows.Controls.Data;" it gives me error the type or namespace name Data does not exist in the name space System.Windows.Controls.Data... I have added this dll in the referance but visual studio is not able to see it? please help me.
0
9997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11272
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10863
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10971
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9666
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8039
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5887
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4300
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.