From cfeb27cc05ba2992768cd487d66f3fd9ce08386c Mon Sep 17 00:00:00 2001
From: Gilles Khouzam <gillesk@microsoft.com>
Date: Thu, 10 Sep 2015 13:54:00 -0700
Subject: [PATCH] SystemTools: Report Windows 7, 8, 8.1 and 10 by name

Change-Id: I552e0840b5c84187b67a781621c09b485d3e6048
---
 SystemTools.cxx | 53 +++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 47 insertions(+), 6 deletions(-)

diff --git a/SystemTools.cxx b/SystemTools.cxx
index ddf42b6c..3857e415 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -4906,10 +4906,56 @@ std::string SystemTools::GetOperatingSystemNameAndVersion()
     case VER_PLATFORM_WIN32_NT:
 
       // Test for the specific product family.
+      if (osvi.dwMajorVersion == 10 && osvi.dwMinorVersion == 0)
+        {
+        if (osvi.wProductType == VER_NT_WORKSTATION)
+          {
+          res += "Microsoft Windows 10";
+          }
+        else
+          {
+          res += "Microsoft Windows Server 2016 family";
+          }
+        }
+
+      if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 3)
+        {
+        if (osvi.wProductType == VER_NT_WORKSTATION)
+          {
+          res += "Microsoft Windows 8.1";
+          }
+        else
+          {
+          res += "Microsoft Windows Server 2012 R2 family";
+          }
+        }
+
+      if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 2)
+        {
+        if (osvi.wProductType == VER_NT_WORKSTATION)
+          {
+          res += "Microsoft Windows 8";
+          }
+        else
+          {
+          res += "Microsoft Windows Server 2012 family";
+          }
+        }
+
+      if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1)
+        {
+        if (osvi.wProductType == VER_NT_WORKSTATION)
+          {
+          res += "Microsoft Windows 7";
+          }
+        else
+          {
+          res += "Microsoft Windows Server 2008 R2 family";
+          }
+        }
 
       if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0)
         {
-#if (_MSC_VER >= 1300)
         if (osvi.wProductType == VER_NT_WORKSTATION)
           {
           res += "Microsoft Windows Vista";
@@ -4918,9 +4964,6 @@ std::string SystemTools::GetOperatingSystemNameAndVersion()
           {
           res += "Microsoft Windows Server 2008 family";
           }
-#else
-        res += "Microsoft Windows Vista or Windows Server 2008";
-#endif
         }
 
       if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2)
@@ -4949,7 +4992,6 @@ std::string SystemTools::GetOperatingSystemNameAndVersion()
         {
         // Test for the workstation type.
 
-#if (_MSC_VER >= 1300)
         if (osvi.wProductType == VER_NT_WORKSTATION)
           {
           if (osvi.dwMajorVersion == 4)
@@ -5021,7 +5063,6 @@ std::string SystemTools::GetOperatingSystemNameAndVersion()
               }
             }
           }
-#endif // Visual Studio 7 and up
         }
 
       // Test for specific product on Windows NT 4.0 SP5 and earlier
-- 
GitLab