Bug 1323695 - Conflict SHLoadLibraryFromKnownFolder when bumping up to WINVER=0x0601. r?froydnj draft
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Fri, 16 Dec 2016 10:52:23 +0900
changeset 450115 7a80317a937367bdba425dfbdb340dda9851d28f
parent 449987 6dbc6e9f62a705d5f523cc750811bd01c8275ec6
child 539670 3ee3ec137ac240cb0030a7fd3fbbd9dec46cbfb1
push id38762
push userm_kato@ga2.so-net.ne.jp
push dateFri, 16 Dec 2016 02:03:46 +0000
reviewersfroydnj
bugs1323695, 14393, 32834
milestone53.0a1
Bug 1323695 - Conflict SHLoadLibraryFromKnownFolder when bumping up to WINVER=0x0601. r?froydnj When setting WINVER=0x601, we cannot compile SpecialSystemDirectory.cpp due to the following. 0:13.17 c:/Development/hg.mozilla.org/mozilla-inbound/xpcom/io/SpecialSystemDirectory.cpp(123): error C2084: function 'HRESULT SHLoadLibraryFromKnownFolder(const KNOWNFOLDERID &,DWORD,const IID &,void **)' already has a body 0:13.17 C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\shobjidl.h(32834): note: see previous definition of 'SHLoadLibraryFromKnownFolder' 0:13.17 c:/Development/hg.mozilla.org/mozilla-inbound/xpcom/io/SpecialSystemDirectory.cpp(158): error C2440: 'initializing': cannot convert from 'HRESULT (__cdecl *)(const KNOWNFOLDERID &,DWORD,const IID &,void **)' to 'HRESULT' 0:13.17 c:/Development/hg.mozilla.org/mozilla-inbound/xpcom/io/SpecialSystemDirectory.cpp(158): note: There is no context in which this conversion is possible MozReview-Commit-ID: 2KZEzcn21S7
xpcom/io/SpecialSystemDirectory.cpp
--- a/xpcom/io/SpecialSystemDirectory.cpp
+++ b/xpcom/io/SpecialSystemDirectory.cpp
@@ -111,16 +111,17 @@ GetWindowsFolder(int aFolder, nsIFile** 
   if (len > 1 && path[len - 1] != L'\\') {
     path[len]   = L'\\';
     path[++len] = L'\0';
   }
 
   return NS_NewLocalFile(nsDependentString(path, len), true, aFile);
 }
 
+#if WINVER < 0x0601
 __inline HRESULT
 SHLoadLibraryFromKnownFolder(REFKNOWNFOLDERID aFolderId, DWORD aMode,
                              REFIID riid, void** ppv)
 {
   *ppv = nullptr;
   IShellLibrary* plib;
   HRESULT hr = CoCreateInstance(CLSID_ShellLibrary, nullptr,
                                 CLSCTX_INPROC_SERVER,
@@ -129,16 +130,17 @@ SHLoadLibraryFromKnownFolder(REFKNOWNFOL
     hr = plib->LoadLibraryFromKnownFolder(aFolderId, aMode);
     if (SUCCEEDED(hr)) {
       hr = plib->QueryInterface(riid, ppv);
     }
     plib->Release();
   }
   return hr;
 }
+#endif
 
 /*
  * 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.
  */
 static nsresult
 GetLibrarySaveToPath(int aFallbackFolderId, REFKNOWNFOLDERID aFolderId,