From 926c3cfb05a341e4862c6d0b04b94ff95bd52d79 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Wed, 1 Feb 2017 13:31:55 +0000 Subject: [PATCH] [SHELL32] Implement support for IID_IDropTarget in CDesktopFolder::GetUIObjectOf and CDrivesFolder::GetUIObjectOf. Fixes dragging items to the icons of My documents, Recycle bin or drive. svn path=/trunk/; revision=73660 --- reactos/dll/win32/shell32/folders/CDesktopFolder.cpp | 9 +++++++++ reactos/dll/win32/shell32/folders/CDrivesFolder.cpp | 11 +++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp b/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp index 07678efb05c..8d7b4ebc496 100644 --- a/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp +++ b/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp @@ -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 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; diff --git a/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp b/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp index cfbaa90a6d5..00c8107854f 100644 --- a/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp +++ b/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp @@ -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 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; -- 2.17.1