Paul Gofman : shell32: Only consider copy operation multidest if the number of dst files is greater than one.

Alexandre Julliard julliard at winehq.org
Tue Nov 10 13:46:24 CST 2020


Module: wine
Branch: stable
Commit: cbfb70ba0a5fc2aadb9cd8f0df98aea732336435
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=cbfb70ba0a5fc2aadb9cd8f0df98aea732336435

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Tue Jun 23 15:09:01 2020 +0300

shell32: Only consider copy operation multidest if the number of dst files is greater than one.

Fixes crash on start in Worms World Party Remastered.

Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit e2f456cfe57de42259cca8155a56854a0f170844)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/shell32/shlfileop.c       | 2 +-
 dlls/shell32/tests/shlfileop.c | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c
index b941db39144..38c582be091 100644
--- a/dlls/shell32/shlfileop.c
+++ b/dlls/shell32/shlfileop.c
@@ -1207,7 +1207,7 @@ static int copy_files(FILE_OPERATION *op, const FILE_LIST *flFrom, FILE_LIST *fl
         fileDest = &flTo->feFiles[0];
     }
 
-    if (op->req->fFlags & FOF_MULTIDESTFILES)
+    if (op->req->fFlags & FOF_MULTIDESTFILES && flTo->dwNumFiles > 1)
     {
         if (flFrom->bAnyFromWildcard)
             return ERROR_CANCELLED;
diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c
index 27c72440425..36602f335d6 100644
--- a/dlls/shell32/tests/shlfileop.c
+++ b/dlls/shell32/tests/shlfileop.c
@@ -1816,6 +1816,15 @@ static void test_copy(void)
     CreateDirectoryA("one", NULL);
     CreateDirectoryA("two", NULL);
 
+    /* Test with FOF_MULTIDESTFILES with a wildcard in pFrom and single output directory. */
+    shfo.pFrom = "a*.txt\0";
+    shfo.pTo = "one\0";
+    shfo.fFlags |= FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI | FOF_MULTIDESTFILES;
+    retval = SHFileOperationA(&shfo);
+    ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+    ok(DeleteFileA("one\\aa.txt"), "Expected file to exist\n");
+    ok(DeleteFileA("one\\ab.txt"), "Expected file to exist\n");
+
     /* pFrom has a glob, pTo has more than one dest */
     shfo.pFrom = "a*.txt\0";
     shfo.pTo = "one\0two\0";




More information about the wine-cvs mailing list