diff options
Diffstat (limited to 'xpcom/io/SpecialSystemDirectory.cpp')
-rw-r--r-- | xpcom/io/SpecialSystemDirectory.cpp | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/xpcom/io/SpecialSystemDirectory.cpp b/xpcom/io/SpecialSystemDirectory.cpp index 9ce8eb85b..ab65d38f9 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> @@ -20,9 +19,6 @@ #include <shlobj.h> #include <knownfolders.h> #include <guiddef.h> -#include "mozilla/WindowsVersion.h" - -using mozilla::IsWin7OrLater; #elif defined(XP_UNIX) @@ -51,40 +47,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; @@ -139,19 +112,13 @@ SHLoadLibraryFromKnownFolder(REFKNOWNFOLDERID aFolderId, DWORD aMode, } /* - * Check to see if we're on Win7 and up, and if so, returns the default - * save-to location for the Windows Library passed in through aFolderId. - * Otherwise falls back on pre-win7 GetWindowsFolder. + * Return the default save-to location for the Windows Library passed in + * through aFolderId. */ static nsresult GetLibrarySaveToPath(int aFallbackFolderId, REFKNOWNFOLDERID aFolderId, nsIFile** aFile) { - // Skip off checking for library support if the os is Vista or lower. - if (!IsWin7OrLater()) { - return GetWindowsFolder(aFallbackFolderId, aFile); - } - RefPtr<IShellLibrary> shellLib; RefPtr<IShellItem> savePath; HRESULT hr = @@ -740,8 +707,6 @@ GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory, } #if defined(MOZ_CONTENT_SANDBOX) case Win_LocalAppdataLow: { - // This should only really fail on versions pre-Vista, in which case this - // shouldn't have been used in the first place. GUID localAppDataLowGuid = FOLDERID_LocalAppDataLow; return GetKnownFolder(&localAppDataLowGuid, aFile); } |