Rebase against 9bc7d41080f5e6805154b9d52a765f2be5d37279.

This commit is contained in:
Zebediah Figura
2021-05-27 00:38:35 -05:00
parent 34afd80e2e
commit d97f6a5faa
7 changed files with 127 additions and 296 deletions

View File

@@ -1,30 +0,0 @@
From 0442ed8d597eb250b7ebc41261073f71d9368f98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 2 Apr 2016 00:22:30 +0200
Subject: [PATCH] shell32: Fix copying of files when using a context menu.
---
dlls/shell32/shlview_cmenu.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c
index 67f5ac80d84..634e3b07176 100644
--- a/dlls/shell32/shlview_cmenu.c
+++ b/dlls/shell32/shlview_cmenu.c
@@ -1164,6 +1164,13 @@ static BOOL DoPaste(ContextMenu *This)
apidl = _ILCopyCidaToaPidl(&pidl, lpcida);
+ /*
+ * In case source is a file we need to remove the last component
+ * to obtain a IShellFolder of the parent.
+ */
+ if (_ILIsValue(pidl))
+ ILRemoveLastID(pidl);
+
for (i = 0; bSuccess && i < lpcida->cidl; i++) {
ITEMIDLIST *apidl_dir = NULL;
ITEMIDLIST *apidl_item;
--
2.30.2

View File

@@ -1,15 +1,15 @@
From bc86221443f957b105efda2276e92204a1f0308e Mon Sep 17 00:00:00 2001
From 6743f6300dfd2903fc1739949826bd7b742348ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 2 Apr 2016 04:22:07 +0200
Subject: [PATCH] shell32: Remove source files when using cut in the context
menu.
---
dlls/shell32/shlview_cmenu.c | 75 ++++++++++++++++++++++++++++++++++--
1 file changed, 71 insertions(+), 4 deletions(-)
dlls/shell32/shlview_cmenu.c | 73 +++++++++++++++++++++++++++++++++---
1 file changed, 67 insertions(+), 6 deletions(-)
diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c
index d15a144870d..3dce4a1fbac 100644
index abee4c93a35..6a16aab2f25 100644
--- a/dlls/shell32/shlview_cmenu.c
+++ b/dlls/shell32/shlview_cmenu.c
@@ -333,6 +333,64 @@ static void DoDelete(ContextMenu *This)
@@ -85,31 +85,49 @@ index d15a144870d..3dce4a1fbac 100644
OleSetClipboard(dataobject);
IDataObject_Release(dataobject);
}
@@ -1233,12 +1292,20 @@ static BOOL DoPaste(ContextMenu *This)
/* do the copy/move */
if (psfhlpdst && psfhlpsrc)
{
+ DWORD dropEffect;
+ GetDropEffect(pda, &dropEffect);
@@ -1170,7 +1229,7 @@ static void DoNewFolder(ContextMenu *This, IShellView *view)
}
}
-static HRESULT paste_pidls(ContextMenu *This, ITEMIDLIST **pidls, UINT count)
+static HRESULT paste_pidls(ContextMenu *This, IDataObject *pda, ITEMIDLIST **pidls, UINT count)
{
IShellFolder *psfDesktop;
UINT i;
@@ -1202,10 +1261,12 @@ static HRESULT paste_pidls(ContextMenu *This, ITEMIDLIST **pidls, UINT count)
/* do the copy/move */
if (psfhlpdst && psfhlpsrc)
{
+ DWORD dropEffect;
+ GetDropEffect(pda, &dropEffect);
+
HRESULT hr = ISFHelper_CopyItems(psfhlpdst, psfFrom, 1, (LPCITEMIDLIST*)&apidl_item);
- if (FAILED(hr))
+ if (SUCCEEDED(hr))
+ {
+ if (dropEffect == DROPEFFECT_MOVE)
+ {
+ if (FAILED(ISFHelper_DeleteItems(psfhlpsrc, lpcida->cidl, (LPCITEMIDLIST*)apidl, FALSE)))
+ bSuccess = FALSE;
+ }
+ }
+ else
bSuccess = FALSE;
- /* FIXME handle move
- ISFHelper_DeleteItems(psfhlpsrc, 1, &apidl_item);
- */
hr = ISFHelper_CopyItems(psfhlpdst, psfFrom, 1, (LPCITEMIDLIST*)&pidl_item);
- /* FIXME handle move
- ISFHelper_DeleteItems(psfhlpsrc, 1, &pidl_item);
- */
+ if (SUCCEEDED(hr) && dropEffect == DROPEFFECT_MOVE)
+ hr = ISFHelper_DeleteItems(psfhlpsrc, 1, (LPCITEMIDLIST*)&pidl_item, FALSE);
}
if(psfhlpdst) ISFHelper_Release(psfhlpdst);
if(psfhlpsrc) ISFHelper_Release(psfhlpsrc);
@@ -1251,7 +1312,7 @@ static HRESULT DoPaste(ContextMenu *This)
apidl = _ILCopyCidaToaPidl(&pidl, lpcida);
if (apidl)
{
- hr = paste_pidls(This, apidl, lpcida->cidl);
+ hr = paste_pidls(This, pda, apidl, lpcida->cidl);
_ILFreeaPidl(apidl, lpcida->cidl);
SHFree(pidl);
}
@@ -1289,7 +1350,7 @@ static HRESULT DoPaste(ContextMenu *This)
}
}
if(psfhlpdst) ISFHelper_Release(psfhlpdst);
if(psfhlpsrc) ISFHelper_Release(psfhlpsrc);
if (SUCCEEDED(hr))
- hr = paste_pidls(This, pidls, count);
+ hr = paste_pidls(This, pda, pidls, count);
_ILFreeaPidl(pidls, count);
}
else
--
2.30.2