From 9d4b8df3ccdc4fcb75789943aa8d9e61335bd587 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 31 Aug 2015 08:49:30 +0200 Subject: [PATCH] Added patch to fix SHFileOperation with FO_MOVE on Vista+ (should create non-existent subdirectories). --- README.md | 3 +- debian/changelog | 2 + patches/patchinstall.sh | 50 ++++++++++++---- ...E_INFORMATION-into-SHNotify-function.patch | 24 ++++---- patches/shell32-Progress_Dialog/definition | 1 + ...leOperation-FO_MOVE-for-creating-sub.patch | 60 +++++++++++++++++++ .../shell32-SHFileOperation_Move/definition | 2 + ...eturn-value-for-SHFileOperationW-dep.patch | 0 .../definition | 0 9 files changed, 116 insertions(+), 26 deletions(-) create mode 100644 patches/shell32-SHFileOperation_Move/0001-shell32-Fix-SHFileOperation-FO_MOVE-for-creating-sub.patch create mode 100644 patches/shell32-SHFileOperation_Move/definition rename patches/{shell32-SHFileOperation => shell32-SHFileOperation_Win9x}/0001-shell32-Choose-return-value-for-SHFileOperationW-dep.patch (100%) rename patches/{shell32-SHFileOperation => shell32-SHFileOperation_Win9x}/definition (100%) diff --git a/README.md b/README.md index dc14d33d..44d89e8d 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Wine. All those differences are also documented on the Included bug fixes and improvements ----------------------------------- -**Bug fixes and features included in the next upcoming release [8]:** +**Bug fixes and features included in the next upcoming release [9]:** * Add stub for winspool.SetPrinterW level 8 ([Wine Bug #24645](https://bugs.winehq.org/show_bug.cgi?id=24645)) * Allow non-nullterminated string as working directory in kernel32.create_startup_info @@ -48,6 +48,7 @@ Included bug fixes and improvements * Fix failure to create anonymous file mapping after failed open_fd server call * Map EXDEV error code to STATUS_NOT_SAME_DEVICE * Return a dummy BIOS name in Win32_BIOS record +* SHFileOperation with FO_MOVE should create new directory on Vista+ ([Wine Bug #25207](https://bugs.winehq.org/show_bug.cgi?id=25207)) * Translate flags in LaunchINFSectionW diff --git a/debian/changelog b/debian/changelog index 674dd292..13371c7d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,8 @@ wine-staging (1.7.51) UNRELEASED; urgency=low kernel32.create_startup_info (fixes Wine Staging Bug #543). * Added patch with stub for winspool.SetPrinterW level 8. * Added patch to translate flags in LaunchINFSectionW. + * Added patch to fix SHFileOperation with FO_MOVE on Vista+ (should create + non-existent subdirectories). * Removed patch to fix bug in wineserver debug_children inheritance (accepted upstream). * Removed patch to use helper function for NtWaitForMultipleObjects and diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index bdc7713c..5aa0d0ae 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -250,7 +250,8 @@ patch_enable_all () enable_shell32_Run_Dialog="$1" enable_shell32_SFGAO_HASSUBFOLDER="$1" enable_shell32_SHCreateSessionKey="$1" - enable_shell32_SHFileOperation="$1" + enable_shell32_SHFileOperation_Move="$1" + enable_shell32_SHFileOperation_Win9x="$1" enable_shell32_UnixFS="$1" enable_shlwapi_AssocGetPerceivedType="$1" enable_shlwapi_UrlCombine="$1" @@ -834,8 +835,11 @@ patch_enable () shell32-SHCreateSessionKey) enable_shell32_SHCreateSessionKey="$2" ;; - shell32-SHFileOperation) - enable_shell32_SHFileOperation="$2" + shell32-SHFileOperation_Move) + enable_shell32_SHFileOperation_Move="$2" + ;; + shell32-SHFileOperation_Win9x) + enable_shell32_SHFileOperation_Win9x="$2" ;; shell32-UnixFS) enable_shell32_UnixFS="$2" @@ -1541,8 +1545,8 @@ if test "$enable_category_stable" -eq 1; then if test "$enable_shell32_RunDLL_CallEntry16" -gt 1; then abort "Patchset shell32-RunDLL_CallEntry16 disabled, but category-stable depends on that." fi - if test "$enable_shell32_SHFileOperation" -gt 1; then - abort "Patchset shell32-SHFileOperation disabled, but category-stable depends on that." + if test "$enable_shell32_SHFileOperation_Win9x" -gt 1; then + abort "Patchset shell32-SHFileOperation_Win9x disabled, but category-stable depends on that." fi if test "$enable_urlmon_CoInternetSetFeatureEnabled" -gt 1; then abort "Patchset urlmon-CoInternetSetFeatureEnabled disabled, but category-stable depends on that." @@ -1662,7 +1666,7 @@ if test "$enable_category_stable" -eq 1; then enable_server_Delete_On_Close=1 enable_setupapi_SetupDiSetDeviceInstallParamsW=1 enable_shell32_RunDLL_CallEntry16=1 - enable_shell32_SHFileOperation=1 + enable_shell32_SHFileOperation_Win9x=1 enable_urlmon_CoInternetSetFeatureEnabled=1 enable_user32_DrawTextExW=1 enable_user32_WndProc=1 @@ -1723,9 +1727,9 @@ if test "$enable_uxtheme_GTK_Theming" -eq 1; then enable_ntdll_DllRedirects=1 fi -if test "$enable_shell32_SHFileOperation" -eq 1; then +if test "$enable_shell32_SHFileOperation_Win9x" -eq 1; then if test "$enable_shell32_Progress_Dialog" -gt 1; then - abort "Patchset shell32-Progress_Dialog disabled, but shell32-SHFileOperation depends on that." + abort "Patchset shell32-Progress_Dialog disabled, but shell32-SHFileOperation_Win9x depends on that." fi enable_shell32_Progress_Dialog=1 fi @@ -1734,7 +1738,11 @@ if test "$enable_shell32_Progress_Dialog" -eq 1; then if test "$enable_kernel32_CopyFileEx" -gt 1; then abort "Patchset kernel32-CopyFileEx disabled, but shell32-Progress_Dialog depends on that." fi + if test "$enable_shell32_SHFileOperation_Move" -gt 1; then + abort "Patchset shell32-SHFileOperation_Move disabled, but shell32-Progress_Dialog depends on that." + fi enable_kernel32_CopyFileEx=1 + enable_shell32_SHFileOperation_Move=1 fi if test "$enable_server_Shared_Memory" -eq 1; then @@ -4832,10 +4840,26 @@ if test "$enable_shell32_Placeholder_Icons" -eq 1; then ) >> "$patchlist" fi +# Patchset shell32-SHFileOperation_Move +# | +# | This patchset fixes the following Wine bugs: +# | * [#25207] SHFileOperation with FO_MOVE should create new directory on Vista+ +# | +# | Modified files: +# | * dlls/shell32/shlfileop.c, dlls/shell32/tests/shlfileop.c +# | +if test "$enable_shell32_SHFileOperation_Move" -eq 1; then + patch_apply shell32-SHFileOperation_Move/0001-shell32-Fix-SHFileOperation-FO_MOVE-for-creating-sub.patch + ( + echo '+ { "Zhenbo Li", "shell32: Fix SHFileOperation(FO_MOVE) for creating subdirectories.", 1 },'; + ) >> "$patchlist" +fi + # Patchset shell32-Progress_Dialog # | # | This patchset has the following (direct or indirect) dependencies: -# | * kernel32-SetFileInformationByHandle, server-File_Permissions, ntdll-FileDispositionInformation, kernel32-CopyFileEx +# | * kernel32-SetFileInformationByHandle, server-File_Permissions, ntdll-FileDispositionInformation, kernel32-CopyFileEx, +# | shell32-SHFileOperation_Move # | # | Modified files: # | * dlls/shell32/shell32.rc, dlls/shell32/shlfileop.c, dlls/shell32/shresdef.h @@ -4912,11 +4936,11 @@ if test "$enable_shell32_SHCreateSessionKey" -eq 1; then ) >> "$patchlist" fi -# Patchset shell32-SHFileOperation +# Patchset shell32-SHFileOperation_Win9x # | # | This patchset has the following (direct or indirect) dependencies: # | * kernel32-SetFileInformationByHandle, server-File_Permissions, ntdll-FileDispositionInformation, kernel32-CopyFileEx, -# | shell32-Progress_Dialog +# | shell32-SHFileOperation_Move, shell32-Progress_Dialog # | # | This patchset fixes the following Wine bugs: # | * [#37916] Anno 1602 installer depends on Windows 98 behavior of SHFileOperationW @@ -4924,8 +4948,8 @@ fi # | Modified files: # | * dlls/shell32/shlfileop.c # | -if test "$enable_shell32_SHFileOperation" -eq 1; then - patch_apply shell32-SHFileOperation/0001-shell32-Choose-return-value-for-SHFileOperationW-dep.patch +if test "$enable_shell32_SHFileOperation_Win9x" -eq 1; then + patch_apply shell32-SHFileOperation_Win9x/0001-shell32-Choose-return-value-for-SHFileOperationW-dep.patch ( echo '+ { "Michael Müller", "shell32: Choose return value for SHFileOperationW depending on windows version.", 1 },'; ) >> "$patchlist" diff --git a/patches/shell32-Progress_Dialog/0002-shell32-Pass-FILE_INFORMATION-into-SHNotify-function.patch b/patches/shell32-Progress_Dialog/0002-shell32-Pass-FILE_INFORMATION-into-SHNotify-function.patch index 01b7c4a5..0fd7e599 100644 --- a/patches/shell32-Progress_Dialog/0002-shell32-Pass-FILE_INFORMATION-into-SHNotify-function.patch +++ b/patches/shell32-Progress_Dialog/0002-shell32-Pass-FILE_INFORMATION-into-SHNotify-function.patch @@ -1,4 +1,4 @@ -From 950a0c1fd7d57bf0724135e3ffd7848182df59ee Mon Sep 17 00:00:00 2001 +From 80c21a616ab5a8ededa1ac516722023f0922a072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Thu, 26 Feb 2015 23:21:26 +0100 Subject: shell32: Pass FILE_INFORMATION into SHNotify* functions. @@ -9,7 +9,7 @@ Preparation of the progressbar work. Based on a patch by Huw Campbell. 1 file changed, 98 insertions(+), 103 deletions(-) diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c -index 08a0515..665e74c 100644 +index d73ee94..d1f9cf8 100644 --- a/dlls/shell32/shlfileop.c +++ b/dlls/shell32/shlfileop.c @@ -59,16 +59,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); @@ -398,7 +398,7 @@ index 08a0515..665e74c 100644 -static DWORD move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, const FILE_LIST *flTo) +static DWORD move_files(FILE_OPERATION *op, BOOL multidest, const FILE_LIST *flFrom, const FILE_LIST *flTo) { - DWORD i; + DWORD i, ret; INT mismatched = 0; @@ -1412,14 +1409,12 @@ static DWORD move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, con if (!flTo->dwNumFiles) @@ -417,16 +417,16 @@ index 08a0515..665e74c 100644 flFrom->dwNumFiles > flTo->dwNumFiles) { return ERROR_CANCELLED; -@@ -1428,7 +1423,7 @@ static DWORD move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, con - if (!PathFileExistsW(flTo->feFiles[0].szDirectory)) - return ERROR_CANCELLED; +@@ -1432,7 +1427,7 @@ static DWORD move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, con + return ret; + } - if (lpFileOp->fFlags & FOF_MULTIDESTFILES) + if (multidest) mismatched = flFrom->dwNumFiles - flTo->dwNumFiles; fileDest = &flTo->feFiles[0]; -@@ -1439,7 +1434,7 @@ static DWORD move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, con +@@ -1443,7 +1438,7 @@ static DWORD move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, con if (!PathFileExistsW(fileDest->szDirectory)) return ERROR_CANCELLED; @@ -435,7 +435,7 @@ index 08a0515..665e74c 100644 { if (i >= flTo->dwNumFiles) break; -@@ -1453,9 +1448,9 @@ static DWORD move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, con +@@ -1457,9 +1452,9 @@ static DWORD move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, con } if (fileDest->bExists && IsAttribDir(fileDest->attributes)) @@ -447,7 +447,7 @@ index 08a0515..665e74c 100644 } if (mismatched > 0) -@@ -1470,7 +1465,7 @@ static DWORD move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, con +@@ -1474,7 +1469,7 @@ static DWORD move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, con } /* the FO_RENAME files */ @@ -456,7 +456,7 @@ index 08a0515..665e74c 100644 { const FILE_ENTRY *feFrom; const FILE_ENTRY *feTo; -@@ -1492,7 +1487,7 @@ static DWORD rename_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, c +@@ -1496,7 +1491,7 @@ static DWORD rename_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, c if (feTo->bExists) return ERROR_ALREADY_EXISTS; @@ -465,7 +465,7 @@ index 08a0515..665e74c 100644 } /* alert the user if an unsupported flag is used */ -@@ -1539,16 +1534,16 @@ int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp) +@@ -1543,16 +1538,16 @@ int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp) switch (lpFileOp->wFunc) { case FO_COPY: @@ -487,5 +487,5 @@ index 08a0515..665e74c 100644 default: ret = ERROR_INVALID_PARAMETER; -- -2.3.2 +2.5.0 diff --git a/patches/shell32-Progress_Dialog/definition b/patches/shell32-Progress_Dialog/definition index d3238760..c0dfa7ec 100644 --- a/patches/shell32-Progress_Dialog/definition +++ b/patches/shell32-Progress_Dialog/definition @@ -1,2 +1,3 @@ Fixes: Support for shell32 file operation progress dialog Depends: kernel32-CopyFileEx +Depends: shell32-SHFileOperation_Move diff --git a/patches/shell32-SHFileOperation_Move/0001-shell32-Fix-SHFileOperation-FO_MOVE-for-creating-sub.patch b/patches/shell32-SHFileOperation_Move/0001-shell32-Fix-SHFileOperation-FO_MOVE-for-creating-sub.patch new file mode 100644 index 00000000..939b247c --- /dev/null +++ b/patches/shell32-SHFileOperation_Move/0001-shell32-Fix-SHFileOperation-FO_MOVE-for-creating-sub.patch @@ -0,0 +1,60 @@ +From cfa714bac4c6610bbeeb540041ff327a78fca47f Mon Sep 17 00:00:00 2001 +From: Zhenbo Li +Date: Fri, 14 Aug 2015 21:18:43 +0800 +Subject: shell32: Fix SHFileOperation(FO_MOVE) for creating subdirectories. + +This patch fixes bug 25207. +--- + dlls/shell32/shlfileop.c | 8 ++++++-- + dlls/shell32/tests/shlfileop.c | 4 ++-- + 2 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c +index 0b096b1..4d2ebb4 100644 +--- a/dlls/shell32/shlfileop.c ++++ b/dlls/shell32/shlfileop.c +@@ -1401,7 +1401,7 @@ static void move_to_dir(LPSHFILEOPSTRUCTW lpFileOp, const FILE_ENTRY *feFrom, co + /* the FO_MOVE operation */ + static DWORD move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, const FILE_LIST *flTo) + { +- DWORD i; ++ DWORD i, ret; + INT mismatched = 0; + const FILE_ENTRY *entryToMove; + const FILE_ENTRY *fileDest; +@@ -1426,7 +1426,11 @@ static DWORD move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, con + } + + if (!PathFileExistsW(flTo->feFiles[0].szDirectory)) +- return ERROR_CANCELLED; ++ { ++ ret = SHCreateDirectoryExW(NULL, flTo->feFiles[0].szDirectory, NULL); ++ if (ret) ++ return ret; ++ } + + if (lpFileOp->fFlags & FOF_MULTIDESTFILES) + mismatched = flFrom->dwNumFiles - flTo->dwNumFiles; +diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c +index d33ad5b..108d65e 100644 +--- a/dlls/shell32/tests/shlfileop.c ++++ b/dlls/shell32/tests/shlfileop.c +@@ -2205,13 +2205,13 @@ static void test_move(void) + ok(!DeleteFileA("d.txt"), "Expected d.txt to not exist\n"); + } + +- /* FO_MOVE does not create dest directories */ ++ /* FO_MOVE should create dest directories */ + shfo.pFrom = "test2.txt\0"; + shfo.pTo = "dir1\\dir2\\test2.txt\0"; + retval = SHFileOperationA(&shfo); + if (dir_exists("dir1")) + { +- /* Vista and W2K8 (broken or new behavior ?) */ ++ /* New behavior on Vista or later */ + ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval); + ok(DeleteFileA("dir1\\dir2\\test2.txt"), "Expected dir1\\dir2\\test2.txt to exist\n"); + RemoveDirectoryA("dir1\\dir2"); +-- +2.5.0 + diff --git a/patches/shell32-SHFileOperation_Move/definition b/patches/shell32-SHFileOperation_Move/definition new file mode 100644 index 00000000..5ee49927 --- /dev/null +++ b/patches/shell32-SHFileOperation_Move/definition @@ -0,0 +1,2 @@ +Fixes: [25207] SHFileOperation with FO_MOVE should create new directory on Vista+ +# Patch might be incomplete, see https://bugs.wine-staging.com/show_bug.cgi?id=541#c3 diff --git a/patches/shell32-SHFileOperation/0001-shell32-Choose-return-value-for-SHFileOperationW-dep.patch b/patches/shell32-SHFileOperation_Win9x/0001-shell32-Choose-return-value-for-SHFileOperationW-dep.patch similarity index 100% rename from patches/shell32-SHFileOperation/0001-shell32-Choose-return-value-for-SHFileOperationW-dep.patch rename to patches/shell32-SHFileOperation_Win9x/0001-shell32-Choose-return-value-for-SHFileOperationW-dep.patch diff --git a/patches/shell32-SHFileOperation/definition b/patches/shell32-SHFileOperation_Win9x/definition similarity index 100% rename from patches/shell32-SHFileOperation/definition rename to patches/shell32-SHFileOperation_Win9x/definition