Bug 942402 - Stop using GetVersionEx in c-c. r=Standard8
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Tue, 25 Feb 2014 08:47:11 -0500
changeset 17611 bcb19733ea2e194000bc53455e6cf68e3fb418ff
parent 17610 4751fb82d57c5c34dda87f67ddf6664534d93b84
child 17612 97557d746d3b378037fa56aae8b48acab676965d
push id1175
push usermbanner@mozilla.com
push dateTue, 18 Mar 2014 08:37:15 +0000
treeherdercomm-aurora@3b5242ee031a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs942402
Bug 942402 - Stop using GetVersionEx in c-c. r=Standard8
mailnews/import/oexpress/nsOESettings.cpp
--- a/mailnews/import/oexpress/nsOESettings.cpp
+++ b/mailnews/import/oexpress/nsOESettings.cpp
@@ -4,27 +4,28 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
 
   Outlook Express (Win32) settings
 
 */
 
+#include "nsOESettings.h"
+#include "mozilla/WindowsVersion.h"
 #include "nsCOMPtr.h"
 #include "nscore.h"
 #include "nsMsgUtils.h"
 #include "nsOEImport.h"
 #include "nsIComponentManager.h"
 #include "nsIServiceManager.h"
 #include "nsOERegUtil.h"
 #include "nsIMsgAccountManager.h"
 #include "nsIMsgAccount.h"
 #include "nsIImportSettings.h"
-#include "nsOESettings.h"
 #include "nsMsgBaseCID.h"
 #include "nsMsgCompCID.h"
 #include "nsMsgI18N.h"
 #include "nsISmtpService.h"
 #include "nsISmtpServer.h"
 #include "nsOEStringBundle.h"
 #include "OEDebugLog.h"
 #include "nsIPop3IncomingServer.h"
@@ -893,32 +894,30 @@ void OESettings::SetSmtpServer(const nsS
                     nativeSmtpServer.get());
       }
     }
   }
 }
 
 bool OESettings::IsKB933612Applied()
 {
-  OSVERSIONINFOEX versionInfo = { 0 };
-  versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
-  GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&versionInfo));
-
-  // Windows XP SP3 and Windows Vista SP1 include KB933612 fix.
+  // The following versions of Windows include KB933612 fix:
+  // - Windows 7 and future versions of Windows
+  // - Windows Vista, SP1 or later
+  // - Windows Server 2003, SP2 or later
+  // - Windows XP, SP3 or later
+  //
+  // The following versions do not:
+  // - Windows Vista SP0
+  // - Windows Server 2003, SP1 or earlier
+  // - Windows XP, SP2 or earlier
+  //
   // See http://support.microsoft.com/kb/929123 and
   // http://support.microsoft.com/kb/933612
-  switch (versionInfo.dwMajorVersion) {
-    case 6:
-      if ((versionInfo.dwMinorVersion == 0 && versionInfo.wServicePackMajor > 0) ||
-          versionInfo.dwMinorVersion == 1) {
-        return true;
-      }
-      break;
-    case 5:
-      if (versionInfo.dwMinorVersion > 0 && versionInfo.wServicePackMajor > 2)
-        return true;
-      break;
-    default:
-      break;
-  }
-  return false;
+  //
+  // Note that mozilla::IsWin2003SP2OrLater() will return true for
+  // Windows Vista and mozilla::IsXPSP3OrLater() will return true
+  // for Windows Server 2003.
+  return mozilla::IsVistaSP1OrLater() ||
+         !mozilla::IsWin2003OrLater() && mozilla::IsXPSP3OrLater() ||
+         !mozilla::IsVistaOrLater() && mozilla::IsWin2003SP2OrLater();
 }