Bug 945192 - Followup to support Older SDKs in loaddlls.cpp. r=bbondy a=Sylvestre
authorRobert Strong <robert.strong.bugs@gmail.com>
Tue, 17 Feb 2015 15:02:51 -0500
changeset 245401 cce919848572
parent 245400 8597521cb8bd
child 245406 948a2c2e31d4
push id660
push userraliiev@mozilla.com
push date2015-02-18 20:30 +0000
treeherdermozilla-release@49e493494178 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy, Sylvestre
bugs945192
milestone36.0
Bug 945192 - Followup to support Older SDKs in loaddlls.cpp. r=bbondy a=Sylvestre
toolkit/mozapps/update/updater/loaddlls.cpp
--- a/toolkit/mozapps/update/updater/loaddlls.cpp
+++ b/toolkit/mozapps/update/updater/loaddlls.cpp
@@ -1,33 +1,41 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <windows.h>
 
+// Support SDK's that don't have LOAD_LIBRARY_SEARCH_SYSTEM32 or
+// SetDefaultDllDirectories.
+#ifndef NTDDI_WIN8
+#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
+#endif
+typedef BOOL (WINAPI *SetDefaultDllDirectoriesFunction) (DWORD DirectoryFlags);
+
 // Delayed load libraries are loaded when the first symbol is used.
 // The following ensures that we load the delayed loaded libraries from the
 // system directory.
 struct AutoLoadSystemDependencies
 {
   AutoLoadSystemDependencies()
   {
     // Remove the current directory from the search path for dynamically loaded
     // DLLs as a precaution.  This call has no effect for delay load DLLs.
     SetDllDirectory(L"");
 
     HMODULE module = ::GetModuleHandleW(L"kernel32.dll");
     if (module) {
       // SetDefaultDllDirectories is always available on Windows 8 and above. It
       // is also available on Windows Vista, Windows Server 2008, and
       // Windows 7 when MS KB2533623 has been applied.
-      decltype(SetDefaultDllDirectories)* setDefaultDllDirectories =
-        (decltype(SetDefaultDllDirectories)*) GetProcAddress(module, "SetDefaultDllDirectories");
+      SetDefaultDllDirectoriesFunction setDefaultDllDirectories =
+          reinterpret_cast<SetDefaultDllDirectoriesFunction>(
+              ::GetProcAddress(module, "SetDefaultDllDirectories"));
       if (setDefaultDllDirectories) {
         setDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32);
         return;
       }
     }
 
     // When SetDefaultDllDirectories is not available, fallback to preloading
     // dlls. The order that these are loaded does not matter since they are