--- 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