From 73573b1dff35c30b5e34fdd783a6f6387ab09098 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 17 May 2017 12:06:14 +0200 Subject: [PATCH] kernel32-MoveFile: Fix a regression when copying addon to cache directory. --- ...-test-for-opening-cache-file-with-DE.patch | 48 +++++++++++++++++++ ...py-addons-to-cache-instead-of-moving.patch | 25 ++++++++++ patches/patchinstall.sh | 8 +++- 3 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 patches/kernel32-MoveFile/0006-urlmon-tests-Add-test-for-opening-cache-file-with-DE.patch create mode 100644 patches/kernel32-MoveFile/0007-appwiz.cpl-Copy-addons-to-cache-instead-of-moving.patch diff --git a/patches/kernel32-MoveFile/0006-urlmon-tests-Add-test-for-opening-cache-file-with-DE.patch b/patches/kernel32-MoveFile/0006-urlmon-tests-Add-test-for-opening-cache-file-with-DE.patch new file mode 100644 index 00000000..8fd1cb13 --- /dev/null +++ b/patches/kernel32-MoveFile/0006-urlmon-tests-Add-test-for-opening-cache-file-with-DE.patch @@ -0,0 +1,48 @@ +From d246bb6bbadaa959d49a29dc28d1288473ca8375 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Wed, 17 May 2017 11:58:20 +0200 +Subject: urlmon/tests: Add test for opening cache file with DELETE access. + +--- + dlls/urlmon/tests/url.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/dlls/urlmon/tests/url.c b/dlls/urlmon/tests/url.c +index cd1d855032d..70234ff3fd7 100644 +--- a/dlls/urlmon/tests/url.c ++++ b/dlls/urlmon/tests/url.c +@@ -182,6 +182,7 @@ static HRESULT abort_hres; + static BOOL have_IHttpNegotiate2, use_bscex, is_async_prot; + static BOOL test_redirect, use_cache_file, callback_read, no_callback, test_abort; + static WCHAR cache_file_name[MAX_PATH]; ++static WCHAR http_cache_file[MAX_PATH]; + static BOOL only_check_prot_args = FALSE; + static BOOL invalid_cn_accepted = FALSE; + static BOOL abort_start = FALSE; +@@ -1927,6 +1928,14 @@ static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallbackEx *iface, HRES + ok( WaitForSingleObject(complete_event2, 90000) == WAIT_OBJECT_0, "wait timed out\n" ); + } + ++ if(test_protocol == HTTP_TEST && !emulate_protocol && http_cache_file[0]) { ++ HANDLE file = CreateFileW(http_cache_file, DELETE, FILE_SHARE_DELETE, NULL, ++ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ++ ok(file == INVALID_HANDLE_VALUE, "expected INVALID_HANDLE_VALUE, got %p\n", file); ++ ok(GetLastError() == ERROR_SHARING_VIOLATION, "expected ERROR_SHARING_VIOLATION, got %u\n", GetLastError()); ++ http_cache_file[0] = 0; ++ } ++ + return S_OK; + } + +@@ -2083,6 +2092,8 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallbackEx *iface, DW + else if(emulate_protocol) + ok(!lstrcmpW(pstgmed->u.lpszFileName, cache_fileW), + "unexpected file name %s\n", wine_dbgstr_w(pstgmed->u.lpszFileName)); ++ else if(test_protocol == HTTP_TEST) ++ lstrcpyW(http_cache_file, pstgmed->u.lpszFileName); + else + ok(pstgmed->u.lpszFileName != NULL, "lpszFileName == NULL\n"); + } +-- +2.12.2 + diff --git a/patches/kernel32-MoveFile/0007-appwiz.cpl-Copy-addons-to-cache-instead-of-moving.patch b/patches/kernel32-MoveFile/0007-appwiz.cpl-Copy-addons-to-cache-instead-of-moving.patch new file mode 100644 index 00000000..9d469c96 --- /dev/null +++ b/patches/kernel32-MoveFile/0007-appwiz.cpl-Copy-addons-to-cache-instead-of-moving.patch @@ -0,0 +1,25 @@ +From fcb6d21ede52ef770a04c59ea6bd5b9483c31f32 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Wed, 17 May 2017 12:03:15 +0200 +Subject: appwiz.cpl: Copy addons to cache instead of moving. + +--- + dlls/appwiz.cpl/addons.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dlls/appwiz.cpl/addons.c b/dlls/appwiz.cpl/addons.c +index c3847b54948..91cd485b026 100644 +--- a/dlls/appwiz.cpl/addons.c ++++ b/dlls/appwiz.cpl/addons.c +@@ -510,7 +510,7 @@ static HRESULT WINAPI InstallCallback_OnStopBinding(IBindStatusCallback *iface, + + cache_file_name = get_cache_file_name(TRUE); + if(cache_file_name) { +- MoveFileW(msi_file, cache_file_name); ++ CopyFileW(msi_file, cache_file_name, FALSE); + heap_free(cache_file_name); + } + }else { +-- +2.12.2 + diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 2124db36..ff4108ea 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -4754,8 +4754,8 @@ fi # | * [#14901] MoveFile with source == dest should succeed. # | # | Modified files: -# | * dlls/kernel32/path.c, dlls/kernel32/tests/file.c, dlls/msvcp120/tests/msvcp120.c, -# | programs/cmd/tests/test_builtins.cmd.exp +# | * dlls/appwiz.cpl/addons.c, dlls/kernel32/path.c, dlls/kernel32/tests/file.c, dlls/msvcp120/tests/msvcp120.c, +# | dlls/urlmon/tests/url.c, programs/cmd/tests/test_builtins.cmd.exp # | if test "$enable_kernel32_MoveFile" -eq 1; then patch_apply kernel32-MoveFile/0001-kernel32-tests-Fix-compilation-with-PSDK.patch @@ -4763,12 +4763,16 @@ if test "$enable_kernel32_MoveFile" -eq 1; then patch_apply kernel32-MoveFile/0003-kernel32-tests-Move-the-MoveFile-test-where-it-belon.patch patch_apply kernel32-MoveFile/0004-kernel32-MoveFile-source-source-should-succeed.patch patch_apply kernel32-MoveFile/0005-kernel32-MoveFile-should-make-sure-that-it-has-the-d.patch + patch_apply kernel32-MoveFile/0006-urlmon-tests-Add-test-for-opening-cache-file-with-DE.patch + patch_apply kernel32-MoveFile/0007-appwiz.cpl-Copy-addons-to-cache-instead-of-moving.patch ( printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32/tests: Fix compilation with PSDK.", 1 },'; printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32/tests: Fix a bunch of access denied errors by using a dedicated TEMP directory.", 1 },'; printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32/tests: Move the MoveFile test where it belongs.", 1 },'; printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32: MoveFile(source, source) should succeed.", 1 },'; printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32: MoveFile should make sure that it has the delete access to the source file.", 1 },'; + printf '%s\n' '+ { "Sebastian Lackner", "urlmon/tests: Add test for opening cache file with DELETE access.", 1 },'; + printf '%s\n' '+ { "Sebastian Lackner", "appwiz.cpl: Copy addons to cache instead of moving.", 1 },'; ) >> "$patchlist" fi