- Fix copying of files / directories in explorer view
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Thu, 17 Sep 2009 13:44:34 +0000 (13:44 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Thu, 17 Sep 2009 13:44:34 +0000 (13:44 +0000)
- Part 1/2

svn path=/trunk/; revision=43060

reactos/dll/win32/shell32/shv_def_cmenu.c

index 6cd921f..109918a 100644 (file)
@@ -1072,9 +1072,22 @@ DoPaste(
     }
     else
     {
-        /* target folder is desktop because cidl is zero */
-        psfTarget = psfDesktop;
-        hr = S_OK;
+        IPersistFolder2 *ppf2 = NULL;
+        LPITEMIDLIST pidl;
+
+        /* cidl is zero due to explorer view */
+        hr = IShellFolder_QueryInterface (This->dcm.psf, &IID_IPersistFolder2, (LPVOID *) &ppf2);
+        if (SUCCEEDED(hr))
+        {
+            hr = IPersistFolder2_GetCurFolder (ppf2, &pidl);
+            IPersistFolder2_Release(ppf2);
+            if (SUCCEEDED(hr))
+            {
+                hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (LPVOID*)&psfTarget);
+                ILFree(pidl);
+                TRACE("psfTarget %p\n", psfTarget);
+            }
+        }
     }
 
     if (FAILED(hr))
@@ -1133,6 +1146,7 @@ DoPaste(
     _ILFreeaPidl(apidl, lpcida->cidl);
     ReleaseStgMedium(&medium);
     IDataObject_Release(pda);
+ERR("CP result %x\n",hr);
     return S_OK;
 }