shell32: Fix SHFileOperation on empty destination (FO_COPY) (try2)
Nikolay Sivov
bunglehead at gmail.com
Thu Jan 29 08:13:56 CST 2009
http://bugs.winehq.org/show_bug.cgi?id=13394
Changelog:
- try2: code moved to copy_files instead of root SHFileOperationW
- Choose current directory on NULL dest for FO_COPY
>From f3646b5e079acbc114cfdfe9426519e37e3e1a50 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Thu, 29 Jan 2009 17:08:59 +0300
Subject: Choose current directory on NULL dest for FO_COPY
---
dlls/shell32/shlfileop.c | 8 ++++++++
dlls/shell32/tests/shlfileop.c | 14 ++++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c
index ec7ba54..221ccc1 100644
--- a/dlls/shell32/shlfileop.c
+++ b/dlls/shell32/shlfileop.c
@@ -1178,6 +1178,14 @@ static HRESULT copy_files(FILE_OPERATION *op,
const FILE_LIST *flFrom, FILE_LIST
DWORD i;
const FILE_ENTRY *entryToCopy;
const FILE_ENTRY *fileDest = &flTo->feFiles[0];
+ WCHAR currd[MAX_PATH];
+
+ if (!fileDest)
+ {
+ GetCurrentDirectoryW(MAX_PATH, currd);
+ parse_file_list(flTo, currd);
+ fileDest = &flTo->feFiles[0];
+ }
if (flFrom->bAnyDontExist)
return ERROR_SHELL_INTERNAL_FILE_NOT_FOUND;
diff --git a/dlls/shell32/tests/shlfileop.c
b/dlls/shell32/tests/shlfileop.c
index 433a131..584cffc 100644
--- a/dlls/shell32/tests/shlfileop.c
+++ b/dlls/shell32/tests/shlfileop.c
@@ -1673,6 +1673,20 @@ static void test_copy(void)
ok(DeleteFileA("ab.txt"), "Expected file to exist\n");
ok(RemoveDirectoryA("one"), "Expected dir to exist\n");
ok(RemoveDirectoryA("two"), "Expected dir to exist\n");
+
+ /* pTo is an empty string */
+ CreateDirectoryA("one", NULL);
+ createTestFile("one\\abcdefghi.abc");
+ shfo.pFrom = "one\\abcdefghi.abc\0";
+ shfo.pTo = "\0";
+ shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI |
FOF_FILESONLY |
+ FOF_NOCONFIRMMKDIR;
+
+ retval = SHFileOperationA(&shfo);
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n",
retval);
+ ok(DeleteFileA("abcdefghi.abc"), "Expected file to exist\n");
+ ok(DeleteFileA("one\\abcdefghi.abc"), "Expected file to exist\n");
+ ok(RemoveDirectoryA("one"), "Expected dir to exist\n");
}
/* tests the FO_MOVE action */
--
1.5.6.5
More information about the wine-patches
mailing list