[SHELL32] Implement support for IID_IDropTarget in CDesktopFolder::GetUIObjectOf...
authorGiannis Adamopoulos <gadamopoulos@reactos.org>
Wed, 1 Feb 2017 13:31:55 +0000 (13:31 +0000)
committerGiannis Adamopoulos <gadamopoulos@reactos.org>
Wed, 1 Feb 2017 13:31:55 +0000 (13:31 +0000)
svn path=/trunk/; revision=73660

reactos/dll/win32/shell32/folders/CDesktopFolder.cpp
reactos/dll/win32/shell32/folders/CDrivesFolder.cpp

index 07678ef..8d7b4eb 100644 (file)
@@ -686,6 +686,15 @@ HRESULT WINAPI CDesktopFolder::GetUIObjectOf(
     {
         hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
     }
+    else if (IsEqualIID (riid, IID_IDropTarget) && (cidl == 1))
+    {
+        CComPtr<IShellFolder> psfChild;
+        hr = this->BindToObject(apidl[0], NULL, IID_PPV_ARG(IShellFolder, &psfChild));
+        if (FAILED_UNEXPECTEDLY(hr))
+            return hr;
+
+        return psfChild->CreateViewObject(NULL, riid, ppvOut);
+    }
     else
         hr = E_NOINTERFACE;
 
index cfbaa90..00c8107 100644 (file)
@@ -631,11 +631,14 @@ HRESULT WINAPI CDrivesFolder::GetUIObjectOf(HWND hwndOwner,
         else
             hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
     }
-    else if (IsEqualIID (riid, IID_IDropTarget) && (cidl >= 1))
+    else if (IsEqualIID (riid, IID_IDropTarget) && (cidl == 1))
     {
-        IDropTarget * pDt = NULL;
-        hr = this->QueryInterface(IID_PPV_ARG(IDropTarget, &pDt));
-        pObj = pDt;
+        CComPtr<IShellFolder> psfChild;
+        hr = this->BindToObject(apidl[0], NULL, IID_PPV_ARG(IShellFolder, &psfChild));
+        if (FAILED_UNEXPECTEDLY(hr))
+            return hr;
+
+        return psfChild->CreateViewObject(NULL, riid, ppvOut);
     }
     else
         hr = E_NOINTERFACE;