public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [csih - Cygwin service installation helper, a helper script and tools to create service installation scripts] branch master, updated. v0_9_11-3-g3bc410a282a6
@ 2023-02-09 14:13 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2023-02-09 14:13 UTC (permalink / raw)
  To: cygwin-apps-cvs




https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/csih.git;h=3bc410a282a68cc2498dd777f9d7309f583842b6

commit 3bc410a282a68cc2498dd777f9d7309f583842b6
Author: Corinna Vinschen <vinschen@redhat.com>
Date:   Thu Feb 9 15:11:12 2023 +0100

    bump version to 0.9.12

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/csih.git;h=5bf9b02ab9b73cbad8fd334b5678bd98bcad3f31

commit 5bf9b02ab9b73cbad8fd334b5678bd98bcad3f31
Author: Corinna Vinschen <vinschen@redhat.com>
Date:   Thu Feb 9 14:42:35 2023 +0100

    cleanup code, improve OS output


Diff:
---
 cygwin/getVolInfo.c          |  22 +-
 native/Win32Error.h          | 172 +++++++-------
 native/lookupAccountName.cpp |   2 +-
 native/winProductName.c      | 546 +++++++++++++++++--------------------------
 version.h                    |   2 +-
 5 files changed, 315 insertions(+), 429 deletions(-)

diff --git a/cygwin/getVolInfo.c b/cygwin/getVolInfo.c
index b47bacd24850..0d273a9e83e8 100644
--- a/cygwin/getVolInfo.c
+++ b/cygwin/getVolInfo.c
@@ -10,10 +10,10 @@
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  * copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -63,7 +63,6 @@ main (int argc, char **argv)
   OBJECT_ATTRIBUTES attr;
   IO_STATUS_BLOCK io;
   NTSTATUS stat;
-  ULONG ret;
 
   if (argc < 2)
     {
@@ -118,11 +117,11 @@ main (int argc, char **argv)
     {
       PFILE_FS_DEVICE_INFORMATION pfi =
 	    (PFILE_FS_DEVICE_INFORMATION) buf;
-      printf ("Device Type        : %lx\n", pfi->DeviceType);
-      printf ("Characteristics    : %lx\n", pfi->Characteristics);
+      printf ("Device Type        : %x\n", pfi->DeviceType);
+      printf ("Characteristics    : %x\n", pfi->Characteristics);
     }
   else
-    fprintf (stderr, "FileFsDeviceInformation failed, %08lx\n", stat);
+    fprintf (stderr, "FileFsDeviceInformation failed, %08x\n", stat);
   stat = NtQueryVolumeInformationFile (h, &io, buf, 1024,
 						FileFsVolumeInformation);
   if (NT_SUCCESS (stat))
@@ -137,22 +136,21 @@ main (int argc, char **argv)
 	}
       else
 	printf ("Volume Name        : <>\n");
-      printf ("Serial Number      : %lu\n", pfi->VolumeSerialNumber);
+      printf ("Serial Number      : %u\n", pfi->VolumeSerialNumber);
     }
   else
-    fprintf (stderr, "FileFsVolumeInformation failed, %08lx\n", stat);
+    fprintf (stderr, "FileFsVolumeInformation failed, %08x\n", stat);
   stat = NtQueryVolumeInformationFile (h, &io, buf, 1024,
 				       FileFsAttributeInformation);
   if (NT_SUCCESS (stat))
     {
       PFILE_FS_ATTRIBUTE_INFORMATION pfi =
 	    (PFILE_FS_ATTRIBUTE_INFORMATION) buf;
-      printf ("Max Filenamelength : %lu\n",pfi->MaximumComponentNameLength);
+      printf ("Max Filenamelength : %u\n",pfi->MaximumComponentNameLength);
       sys_wcstombs (name, 256, pfi->FileSystemName,
 		    pfi->FileSystemNameLength / sizeof (WCHAR));
       printf ("Filesystemname     : <%s>\n", name);
-      printf ("Flags              : %lx\n",
-	      flags = pfi->FileSystemAttributes);
+      printf ("Flags              : %x\n", flags = pfi->FileSystemAttributes);
 
       printf ("  FILE_CASE_SENSITIVE_SEARCH  : %s\n",
 	      (flags & FILE_CASE_SENSITIVE_SEARCH) ? "TRUE" : "FALSE");
@@ -188,7 +186,7 @@ main (int argc, char **argv)
 	      (flags & FILE_SUPPORTS_TRANSACTIONS) ? "TRUE" : "FALSE");
     }
   else
-    fprintf (stderr, "FileFsAttributeInformation failed, %08lx\n", stat);
+    fprintf (stderr, "FileFsAttributeInformation failed, %08x\n", stat);
 
   NtClose (h);
   free (winpath);
diff --git a/native/Win32Error.h b/native/Win32Error.h
index 15f3cd148b6b..e76756a5c876 100644
--- a/native/Win32Error.h
+++ b/native/Win32Error.h
@@ -1,25 +1,25 @@
 //////////////////////////////////////////////////////////////////////
-// Win32Error.h:    
-//      Interface and Implementation for the 
+// Win32Error.h:
+//      Interface and Implementation for the
 //      CWin32Error class.
 //
 //      Written by and copyright (c) 2001 Ajit Jadhav.
 //      All rights reserved by the author.
 //
 // Legal Notice:
-// * The material in this source file can be used for any 
-// purpose, commercial or noncommercial, without paying any 
+// * The material in this source file can be used for any
+// purpose, commercial or noncommercial, without paying any
 // charge.
 // * However, use this material, in full or in part, at your
-// own risk. The author assumes no responsibility--implied 
-// or otherwise--arising from any direct or indirect damages 
-// which may result by using the material presented here. 
+// own risk. The author assumes no responsibility--implied
+// or otherwise--arising from any direct or indirect damages
+// which may result by using the material presented here.
 // * If you decide to use or reuse this material, please make
-// sure to keep the this copyright notice intact in your 
+// sure to keep the this copyright notice intact in your
 // source-files.
-// * However, it is NOT necessary to acknowledge the copyright 
-// outside of your project source files. (For example, it is 
-// NOT necessary to pop up a message box acknowledging this 
+// * However, it is NOT necessary to acknowledge the copyright
+// outside of your project source files. (For example, it is
+// NOT necessary to pop up a message box acknowledging this
 // copyright in your application.)
 //////////////////////////////////////////////////////////////////////
 #ifndef WIN32ERROR_H__
@@ -36,17 +36,17 @@
 //      - Encapsulates the two basic Win32 APIs:
 //          - ::GetLastError()  and
 //          - ::FormatMessage().
-//      - Employs smart copy methods to minimize the overheads of 
+//      - Employs smart copy methods to minimize the overheads of
 //        mem allocation, retrieving system error strings, and copying.
 //      - Has all member-functions inline. Just #include this header.
 //      - Does not depend on MFC. Use freely with any C++ library.
 //      - Compiles under both UNICODE and MBCS.
 //      - Is very convenient and simple to use--in fact, the objects
-//        of this class are *best* created on the stack, and can 
-//        be passed by value without undue performance hit. 
-//      - Provides automatic conversion to const TCHAR* type. Pass 
+//        of this class are *best* created on the stack, and can
+//        be passed by value without undue performance hit.
+//      - Provides automatic conversion to const TCHAR* type. Pass
 //        objects, as they are, to MessageBox() or AfxMessageBox().
-//      - Supports the MFC TRACE macro. Pass objects to TRACE as they 
+//      - Supports the MFC TRACE macro. Pass objects to TRACE as they
 //        are--you don't have to call object.c_str() method or so.
 //        e.g. TRACE( "%s\n", e ); and not TRACE( "%s\n", e.c_str() );
 //      - Helps in taking advantage of the exception-handling features
@@ -54,15 +54,15 @@
 //
 //  Intended usages:
 //  ===============
-//      - As an exception class whose instances can be thrown and 
-//        and caught by value without undue performance hit. 
+//      - As an exception class whose instances can be thrown and
+//        and caught by value without undue performance hit.
 //      - As a convenient encapsulation of strings with error codes.
 //      - As a debugger convenience for error messages.
 //
-//  Example usage, technical notes, and suggestions for improvements 
+//  Example usage, technical notes, and suggestions for improvements
 //        appear towards the end of this file.
 //
-//  Well thought out comments are welcome. 
+//  Well thought out comments are welcome.
 //
 //  Thanks for using, and happy debugging ;)
 //
@@ -72,18 +72,18 @@
 #include <tchar.h>
 #include <windows.h>
 
-class CWin32Error  
+class CWin32Error
 {
 public:
 //----- Construction and destruction -----------------------------------
-    
-    // The default constructor calls ::GetLastError() as well 
-    // as ::FormatMessage(). BUT the copy constructor and the 
-    // overloaded assignment ('=') operator DO NOT. 
+
+    // The default constructor calls ::GetLastError() as well
+    // as ::FormatMessage(). BUT the copy constructor and the
+    // overloaded assignment ('=') operator DO NOT.
     // Thus, object-copies carry the original error code and message.
     // This avoids the possible confusion due to intermittant
     // SetLastError() called by some other Win32 API functions.
-    CWin32Error() 
+    CWin32Error()
         : m_szErrMsg( NULL )
     {
         unsigned int dwLastErr = ::GetLastError();
@@ -96,7 +96,7 @@ public:
     {
         addRef( rRHS );
     }
-    
+
     // Use this form of construction if you yourself
     // call ::GetLastError() just before instantiation.
     // Also useful for returning success status (arg = 0 ).
@@ -117,10 +117,10 @@ public:
         return *this;
     }
 
-    // Automatically frees the internal buffer once 
+    // Automatically frees the internal buffer once
     // the internal reference count drops to zero.
     // TODO: Make dtor virtual, if deriving from this.
-    ~CWin32Error() 
+    ~CWin32Error()
     {
         releaseRef();
     }
@@ -147,7 +147,7 @@ public:
     }
 
     // Internal buffer returned!! Do not modify, delete[] or free.
-    // You can directly pass this object to any function that 
+    // You can directly pass this object to any function that
     // accepts a const char* argument, e.g. to AfxMessageBox().
     // Makes available the Win32 API error string held internally.
     operator const TCHAR* () const
@@ -177,7 +177,7 @@ public:
         // Get the error code of the current thread
         unsigned int dwNewErr = ::GetLastError();
 
-        // A simple check for performance: Reformatting is only 
+        // A simple check for performance: Reformatting is only
         // necessary if the new code value is different.
         if( dwNewErr != metaMem()->m_dwErrCode )
         {
@@ -185,22 +185,22 @@ public:
             doFormatMessage( dwNewErr );
         }
     }
-    
+
 
 //----- Private members ----------------------------------------------
 private:
 
-    // struct for smart copying. Meta info is prepended to 
+    // struct for smart copying. Meta info is prepended to
     // the actual string, something like in BASIC strings (BSTRs).
     struct SMetaMem
     {
-        SMetaMem() 
-            : m_nMsgStrLen(0), m_dwErrCode(0), m_nRefCnt(0) {}
-    
+        SMetaMem()
+            : m_nRefCnt(0), m_dwErrCode(0), m_nMsgStrLen(0) {}
+
         long m_nRefCnt;             // Including this
-        unsigned int m_dwErrCode;   // Win32 error code
+        DWORD m_dwErrCode;	    // Win32 error code
         int m_nMsgStrLen;           // i.e. _tcslen() + 1.
-        
+
         TCHAR* getString() { return (TCHAR*) (this+1); }
     };
 
@@ -209,7 +209,7 @@ private:
         ::InterlockedIncrement( &rOrig.metaMem()->m_nRefCnt );
         m_szErrMsg = rOrig.m_szErrMsg;
     }
-    
+
     void releaseRef()
     {
         if( ! metaMem() )
@@ -221,21 +221,21 @@ private:
             freeBuffer();
         }
     }
-    
+
     void doFormatMessage( unsigned int dwLastErr )
     {
-        m_szErrMsg = NULL;  
-            
+        m_szErrMsg = NULL;
+
         TCHAR* pTemp = NULL;
         int nLen = ::FormatMessage(
-                        FORMAT_MESSAGE_ALLOCATE_BUFFER | 
+                        FORMAT_MESSAGE_ALLOCATE_BUFFER |
                         FORMAT_MESSAGE_IGNORE_INSERTS |
                         FORMAT_MESSAGE_FROM_SYSTEM,
-                        NULL, 
+                        NULL,
                         dwLastErr,
                         MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ),
-                        (LPTSTR)&pTemp, 
-                        1, 
+                        (LPTSTR)&pTemp,
+                        1,
                         NULL );
         allocCopyData( pTemp, nLen, dwLastErr);
         ::LocalFree( pTemp );
@@ -263,7 +263,7 @@ private:
         if( metaMem() )
         {
             delete [] (unsigned char*) metaMem();
-            m_szErrMsg = NULL; 
+            m_szErrMsg = NULL;
         }
     }
 
@@ -272,7 +272,7 @@ private:
         return m_szErrMsg ? (SMetaMem*)m_szErrMsg - 1 : NULL;
     }
     // The error message given by ::FormatMessage()
-    TCHAR* m_szErrMsg;  
+    TCHAR* m_szErrMsg;
 };
 //======================================================================
 // class CWin32Error Interface and Implementation ends here.
@@ -282,28 +282,28 @@ private:
 ////////////////////////////////////////////////////////////////////////
 //
 //  CWin32Error Example Usages:
-//  ========================== 
-// 
+//  ==========================
+//
 //  Example 1: Simplified Exception Handling For Win32 API Errors
 //             This was my main purpose in writing this class.
 //             --------------------------------------------------
 //
 //  void MyFunction( void ) throw CWin32Error // see client below
 //  {
-//      if( ! SomeWin32API() ) 
+//      if( ! SomeWin32API() )
 //      {
-//          // ::GetLastError() and ::FormatMessage() 
+//          // ::GetLastError() and ::FormatMessage()
 //          // automatically get called during construction.
 //
 //          // Catch by value or by ref--the code stays the same.
 //
-//          // Smart copying means you can rethrow the object by 
+//          // Smart copying means you can rethrow the object by
 //          // value as many times as you like!
 //
-//          throw CWin32Error(); 
+//          throw CWin32Error();
 //      }
 //  }
-//  
+//
 //  void ClientToMyFunction( void )
 //  {
 //      try
@@ -314,50 +314,50 @@ private:
 //      {
 //          // Note: Automatic conversion to const TCHAR* type.
 //
-//          ::OutputDebugTrace( e ); 
+//          ::OutputDebugTrace( e );
 //      }
 //  }
-//  
-// 
+//
+//
 //  Example 2: "Vanilla" usage (No Exception Handling)
 //             ---------------------------------------
 //
 //  // This function returns a CWin32Error object. Smart copy
-//  // means you can return objects even during normal 
+//  // means you can return objects even during normal
 //  // (non-exception-related) execution, without having to
 //  // take undue performance hit.
 //
-//  CWin32Error MyFunction( void ) 
+//  CWin32Error MyFunction( void )
 //  {
 //      if( ! SomeWin32API() )
 //      {
-//          // Constructor gets last error and keeps the text 
+//          // Constructor gets last error and keeps the text
 //          // of the error message ready.
 //
-//          CWin32Error e; 
+//          CWin32Error e;
 //
-//          // Don't have to call a member function even in 
+//          // Don't have to call a member function even in
 //          // MFC trace macro [i.e. no e.c_str() or (const char*) e]
 //
 //          TRACE( "%s\n", e );
 //
 //          return e;
 //      }
-//      // In Win32 API, the '0' value corresponds to the 
+//      // In Win32 API, the '0' value corresponds to the
 //      // error string: "Operation completed successfully"
-//      // The error string is automatically taken from the OS 
+//      // The error string is automatically taken from the OS
 //      // in the returned CWin32Error object.
 //
 //      return 0; // ctor taking unsigned int called here
 //  }
 //
 //
-//  Example 3:  Simplest: Neither exception-handling nor returning 
+//  Example 3:  Simplest: Neither exception-handling nor returning
 //              errors. Just a help for getting the message-strings
 //              formatted from the OS.
 //              --------------------------------------------------
 //
-//  void MyFunction( void ) 
+//  void MyFunction( void )
 //  {
 //      if( ! SomeWin32API() )
 //      {
@@ -367,19 +367,19 @@ private:
 //
 //          // ...perhaps for some check on the code like this...
 //
-//          if( dwErr is really bad and 
+//          if( dwErr is really bad and
 //              user should know about it )
 //          {
-//              // This form of CWin32Error ctor does NOT call 
+//              // This form of CWin32Error ctor does NOT call
 //              // ::GetLastError().
 //
-//              CWin32Error e = dwErr; 
-//              
+//              CWin32Error e = dwErr;
+//
 //              // CWin32Error supplies const char* conversion
 //
 //              AfxMessageBox( e );
 //          }
-//          // Else, forget prompting the user. 
+//          // Else, forget prompting the user.
 //          // Just return from the function...
 //
 //          return;
@@ -391,38 +391,38 @@ private:
 //
 // Technical Notes for CWin32Error:
 // ===============================
-// 
+//
 // On-Stack- Vs. On-Heap-Instantiation:
 // -----------------------------------
 // This class was designed so that error objects can be freely created
 // on the stack and returned by value across exception frames/blocks.
 //
 // Creating objects of this class dynamically (i.e on the heap)
-// offers no particular advantage. Usually, people tend to 
-// reuse such heap-allocated objects via pointers. Heap is not harmful 
+// offers no particular advantage. Usually, people tend to
+// reuse such heap-allocated objects via pointers. Heap is not harmful
 // by itself, but there are object reuse issues, as given below.
 //
 // Reusing the same instance (object) at runtime.
 // ---------------------------------------------
-// (i) You have to remember to call CWin32Error::ReGetLastError() 
+// (i) You have to remember to call CWin32Error::ReGetLastError()
 // (ii) You have to provide thread-protection in multi-threaded
-// apps--the single global object may grab error code from place in 
-// another thread. 
+// apps--the single global object may grab error code from place in
+// another thread.
 //
-// Of course, if you do not *reuse* the same instance, then it's 
+// Of course, if you do not *reuse* the same instance, then it's
 // perfectly OK to create CWin32Error objects on the heap.
 //
 // Remember not to delete [] Description() return value
 // ----------------------------------------------------
-// - The only reason I didn't return an MFC CString or an STL string or 
+// - The only reason I didn't return an MFC CString or an STL string or
 // wstring object is because I didn't want to create dependencies on
-// other libraries right in this small utility class. 
-// - On the minus side of this decision is exposing the internal buffer 
-// (even if as a const). 
+// other libraries right in this small utility class.
+// - On the minus side of this decision is exposing the internal buffer
+// (even if as a const).
 // - On the plus side, you can use this class intact in almost any
 // kind of Win32 development--whether in performance-critical sockets
 // apps; or in ATL COM components; or in console app using STL; or
-// in a database project using some third-party ODBC library, or in 
+// in a database project using some third-party ODBC library, or in
 // the AppWizard generated MFC MDI App.
 ////////////////////////////////////////////////////////////////////////
 //
@@ -434,8 +434,8 @@ private:
 //  - Provide support for ::FormatMessage() arguments:
 //      - Formatting messages from strings.
 //      - Inserts and argument arrays.
-//  - Using a custom message (MC-compiled) dll for messages. 
-//      - Use its instance module handle to format messages. 
+//  - Using a custom message (MC-compiled) dll for messages.
+//      - Use its instance module handle to format messages.
 //      - Add/Alter member functions suitably.
 //      Caution:
 //          - Who loads the dll? Manages its in-proc-time?
diff --git a/native/lookupAccountName.cpp b/native/lookupAccountName.cpp
index 8b40a3778048..d3f355ca5f0a 100644
--- a/native/lookupAccountName.cpp
+++ b/native/lookupAccountName.cpp
@@ -100,7 +100,7 @@ BOOL lookupWellKnownAccountName(LPTSTR *accountName, WELL_KNOWN_SID_TYPE desired
   DWORD        cbSid = 0;
   LPTSTR       ReferencedDomainName = NULL;
   DWORD        cbReferencedDomainName = 0;
-  DWORD        dwSize, dwResult = 0;
+  DWORD        dwSize;
   SID_NAME_USE SidType;
 
   BOOL retErr = FALSE;
diff --git a/native/winProductName.c b/native/winProductName.c
index 9417024d16b5..1dcce53ebfc5 100644
--- a/native/winProductName.c
+++ b/native/winProductName.c
@@ -11,10 +11,10 @@
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  * copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -34,256 +34,203 @@
 static const char *VERSION = VERSION_STRING;
 static const char *PROGNAME = "winProductName";
 
-/* mingw.org w32api does not yet define these constants */
-#ifndef PRODUCT_UNLICENSED
-#define PRODUCT_UNLICENSED				0xABCDABCD
-
-#define PRODUCT_UNDEFINED				0x00000000
-#define PRODUCT_ULTIMATE				0x00000001
-#define PRODUCT_HOME_BASIC				0x00000002
-#define PRODUCT_HOME_PREMIUM				0x00000003
-#define PRODUCT_ENTERPRISE				0x00000004
-#define PRODUCT_HOME_BASIC_N				0x00000005
-#define PRODUCT_BUSINESS				0x00000006
-#define PRODUCT_STANDARD_SERVER				0x00000007
-#define PRODUCT_DATACENTER_SERVER			0x00000008
-#define PRODUCT_SMALLBUSINESS_SERVER			0x00000009
-#define PRODUCT_ENTERPRISE_SERVER			0x0000000A
-#define PRODUCT_STARTER					0x0000000B
-#define PRODUCT_DATACENTER_SERVER_CORE			0x0000000C
-#define PRODUCT_STANDARD_SERVER_CORE			0x0000000D
-#define PRODUCT_ENTERPRISE_SERVER_CORE			0x0000000E
-#define PRODUCT_ENTERPRISE_SERVER_IA64			0x0000000F
-#define PRODUCT_BUSINESS_N				0x00000010
-#define PRODUCT_WEB_SERVER				0x00000011
-#define PRODUCT_CLUSTER_SERVER				0x00000012
-#define PRODUCT_HOME_SERVER				0x00000013
-#define PRODUCT_STORAGE_EXPRESS_SERVER			0x00000014
-#define PRODUCT_STORAGE_STANDARD_SERVER			0x00000015
-#define PRODUCT_STORAGE_WORKGROUP_SERVER		0x00000016
-#define PRODUCT_STORAGE_ENTERPRISE_SERVER		0x00000017
-#define PRODUCT_SERVER_FOR_SMALLBUSINESS		0x00000018
-#define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM		0x00000019
-#define PRODUCT_HOME_PREMIUM_N				0x0000001A
-#define PRODUCT_ENTERPRISE_N				0x0000001B
-#define PRODUCT_ULTIMATE_N				0x0000001C
-#define PRODUCT_WEB_SERVER_CORE				0x0000001D
-#define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT	0x0000001E
-#define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY		0x0000001F
-#define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING		0x00000020
-#define PRODUCT_SERVER_FOUNDATION			0x00000021
-#define PRODUCT_HOME_PREMIUM_SERVER			0x00000022
-#define PRODUCT_SERVER_FOR_SMALLBUSINESS_V		0x00000023
-#define PRODUCT_STANDARD_SERVER_V			0x00000024
-#define PRODUCT_DATACENTER_SERVER_V			0x00000025
-#define PRODUCT_ENTERPRISE_SERVER_V			0x00000026
-#define PRODUCT_DATACENTER_SERVER_CORE_V		0x00000027
-#define PRODUCT_STANDARD_SERVER_CORE_V			0x00000028
-#define PRODUCT_ENTERPRISE_SERVER_CORE_V		0x00000029
-#define PRODUCT_HYPERV					0x0000002A
-#define PRODUCT_STORAGE_EXPRESS_SERVER_CORE		0x0000002B
-#define PRODUCT_STORAGE_STANDARD_SERVER_CORE		0x0000002C
-#define PRODUCT_STORAGE_WORKGROUP_SERVER_CORE		0x0000002D
-#define PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE		0x0000002E
-#define PRODUCT_STARTER_N				0x0000002F
-#define PRODUCT_PROFESSIONAL				0x00000030
-#define PRODUCT_PROFESSIONAL_N				0x00000031
-#define PRODUCT_SB_SOLUTION_SERVER			0x00000032
-#define PRODUCT_SERVER_FOR_SB_SOLUTIONS			0x00000033
-#define PRODUCT_STANDARD_SERVER_SOLUTIONS		0x00000034
-#define PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE		0x00000035
-#define PRODUCT_SB_SOLUTION_SERVER_EM			0x00000036
-#define PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM		0x00000037
-#define PRODUCT_SOLUTION_EMBEDDEDSERVER			0x00000038
-#define PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE		0x00000039
-/* #define PRODUCT_????					0x0000003A */
-#define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT		0x0000003B
-#define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL		0x0000003C
-#define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC	0x0000003D
-#define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC	0x0000003E
-#define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE	0x0000003F
-#define PRODUCT_CLUSTER_SERVER_V			0x00000040
-#define PRODUCT_EMBEDDED				0x00000041
-#define PRODUCT_STARTER_E				0x00000042
-#define PRODUCT_HOME_BASIC_E				0x00000043
-#define PRODUCT_HOME_PREMIUM_E				0x00000044
-#define PRODUCT_PROFESSIONAL_E				0x00000045
-#define PRODUCT_ENTERPRISE_E				0x00000046
-#define PRODUCT_ULTIMATE_E				0x00000047
-#endif
-
-/* neither mingw.org w32api nor mingw64 (32bit) w32api define
- * these constants, but mingw64 (64bit) w32api does */
-#ifndef PRODUCT_ENTERPRISE_EVALUATION
-#define PRODUCT_ENTERPRISE_EVALUATION			0x00000048
-/* #define PRODUCT_????					0x00000049 */
-/* #define PRODUCT_????					0x0000004A */
-/* #define PRODUCT_????					0x0000004B */
-#define PRODUCT_MULTIPOINT_STANDARD_SERVER		0x0000004C
-#define PRODUCT_MULTIPOINT_PREMIUM_SERVER		0x0000004D
-/* #define PRODUCT_????					0x0000004E */
-#define PRODUCT_STANDARD_EVALUATION_SERVER		0x0000004F
-#define PRODUCT_DATACENTER_EVALUATION_SERVER		0x00000050
-/* #define PRODUCT_????					0x00000051 */
-/* #define PRODUCT_????					0x00000052 */
-/* #define PRODUCT_????					0x00000053 */
-#define PRODUCT_ENTERPRISE_N_EVALUATION			0x00000054
-/* #define PRODUCT_????					0x00000055 */
-/* #define PRODUCT_????					0x00000056 */
-/* #define PRODUCT_????					0x00000057 */
-/* #define PRODUCT_????					0x00000058 */
-/* #define PRODUCT_????					0x00000059 */
-/* #define PRODUCT_????					0x0000005A */
-/* #define PRODUCT_????					0x0000005B */
-/* #define PRODUCT_????					0x0000005C */
-/* #define PRODUCT_????					0x0000005D */
-/* #define PRODUCT_????					0x0000005E */
-#define PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER	0x0000005F
-#define PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER	0x00000060
-/* #define PRODUCT_????					0x00000061 */
-#define PRODUCT_CORE_N					0x00000062
-#define PRODUCT_CORE_COUNTRYSPECIFIC			0x00000063
-#define PRODUCT_CORE_SINGLELANGUAGE			0x00000064
-#define PRODUCT_CORE					0x00000065
-/* #define PRODUCT_????					0x00000066 */
-#define PRODUCT_PROFESSIONAL_WMC			0x00000067
+#ifndef PRODUCT_IOTENTERPRISES
+#define PRODUCT_IOTENTERPRISES 0x000000bf
 #endif
 
 static LPTSTR products[] = {
-/* 0x00000000 */ "",
-/* 0x00000001 */ " Ultimate Edition",
-/* 0x00000002 */ " Home Basic Edition",
-/* 0x00000003 */ " Home Premium Edition",
-/* 0x00000004 */ " Enterprise Edition",
-/* 0x00000005 */ " Home Basic N",
-/* 0x00000006 */ " Business Edition",
-/* 0x00000007 */ " Standard Edition",
-/* 0x00000008 */ " Datacenter Edition",
-/* 0x00000009 */ " Small Business Server",
-/* 0x0000000a */ " Enterprise Edition",
-/* 0x0000000b */ " Starter Edition",
-/* 0x0000000c */ " Datacenter Edition (core installation)",
-/* 0x0000000d */ " Standard Edition (core installation)",
-/* 0x0000000e */ " Enterprise Edition (core installation)",
-/* 0x0000000f */ " Enterprise Edition for Itanium-based Systems",
-/* 0x00000010 */ " Business N",
-/* 0x00000011 */ " Web Server Edition",
-/* 0x00000012 */ " Cluster Server Edition",
-/* 0x00000013 */ " Home Server",
-/* 0x00000014 */ " Storage Server Express",
-/* 0x00000015 */ " Storage Server Standard",
-/* 0x00000016 */ " Storage Server Workgroup",
-/* 0x00000017 */ " Storage Server Enterprise",
-/* 0x00000018 */ " for Windows Essential Server Solutions",
-/* 0x00000019 */ " Small Business Server Premium Edition",
-/* 0x0000001a */ " Home Premium N",
-/* 0x0000001b */ " Enterprise N",
-/* 0x0000001c */ " Ultimate N",
-/* 0x0000001d */ " Web Server (ore installation)",
-/* 0x0000001e */ " Essential Business Server Management Server",
-/* 0x0000001f */ " Essential Business Server Security Server",
-/* 0x00000020 */ " Essential Business Server Messaging Server",
-/* 0x00000021 */ " Server Foundation",
-/* 0x00000022 */ " Home Server 2011",
-/* 0x00000023 */ " without Hyper-V for Windows Essential Server Solutions",
-/* 0x00000024 */ " Server Standard without Hyper-V",
-/* 0x00000025 */ " Server Datacenter without Hyper-V",
-/* 0x00000026 */ " Server Enterprise without Hyper-V",
-/* 0x00000027 */ " Server Datacenter without Hyper-V (core installation)",
-/* 0x00000028 */ " Server Standard without Hyper-V (core installation)",
-/* 0x00000029 */ " Server Enterprise without Hyper-V (core installation)",
-/* 0x0000002a */ " Hyper-V Server",
-/* 0x0000002b */ " Storage Server Express (core installation)",
-/* 0x0000002c */ " Storage Server Standard (core installation)",
-/* 0x0000002d */ " Storage Server Workgroup (core installation)",
-/* 0x0000002e */ " Storage Server Enterprise (core installation)",
-/* 0x0000002f */ " Starter N",
-/* 0x00000030 */ " Professional",
-/* 0x00000031 */ " Professional N",
-/* 0x00000032 */ " Small Business Server 2011 Essentials",
-/* 0x00000033 */ " Server for Small Business Solutions",
-/* 0x00000034 */ " Standard Server Solutions",
-/* 0x00000035 */ " Standard Server Solutions (core installation)",
-/* 0x00000036 */ " Small Business Server 2011 Essentials Embedded",
-/* 0x00000037 */ " Server for Small Business Solutions Embedded",
-/* 0x00000038 */ " Multipoint Server",
-/* 0x00000039 */ " Multipoint Server (core installation)",
-/* 0x0000003a */ "",
-/* 0x0000003b */ " Essential Business Server Management",
-/* 0x0000003c */ " Essential Business Server Additional",
-/* 0x0000003d */ " Essential Business Server Management Services",
-/* 0x0000003e */ " Essential Business Server Additional Services",
-/* 0x0000003f */ " Small Business Server Premium Edition (core installation)",
-/* 0x00000040 */ " Cluster Server Edition without Hyper-V",
-/* 0x00000041 */ " Embedded",
-/* 0x00000042 */ " Starter E",
-/* 0x00000043 */ " Home Basic E",
-/* 0x00000044 */ " Home Premium E",
-/* 0x00000045 */ " Professional E",
-/* 0x00000046 */ " Enterprise E",
-/* 0x00000047 */ " Ultimate E"
-/* 0x00000048 */ " Server Enterprise (evaluation installation)",
-/* 0x00000049 */ "",
-/* 0x0000004a */ "",
-/* 0x0000004b */ "",
-/* 0x0000004c */ " Multipoint Server Standard (full installation)",
-/* 0x0000004d */ " Multipoint Server Premium (full installation)",
-/* 0x0000004e */ "",
-/* 0x0000004f */ " Server Standard (evaluation installation)",
-/* 0x00000050 */ " Server Datacenter (evaluation installation)",
-/* 0x00000051 */ "",
-/* 0x00000052 */ "",
-/* 0x00000053 */ "",
-/* 0x00000054 */ " Enterprise N (evaluation installation)",
-/* 0x00000055 */ "",
-/* 0x00000056 */ "",
-/* 0x00000057 */ "",
-/* 0x00000058 */ "",
-/* 0x00000059 */ "",
-/* 0x0000005a */ "",
-/* 0x0000005b */ "",
-/* 0x0000005c */ "",
-/* 0x0000005d */ "",
-/* 0x0000005e */ "",
-/* 0x0000005f */ " Storage Server Workgroup (evaluation installation)",
-/* 0x00000060 */ " Storage Server Standard (evaluation installation)",
-/* 0x00000061 */ "",
-/* 0x00000062 */ " N",
-/* 0x00000063 */ " China",
-/* 0x00000064 */ " Single Language",
-/* 0x00000065 */ "", /* just plain "Windows 8" */
-/* 0x00000066 */ "",
-/* 0x00000067 */ " Professional with Media Center",
-/* 0x00000068 */ " Mobile",
-/* 0x00000069 */ "",
-/* 0x0000006a */ "",
-/* 0x0000006b */ "",
-/* 0x0000006c */ "",
-/* 0x0000006d */ "",
-/* 0x0000006e */ "",
-/* 0x0000006f */ "",
-/* 0x00000070 */ "",
-/* 0x00000071 */ "",
-/* 0x00000072 */ "",
-/* 0x00000073 */ "",
-/* 0x00000074 */ "",
-/* 0x00000075 */ "",
-/* 0x00000076 */ "",
-/* 0x00000077 */ "",
-/* 0x00000078 */ "",
-/* 0x00000079 */ " Education",
-/* 0x0000007a */ " Education N",
-/* 0x0000007b */ "",
-/* 0x0000007c */ "",
-/* 0x0000007d */ "",
-/* 0x0000007e */ "",
-/* 0x0000007f */ "",
-/* 0x00000080 */ "",
-/* 0x00000081 */ "",
-/* 0x00000082 */ "",
-/* 0x00000083 */ "",
-/* 0x00000084 */ "",
-/* 0x00000085 */ " Mobile Enterprise",
+ /* 0x00000000 */ "",
+ /* 0x00000001 */ " Ultimate",
+ /* 0x00000002 */ " Home Basic",
+ /* 0x00000003 */ " Home Premium",
+ /* 0x00000004 */ " Enterprise",
+ /* 0x00000005 */ " Home Basic N",
+ /* 0x00000006 */ " Business",
+ /* 0x00000007 */ " Server Standard",
+ /* 0x00000008 */ " Server Datacenter",
+ /* 0x00000009 */ " Small Business Server",
+ /* 0x0000000a */ " Server Enterprise",
+ /* 0x0000000b */ " Starter",
+ /* 0x0000000c */ " Server Datacenter Core",
+ /* 0x0000000d */ " Server Standard Core",
+ /* 0x0000000e */ " Server Enterprise Core",
+ /* 0x0000000f */ " Server Enterprise for Itanium-based Systems",
+ /* 0x00000010 */ " Business N",
+ /* 0x00000011 */ " Web Server",
+ /* 0x00000012 */ " HPC Edition",
+ /* 0x00000013 */ " Home Server",
+ /* 0x00000014 */ " Storage Server Express",
+ /* 0x00000015 */ " Storage Server Standard",
+ /* 0x00000016 */ " Storage Server Workgroup",
+ /* 0x00000017 */ " Storage Server Enterprise",
+ /* 0x00000018 */ " for Windows Essential Server Solutions",
+ /* 0x00000019 */ " Small Business Server Premium",
+ /* 0x0000001a */ " Home Premium N",
+ /* 0x0000001b */ " Enterprise N",
+ /* 0x0000001c */ " Ultimate N",
+ /* 0x0000001d */ " Web Server Core",
+ /* 0x0000001e */ " Essential Business Server Management Server",
+ /* 0x0000001f */ " Essential Business Server Security Server",
+ /* 0x00000020 */ " Essential Business Server Messaging Server",
+ /* 0x00000021 */ " Server Foundation",
+ /* 0x00000022 */ " Home Server 2011",
+ /* 0x00000023 */ " without Hyper-V for Windows Essential Server Solutions",
+ /* 0x00000024 */ " Server Standard without Hyper-V",
+ /* 0x00000025 */ " Server Datacenter without Hyper-V",
+ /* 0x00000026 */ " Server Enterprise without Hyper-V",
+ /* 0x00000027 */ " Server Datacenter Core without Hyper-V",
+ /* 0x00000028 */ " Server Standard Core without Hyper-V",
+ /* 0x00000029 */ " Server Enterprise Core without Hyper-V",
+ /* 0x0000002a */ " Hyper-V Server",
+ /* 0x0000002b */ " Storage Server Express Core",
+ /* 0x0000002c */ " Storage Server Standard Core",
+ /* 0x0000002d */ " Storage Server Workgroup Core",
+ /* 0x0000002e */ " Storage Server Enterprise Core",
+ /* 0x0000002f */ " Starter N",
+ /* 0x00000030 */ " Professional",
+ /* 0x00000031 */ " Professional N",
+ /* 0x00000032 */ " Small Business Server 2011 Essentials",
+ /* 0x00000033 */ " Server For SB Solutions",
+ /* 0x00000034 */ " Server Solutions Premium",
+ /* 0x00000035 */ " Server Solutions Premium Core",
+ /* 0x00000036 */ " Server For SB Solutions EM", /* per MSDN, 2012-09-01 */
+ /* 0x00000037 */ " Server For SB Solutions EM", /* per MSDN, 2012-09-01 */
+ /* 0x00000038 */ " Multipoint Server",
+ /* 0x00000039 */ "",
+ /* 0x0000003a */ "",
+ /* 0x0000003b */ " Essential Server Solution Management",
+ /* 0x0000003c */ " Essential Server Solution Additional",
+ /* 0x0000003d */ " Essential Server Solution Management SVC",
+ /* 0x0000003e */ " Essential Server Solution Additional SVC",
+ /* 0x0000003f */ " Small Business Server Premium Core",
+ /* 0x00000040 */ " Server Hyper Core V",
+ /* 0x00000041 */ "",
+ /* 0x00000042 */ " Starter E",
+ /* 0x00000043 */ " Home Basic E",
+ /* 0x00000044 */ " Home Premium E",
+ /* 0x00000045 */ " Professional E",
+ /* 0x00000046 */ " Enterprise E",
+ /* 0x00000047 */ " Ultimate E",
+ /* 0x00000048 */ " Server Enterprise (Evaluation inst.)",
+ /* 0x00000049 */ "",
+ /* 0x0000004a */ "",
+ /* 0x0000004b */ "",
+ /* 0x0000004c */ " MultiPoint Server Standard",
+ /* 0x0000004d */ " MultiPoint Server Premium",
+ /* 0x0000004e */ "",
+ /* 0x0000004f */ " Server Standard (Evaluation inst.)",
+ /* 0x00000050 */ " Server Datacenter (Evaluation inst.)",
+ /* 0x00000051 */ "",
+ /* 0x00000052 */ "",
+ /* 0x00000053 */ "",
+ /* 0x00000054 */ " Enterprise N (Evaluation inst.)",
+ /* 0x00000055 */ "",
+ /* 0x00000056 */ "",
+ /* 0x00000057 */ "",
+ /* 0x00000058 */ "",
+ /* 0x00000059 */ "",
+ /* 0x0000005a */ "",
+ /* 0x0000005b */ "",
+ /* 0x0000005c */ "",
+ /* 0x0000005d */ "",
+ /* 0x0000005e */ "",
+ /* 0x0000005f */ " Storage Server Workgroup (Evaluation inst.)",
+ /* 0x00000060 */ " Storage Server Standard (Evaluation inst.)",
+ /* 0x00000061 */ "",
+ /* 0x00000062 */ " N",
+ /* 0x00000063 */ " China",
+ /* 0x00000064 */ " Single Language",
+ /* 0x00000065 */ " Home",
+ /* 0x00000066 */ "",
+ /* 0x00000067 */ " Professional with Media Center",
+ /* 0x00000068 */ " Mobile",
+ /* 0x00000069 */ "",
+ /* 0x0000006a */ "",
+ /* 0x0000006b */ "",
+ /* 0x0000006c */ "",
+ /* 0x0000006d */ "",
+ /* 0x0000006e */ "",
+ /* 0x0000006f */ "",
+ /* 0x00000070 */ "",
+ /* 0x00000071 */ "",
+ /* 0x00000072 */ "",
+ /* 0x00000073 */ "",
+ /* 0x00000074 */ "",
+ /* 0x00000075 */ "",
+ /* 0x00000076 */ "",
+ /* 0x00000077 */ " Team",
+ /* 0x00000078 */ "",
+ /* 0x00000079 */ " Education",
+ /* 0x0000007a */ " Education N",
+ /* 0x0000007b */ "",
+ /* 0x0000007c */ "",
+ /* 0x0000007d */ " Enterprise 2015 LTSB",
+ /* 0x0000007e */ " Enterprise 2015 LTSB N",
+ /* 0x0000007f */ "",
+ /* 0x00000080 */ "",
+ /* 0x00000081 */ " Enterprise 2015 LTSB Evaluation",
+ /* 0x00000082 */ " Enterprise 2015 LTSB N Evaluation",
+ /* 0x00000083 */ " IoT Core Commercial",
+ /* 0x00000084 */ "",
+ /* 0x00000085 */ " Mobile Enterprise",
+ /* 0x00000086 */ "",
+ /* 0x00000087 */ "",
+ /* 0x00000088 */ "",
+ /* 0x00000089 */ "",
+ /* 0x0000008a */ "",
+ /* 0x0000008b */ "",
+ /* 0x0000008c */ "",
+ /* 0x0000008d */ "",
+ /* 0x0000008e */ "",
+ /* 0x0000008f */ "",
+ /* 0x00000090 */ "",
+ /* 0x00000091 */ " Server Datacenter, Semi-Annual Channel (core installation)",
+ /* 0x00000092 */ " Server Standard, Semi-Annual Channel (core installation)",
+ /* 0x00000093 */ "",
+ /* 0x00000094 */ "",
+ /* 0x00000095 */ "",
+ /* 0x00000096 */ "",
+ /* 0x00000097 */ "",
+ /* 0x00000098 */ "",
+ /* 0x00000099 */ "",
+ /* 0x0000009a */ "",
+ /* 0x0000009b */ "",
+ /* 0x0000009c */ "",
+ /* 0x0000009d */ "",
+ /* 0x0000009e */ "",
+ /* 0x0000009f */ "",
+ /* 0x000000a0 */ "",
+ /* 0x000000a1 */ " Pro for Workstations",
+ /* 0x000000a2 */ " Pro for Workstations N",
+ /* 0x000000a3 */ "",
+ /* 0x000000a4 */ " Pro Education",
+ /* 0x000000a5 */ "",
+ /* 0x000000a6 */ "",
+ /* 0x000000a7 */ "",
+ /* 0x000000a8 */ "",
+ /* 0x000000a9 */ "",
+ /* 0x000000aa */ "",
+ /* 0x000000ab */ "",
+ /* 0x000000ac */ "",
+ /* 0x000000ad */ "",
+ /* 0x000000ae */ "",
+ /* 0x000000af */ " Enterprise for Virtual Desktops",
+ /* 0x000000b0 */ "",
+ /* 0x000000b1 */ "",
+ /* 0x000000b2 */ "",
+ /* 0x000000b3 */ "",
+ /* 0x000000b4 */ "",
+ /* 0x000000b5 */ "",
+ /* 0x000000b6 */ "",
+ /* 0x000000b7 */ "",
+ /* 0x000000b8 */ "",
+ /* 0x000000b9 */ "",
+ /* 0x000000ba */ "",
+ /* 0x000000bb */ "",
+ /* 0x000000bc */ " IoT Enterprise",
+ /* 0x000000bd */ "",
+ /* 0x000000be */ "",
+ /* 0x000000bf */ " IoT Enterprise LTSC",
 };
 
 #define BUFSIZE 256
@@ -298,7 +245,6 @@ void version (FILE *os, char *progname, int exitCode);
 typedef BOOL (WINAPI *PGPI) (DWORD, DWORD, DWORD, DWORD, PDWORD);
 
 extern NTSTATUS NTAPI RtlGetVersion (PRTL_OSVERSIONINFOEXW);
-extern NTSTATUS NTAPI RtlGetProductInfo (ULONG, ULONG, ULONG, ULONG, PULONG);
 
 BOOL
 GetOSDisplayString (LPTSTR pszOS)
@@ -323,78 +269,10 @@ GetOSDisplayString (LPTSTR pszOS)
 
   strlcpy (pszOS, "Microsoft Windows ", BUFSIZE);
 
-  if (osvi.dwMajorVersion == 5)
+  if (osvi.dwMajorVersion <= 5)
     {
-      switch (osvi.dwMinorVersion)
-	{
-	case 1:
-	  strlcat (pszOS, "XP", BUFSIZE);
-	  if (GetSystemMetrics (SM_MEDIACENTER))
-	    strlcat (pszOS, " Media Center Edition", BUFSIZE);
-	  else if (GetSystemMetrics (SM_TABLETPC))
-	    strlcat (pszOS, " Tablet PC Edition", BUFSIZE);
-	  else if (GetSystemMetrics (SM_STARTER))
-	    strlcat (pszOS, " Starter Edition", BUFSIZE);
-	  else if (osvi.wSuiteMask & VER_SUITE_PERSONAL)
-	    strlcat (pszOS, " Home Edition", BUFSIZE);
-	  else
-	    strlcat (pszOS, " Professional", BUFSIZE);
-	  break;
-	case 2:
-	  if (GetSystemMetrics (SM_SERVERR2))
-	    strlcat (pszOS, "Server 2003 R2, ", BUFSIZE);
-	  else if (osvi.wSuiteMask == VER_SUITE_STORAGE_SERVER)
-	    strlcat (pszOS, "Storage Server 2003, ", BUFSIZE);
-	  else if (osvi.wProductType == VER_NT_WORKSTATION &&
-		   si.wProcessorArchitecture ==
-		   PROCESSOR_ARCHITECTURE_AMD64)
-	    strlcat (pszOS, "XP Professional x64 Edition", BUFSIZE);
-	  else
-	    strlcat (pszOS, "Server 2003, ", BUFSIZE);
-
-	  // Test for the server type.
-	  if (osvi.wProductType != VER_NT_WORKSTATION)
-	    {
-	      if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
-		{
-		  if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
-		    strlcat (pszOS,
-			     "Datacenter Edition for Itanium-based Systems",
-			     BUFSIZE);
-		  else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
-		    strlcat (pszOS,
-			     "Enterprise Edition for Itanium-based Systems",
-			     BUFSIZE);
-		}
-	      else if (si.wProcessorArchitecture ==
-		       PROCESSOR_ARCHITECTURE_AMD64)
-		{
-		  if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
-		    strlcat (pszOS, "Datacenter x64 Edition", BUFSIZE);
-		  else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
-		    strlcat (pszOS, "Enterprise x64 Edition", BUFSIZE);
-		  else
-		    strlcat (pszOS, "Standard x64 Edition", BUFSIZE);
-		}
-	      else
-		{
-		  if (osvi.wSuiteMask & VER_SUITE_COMPUTE_SERVER)
-		    strlcat (pszOS, "Compute Cluster Edition", BUFSIZE);
-		  else if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
-		    strlcat (pszOS, "Datacenter Edition", BUFSIZE);
-		  else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
-		    strlcat (pszOS, "Enterprise Edition", BUFSIZE);
-		  else if (osvi.wSuiteMask & VER_SUITE_BLADE)
-		    strlcat (pszOS, "Web Edition", BUFSIZE);
-		  else
-		    strlcat (pszOS, "Standard Edition", BUFSIZE);
-		}
-	    }
-	  break;
-	default:
-	  printf ("This sample does not support this version of Windows.\n");
-	  return FALSE;
-	}
+      printf ("This sample does not support this version of Windows.\n");
+      return FALSE;
     }
   else
     {
@@ -422,28 +300,38 @@ GetOSDisplayString (LPTSTR pszOS)
 	    break;
 	  case 4:
 	    strlcat (pszOS, osvi.wProductType == VER_NT_WORKSTATION
-		     ? "10" : "Server 2016", BUFSIZE);
+		     ? "10 Preview" : "Server 2016 Preview", BUFSIZE);
 	    break;
 	  }
       else if (osvi.dwMajorVersion == 10)
-	strlcat (pszOS, osvi.wProductType == VER_NT_WORKSTATION
-		 ? "10" : "Server 2016", BUFSIZE);
-
+	{
+	  if (osvi.wProductType == VER_NT_WORKSTATION)
+	    strlcat (pszOS, osvi.dwBuildNumber >= 22000 ? "11" : "10", BUFSIZE);
+	  else
+	    {
+	      if (osvi.dwBuildNumber <= 14393)
+		strlcat (pszOS, "Server 2016", BUFSIZE);
+	      else if (osvi.dwBuildNumber <= 17763)
+		strlcat (pszOS, "Server 2019", BUFSIZE);
+	      else if (osvi.dwBuildNumber <= 20348)
+		strlcat (pszOS, "Server 2022", BUFSIZE);
+	      else
+		strlcat (pszOS, "Server 20??", BUFSIZE);
+	    }
+	}
       pGPI (osvi.dwMajorVersion,
 	    osvi.dwMinorVersion,
 	    osvi.wServicePackMajor, osvi.wServicePackMinor, &dwType);
 
       if (dwType == PRODUCT_UNLICENSED)
 	strlcat (pszOS, " Unlicensed", BUFSIZE);
-      else if (dwType > PRODUCT_PROFESSIONAL_WMC)
+      else if (dwType > PRODUCT_IOTENTERPRISES)
 	strlcat (pszOS, " <unknown>", BUFSIZE);
       else
 	strlcat (pszOS, products[dwType], BUFSIZE);
 
       if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
 	strlcat (pszOS, ", 64-bit", BUFSIZE);
-      else if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
-	strlcat (pszOS, ", 32-bit", BUFSIZE);
     }
 
   // Include service pack (if any) and build number.
@@ -457,7 +345,7 @@ GetOSDisplayString (LPTSTR pszOS)
       strlcat (pszOS, buf, BUFSIZE);
     }
 
-  snprintf (buf, 80, " (build %d)", osvi.dwBuildNumber);
+  snprintf (buf, 80, " (build %ld)", osvi.dwBuildNumber);
   strlcat (pszOS, buf, BUFSIZE);
 
   return TRUE;
diff --git a/version.h b/version.h
index a08d314be8c1..f47765ab1c59 100644
--- a/version.h
+++ b/version.h
@@ -2,5 +2,5 @@
 #define STRINGIFY1(s) #s
 #define VERSION_MAJOR  0
 #define VERSION_MINOR  9
-#define VERSION_MICRO  11
+#define VERSION_MICRO  12
 #define VERSION_STRING STRINGIFY(VERSION_MAJOR) "." STRINGIFY(VERSION_MINOR) "." STRINGIFY(VERSION_MICRO)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-09 14:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-09 14:13 [csih - Cygwin service installation helper, a helper script and tools to create service installation scripts] branch master, updated. v0_9_11-3-g3bc410a282a6 Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).