Bug 925599 - Replace other GetVersionEx() uses. r=jimm
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Fri, 22 Nov 2013 12:35:39 +0900
changeset 157349 2e503bef99d77716724619a3b724a7da7cb31367
parent 157348 8b0cd6690de463c082543ad428e20f94385a4a5d
child 157350 6c1ed54cd96c20991bae5eaa20bfa04b2e3de4fc
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersjimm
bugs925599
milestone28.0a1
Bug 925599 - Replace other GetVersionEx() uses. r=jimm
browser/components/shell/src/nsWindowsShellService.cpp
--- a/browser/components/shell/src/nsWindowsShellService.cpp
+++ b/browser/components/shell/src/nsWindowsShellService.cpp
@@ -22,16 +22,17 @@
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsIWindowsRegKey.h"
 #include "nsUnicharUtils.h"
 #include "nsIWinTaskbar.h"
 #include "nsISupportsPrimitives.h"
 #include "nsThreadUtils.h"
 #include "nsXULAppAPI.h"
+#include "mozilla/WindowsVersion.h"
 
 #include "windows.h"
 #include "shellapi.h"
 
 #ifdef _WIN32_WINNT
 #undef _WIN32_WINNT
 #endif
 #define _WIN32_WINNT 0x0600
@@ -48,16 +49,18 @@
 #define REG_SUCCEEDED(val) \
   (val == ERROR_SUCCESS)
 
 #define REG_FAILED(val) \
   (val != ERROR_SUCCESS)
 
 #define NS_TASKBAR_CONTRACTID "@mozilla.org/windows-taskbar;1"
 
+using mozilla::IsWin8OrLater;
+
 NS_IMPL_ISUPPORTS2(nsWindowsShellService, nsIWindowsShellService, nsIShellService)
 
 static nsresult
 OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey)
 {
   const nsString &flatName = PromiseFlatString(aKeyName);
 
   DWORD res = ::RegOpenKeyExW(aKeyRoot, flatName.get(), 0, KEY_READ, aKey);
@@ -310,26 +313,16 @@ nsWindowsShellService::ShortcutMaintenan
     return NS_ERROR_UNEXPECTED;
 
   appHelperPath.AppendLiteral(" /UpdateShortcutAppUserModelIds");
 
   return LaunchHelper(appHelperPath);
 }
 
 static bool
-IsWin8OrLater()
-{
-  OSVERSIONINFOW osInfo;
-  osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
-  GetVersionExW(&osInfo);
-  return osInfo.dwMajorVersion > 6 || 
-         (osInfo.dwMajorVersion >= 6 && osInfo.dwMinorVersion >= 2);
-}
-
-static bool
 IsAARDefaultHTTP(IApplicationAssociationRegistration* pAAR,
                  bool* aIsDefaultBrowser)
 {
   // Make sure the Prog ID matches what we have
   LPWSTR registeredApp;
   HRESULT hr = pAAR->QueryCurrentDefault(L"http", AT_URLPROTOCOL, AL_EFFECTIVE,
                                          &registeredApp);
   if (SUCCEEDED(hr)) {