Signed-off-by: Daniel Lehman dlehman25@gmail.com --- dlls/shell32/shlfileop.c | 9 +++++++++ dlls/shell32/tests/shlfileop.c | 46 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+)
diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c index 5d93334..bcc9277 100644 --- a/dlls/shell32/shlfileop.c +++ b/dlls/shell32/shlfileop.c @@ -1005,6 +1005,7 @@ static HRESULT parse_file_list(FILE_LIST *flList, LPCWSTR szFiles) { LPCWSTR ptr = szFiles; WCHAR szCurFile[MAX_PATH]; + LPWSTR szPos; DWORD i = 0;
if (!szFiles) @@ -1039,6 +1040,14 @@ static HRESULT parse_file_list(FILE_LIST *flList, LPCWSTR szFiles) flList->feFiles[i].bFromRelative = FALSE; }
+ szPos = szCurFile; + while (*szPos) + { + if (*szPos == '/') + *szPos = '\'; + szPos++; + } + /* parse wildcard files if they are in the filename */ if (StrPBrkW(szCurFile, wWildcardChars)) { diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c index 6a220fa..8fb4dcf 100644 --- a/dlls/shell32/tests/shlfileop.c +++ b/dlls/shell32/tests/shlfileop.c @@ -1869,6 +1869,28 @@ static void test_copy(void) ok(retval != ERROR_SUCCESS, "Unexpected ERROR_SUCCESS\n"); ok(!shfo.fAnyOperationsAborted, "Didn't expect aborted operations\n"); ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError()); + + /* test with / */ + CreateDirectoryA("dir", NULL); + CreateDirectoryA("dir\subdir", NULL); + createTestFile("dir\subdir\aa.txt"); + shfo.pFrom = "dir/subdir/aa.txt\0"; + shfo.pTo = "dir\destdir/aa.txt\0"; + shfo.fFlags = FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR | FOF_SILENT | FOF_NOERRORUI; + retval = SHFileOperationA(&shfo); + if (dir_exists("dir\destdir")) + { + ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval); + ok(DeleteFileA("dir\destdir\aa.txt"), "Expected file to exist\n"); + ok(RemoveDirectoryA("dir\destdir"), "Expected dir to exist\n"); + } + else + { + expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* WinXp, Win2k */); + } + ok(DeleteFileA("dir\subdir\aa.txt"), "Expected file to exist\n"); + ok(RemoveDirectoryA("dir\subdir"), "Expected dir to exist\n"); + ok(RemoveDirectoryA("dir"), "Expected dir to exist\n"); }
/* tests the FO_MOVE action */ @@ -1921,6 +1943,30 @@ static void test_move(void) clean_after_shfo_tests(); init_shfo_tests();
+ /* same tests above, but with / */ + set_curr_dir_path(from, "testdir2/*.*\0"); + set_curr_dir_path(to, "test4.txt\0"); + retval = SHFileOperationA(&shfo); + ok(retval == ERROR_SUCCESS || + broken(retval == ERROR_FILE_NOT_FOUND), /* WinXp, Win2k3 */ + "Expected ERROR_SUCCESS, got %d\n", retval); + if (retval == ERROR_SUCCESS) + { + ok(!shfo.fAnyOperationsAborted, "fAnyOperationsAborted %d\n", shfo.fAnyOperationsAborted); + + ok(dir_exists("testdir2"), "dir should not be moved\n"); + ok(!file_exists("testdir2\one.txt"), "file should be moved\n"); + ok(!dir_exists("testdir2\nested"), "dir should be moved\n"); + ok(!file_exists("testdir2\nested\two.txt"), "file should be moved\n"); + + ok(file_exists("test4.txt\one.txt"), "file should exist\n"); + ok(dir_exists("test4.txt\nested"), "dir should exist\n"); + ok(file_exists("test4.txt\nested\two.txt"), "file should exist\n"); + } + + clean_after_shfo_tests(); + init_shfo_tests(); + shfo.hwnd = NULL; shfo.wFunc = FO_MOVE; shfo.pFrom = from;