reliable way to get windows version. data please?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmichae3
    New Member
    • Aug 2009
    • 7

    reliable way to get windows version. data please?

    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.
  • unauthorized
    New Member
    • May 2009
    • 81

    #2
    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:

    Comment

    • george666
      New Member
      • Jul 2008
      • 28

      #3
      Yes, the right way is with Win32 api (see Win32 group for C code, official)

      Comment

      • jmichae3
        New Member
        • Aug 2009
        • 7

        #4
        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.

        Comment

        • jmichae3
          New Member
          • Aug 2009
          • 7

          #5
          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):



          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
          Contains operating system version information. The information includes major and minor version numbers, a build number, a platform identifier, and information about product suites and the latest Service Pack installed on the system. (ANSI)


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


          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)

          Comment

          • jmichae3
            New Member
            • Aug 2009
            • 7

            #6
            correction: 0.?.? Win32s
            don't know major and minor version number for win32s.

            Comment

            • jmichae3
              New Member
              • Aug 2009
              • 7

              #7
              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

              Comment

              • jmichae3
                New Member
                • Aug 2009
                • 7

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


                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
                Contains operating system version information. The information includes major and minor version numbers, a build number, a platform identifier, and information about product suites and the latest Service Pack installed on the system. (ANSI)


                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 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.


                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.

                Comment

                • jmichae3
                  New Member
                  • Aug 2009
                  • 7

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

                  Comment

                  Working...