shell32: Fix SHFileOperation on empty destination (FO_COPY)
Nikolay Sivov
bunglehead at gmail.com
Tue Jan 27 03:20:00 CST 2009
http://bugs.winehq.org/show_bug.cgi?id=13394
Changelog:
- on FO_COPY and empty destination SHFileOperation should use
current directory
>From 1684fd3c0d47fce3fcff31d316ec7b18291cd5af Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Tue, 27 Jan 2009 12:17:42 +0300
Subject: Fix SHFileOperation on empty destination (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..78b7352 100644
--- a/dlls/shell32/shlfileop.c
+++ b/dlls/shell32/shlfileop.c
@@ -1498,6 +1498,7 @@ int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
FILE_OPERATION op;
FILE_LIST flFrom, flTo;
int ret = 0;
+ WCHAR currd[MAX_PATH];
if (!lpFileOp)
return ERROR_INVALID_PARAMETER;
@@ -1510,6 +1511,13 @@ int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
if ((ret = parse_file_list(&flFrom, lpFileOp->pFrom)))
return ret;
+ if ((lpFileOp->wFunc == FO_COPY) &&
+ (lpFileOp->pTo[0] == 0))
+ {
+ GetCurrentDirectoryW(MAX_PATH, currd);
+ parse_file_list(&flTo, currd);
+ }
+ else
if (lpFileOp->wFunc != FO_DELETE)
parse_file_list(&flTo, lpFileOp->pTo);
diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c
index 433a131..3c85ecd 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");
+
+ /* pFrom contains a name larger than 8.3, 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