From: Ziqing Hui <zhui(a)codeweavers.com> --- dlls/shell32/shlfileop.c | 5 +++-- dlls/shell32/tests/shlfileop.c | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c index d71eb6b968d..cc7944a2851 100644 --- a/dlls/shell32/shlfileop.c +++ b/dlls/shell32/shlfileop.c @@ -1543,8 +1543,6 @@ static DWORD rename_files(SHFILEOPSTRUCTW *op, const FILE_LIST *from, const FILE if (!to->dwNumFiles) return DE_DIFFDIR; entry_to = &to->feFiles[0]; - if (entry_to->bFromWildcard) - return ERROR_INVALID_NAME; if (wcscmp(entry_from->szDirectory, entry_to->szDirectory) != 0) return DE_DIFFDIR; @@ -1596,6 +1594,9 @@ int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp) op.bManyItems = (flFrom.dwNumFiles > 1); lpFileOp->fAnyOperationsAborted = FALSE; + if (flTo.bAnyFromWildcard) + return ERROR_INVALID_NAME; + switch (lpFileOp->wFunc) { case FO_COPY: diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c index 46d32390c8c..25c502a73b8 100644 --- a/dlls/shell32/tests/shlfileop.c +++ b/dlls/shell32/tests/shlfileop.c @@ -1486,6 +1486,11 @@ static void test_copy(void) ok(DeleteFileA("two\\bb.txt"), "Expected file to exist\n"); } + /* Wildcard target. */ + check_file_operation(FO_COPY, FOF_NO_UI, "aa.txt\0", "tw?\0", + ERROR_INVALID_NAME, FALSE, FALSE, FALSE); + ok(!file_exists("two\\aa.txt"), "Expected file to not exist\n"); + ok(DeleteFileA("aa.txt"), "Expected file to exist\n"); ok(DeleteFileA("ab.txt"), "Expected file to exist\n"); ok(DeleteFileA("bb.txt"), "Expected file to exist\n"); @@ -1586,7 +1591,7 @@ static void test_move(void) set_curr_dir_path(from, "testdir2\\*.*\0"); set_curr_dir_path(to, "test4.txt\\*.*\0"); check_file_operation(FO_MOVE, FOF_NO_UI, from, to, - ERROR_INVALID_NAME, FALSE, TRUE, FALSE); + ERROR_INVALID_NAME, FALSE, FALSE, FALSE); ok(file_exists("testdir2"), "dir should not be moved\n"); ok(file_exists("testdir2\\one.txt"), "file should not be moved\n"); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7945