diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-02-19 16:11:56 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-02-19 16:11:56 +0100 |
commit | 01b1e411bdb042dbc99668e3b6689da799c7828a (patch) | |
tree | 2fef3dd21552406dafd886b5f5f1aeccf6445f01 /xpcom | |
parent | ce1bd4f244710fcec718e164c6d9b1621c8ec810 (diff) | |
download | UXP-01b1e411bdb042dbc99668e3b6689da799c7828a.tar UXP-01b1e411bdb042dbc99668e3b6689da799c7828a.tar.gz UXP-01b1e411bdb042dbc99668e3b6689da799c7828a.tar.lz UXP-01b1e411bdb042dbc99668e3b6689da799c7828a.tar.xz UXP-01b1e411bdb042dbc99668e3b6689da799c7828a.zip |
Remove StartupSpecialSystemDirectory() workaround.
The SHGetKnownFolderPath function declaration is exposed since [85edb1c711f7816ed1a30edd07b37d314fac216a] so we no longer need to GetProcAddress("SHGetKnownFolderPath") and we can call it directly.
Also remove a redundant #include <shlobj.h>.
Diffstat (limited to 'xpcom')
-rw-r--r-- | xpcom/build/XPCOMInit.cpp | 2 | ||||
-rw-r--r-- | xpcom/io/SpecialSystemDirectory.cpp | 28 | ||||
-rw-r--r-- | xpcom/io/SpecialSystemDirectory.h | 3 |
3 files changed, 2 insertions, 31 deletions
diff --git a/xpcom/build/XPCOMInit.cpp b/xpcom/build/XPCOMInit.cpp index c72ea48d7..895e295b1 100644 --- a/xpcom/build/XPCOMInit.cpp +++ b/xpcom/build/XPCOMInit.cpp @@ -584,8 +584,6 @@ NS_InitXPCOM2(nsIServiceManager** aResult, NS_StartupLocalFile(); - StartupSpecialSystemDirectory(); - nsDirectoryService::RealInit(); bool value; diff --git a/xpcom/io/SpecialSystemDirectory.cpp b/xpcom/io/SpecialSystemDirectory.cpp index 9ce8eb85b..347ed186a 100644 --- a/xpcom/io/SpecialSystemDirectory.cpp +++ b/xpcom/io/SpecialSystemDirectory.cpp @@ -12,7 +12,6 @@ #if defined(XP_WIN) #include <windows.h> -#include <shlobj.h> #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -51,40 +50,17 @@ using mozilla::IsWin7OrLater; #endif #endif -#ifdef XP_WIN -typedef HRESULT (WINAPI* nsGetKnownFolderPath)(GUID& rfid, - DWORD dwFlags, - HANDLE hToken, - PWSTR* ppszPath); - -static nsGetKnownFolderPath gGetKnownFolderPath = nullptr; -#endif - -void -StartupSpecialSystemDirectory() -{ -#if defined (XP_WIN) - // SHGetKnownFolderPath is only available on Windows Vista - // so that we need to use GetProcAddress to get the pointer. - HMODULE hShell32DLLInst = GetModuleHandleW(L"shell32.dll"); - if (hShell32DLLInst) { - gGetKnownFolderPath = (nsGetKnownFolderPath) - GetProcAddress(hShell32DLLInst, "SHGetKnownFolderPath"); - } -#endif -} - #if defined (XP_WIN) static nsresult GetKnownFolder(GUID* aGuid, nsIFile** aFile) { - if (!aGuid || !gGetKnownFolderPath) { + if (!aGuid) { return NS_ERROR_FAILURE; } PWSTR path = nullptr; - gGetKnownFolderPath(*aGuid, 0, nullptr, &path); + SHGetKnownFolderPath(*aGuid, 0, nullptr, &path); if (!path) { return NS_ERROR_FAILURE; diff --git a/xpcom/io/SpecialSystemDirectory.h b/xpcom/io/SpecialSystemDirectory.h index dd3d88379..7c7f8fa42 100644 --- a/xpcom/io/SpecialSystemDirectory.h +++ b/xpcom/io/SpecialSystemDirectory.h @@ -16,9 +16,6 @@ #include "prenv.h" #endif -extern void StartupSpecialSystemDirectory(); - - enum SystemDirectories { OS_DriveDirectory = 1, OS_TemporaryDirectory = 2, |