From: Lorenzo Ferrillo Subject: [PATCH 1/2] shell32/test: Add more tests for SHFileOperation for FO_MOVE wildcard operation Message-Id: Date: Sun, 12 Apr 2020 22:48:33 +0200 FO_MOVE SHFileOperation has a bug where move operations originating with a wildcard that are involving multiple source files (>1) do not work under wine unless there operation move also a folder. Fix in the next patch Analysis of the bug: https://bugs.winehq.org/show_bug.cgi?id=39269 Signed-off-by: Lorenzo Ferrillo --- dlls/shell32/tests/shlfileop.c | 65 ++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c index 27c7244042..ca7876c846 100644 --- a/dlls/shell32/tests/shlfileop.c +++ b/dlls/shell32/tests/shlfileop.c @@ -2697,6 +2697,69 @@ static BOOL is_old_shell32(void) return FALSE; } + +static void test_move_wildchar(void) +{ + SHFILEOPSTRUCTA shfo; + CHAR from[5*MAX_PATH]; + CHAR to[5*MAX_PATH]; + DWORD retval; + + clean_after_shfo_tests(); + + CreateDirectoryA("test4.txt", NULL); + CreateDirectoryA("testdir2", NULL); + createTestFile("testdir2\\one.txt"); + + shfo.hwnd = NULL; + shfo.wFunc = FO_MOVE; + shfo.pFrom = from; + shfo.pTo = to; + shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR; + shfo.hNameMappings = NULL; + shfo.lpszProgressTitle = NULL; + shfo.fAnyOperationsAborted = FALSE; + + set_curr_dir_path(from, "testdir2\\*.*\0"); + set_curr_dir_path(to, "test4.txt\0"); + retval = SHFileOperationA(&shfo); + ok(retval == ERROR_SUCCESS, "SHFileOperation failed\n"); + ok(!shfo.fAnyOperationsAborted, "fAnyOperationsAborted %d\n", shfo.fAnyOperationsAborted); + ok(file_exists("testdir2"), "dir should not be moved\n"); + ok(!file_exists("testdir2\\one.txt"), "file should be moved\n"); + ok(file_exists("test4.txt\\one.txt"), "file should be moved here\n"); + + DeleteFileA("test4.txt\\one.txt"); + DeleteFileA("testdir2\\one.txt"); + RemoveDirectoryA("test4.txt"); + RemoveDirectoryA("testdir2"); + + CreateDirectoryA("test4.txt", NULL); + CreateDirectoryA("testdir2", NULL); + createTestFile("testdir2\\one.txt"); + createTestFile("testdir2\\two.txt"); + + shfo.fAnyOperationsAborted = FALSE; + set_curr_dir_path(from, "testdir2\\*.*\0"); + set_curr_dir_path(to, "test4.txt\0"); + retval = SHFileOperationA(&shfo); + todo_wine ok(retval == ERROR_SUCCESS, "SHFileOperation failed\n"); + todo_wine ok(!shfo.fAnyOperationsAborted, "fAnyOperationsAborted %d\n", shfo.fAnyOperationsAborted); + ok(file_exists("testdir2"), "dir should not be moved\n"); + todo_wine ok(!file_exists("testdir2\\one.txt"), "file should be moved\n"); + todo_wine ok(!file_exists("testdir2\\two.txt"), "file should be moved\n"); + todo_wine ok(file_exists("test4.txt\\one.txt"), "file should be moved here\n"); + todo_wine ok(file_exists("test4.txt\\two.txt"), "file should be moved here\n"); + + DeleteFileA("test4.txt\\one.txt"); + DeleteFileA("test4.txt\\two.txt"); + DeleteFileA("testdir2\\one.txt"); + DeleteFileA("testdir2\\two.txt"); + RemoveDirectoryA("test4.txt"); + RemoveDirectoryA("testdir2"); + +} + START_TEST(shlfileop) { clean_after_shfo_tests(); @@ -2742,4 +2805,6 @@ START_TEST(shlfileop) test_unicode(); test_shlmenu(); + + test_move_wildchar(); } -- 2.26.0