From 1ba0c55d0ddba5ec47a03f3ef97e8d8ed5bb67df Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 7 Mar 2024 23:29:47 -0600 Subject: [PATCH] =?UTF-8?q?kernel32-CopyFileEx:=20Rebase=20and=20re=C3=ABn?= =?UTF-8?q?able.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rebased by Aida JonikienÄ—. --- ...port-for-progress-callback-in-CopyFi.patch | 68 ++++++++++++++++--- patches/kernel32-CopyFileEx/definition | 1 - patches/shell32-ACE_Viewer/definition | 1 - patches/shell32-Progress_Dialog/definition | 1 - 4 files changed, 57 insertions(+), 14 deletions(-) diff --git a/patches/kernel32-CopyFileEx/0001-kernel32-Add-support-for-progress-callback-in-CopyFi.patch b/patches/kernel32-CopyFileEx/0001-kernel32-Add-support-for-progress-callback-in-CopyFi.patch index 63e06455..df5fdd40 100644 --- a/patches/kernel32-CopyFileEx/0001-kernel32-Add-support-for-progress-callback-in-CopyFi.patch +++ b/patches/kernel32-CopyFileEx/0001-kernel32-Add-support-for-progress-callback-in-CopyFi.patch @@ -1,12 +1,12 @@ -From 5e3315735a72bedc1fc45feee59018a3900338e0 Mon Sep 17 00:00:00 2001 +From fe242e3483f040fdffd2ff7aa9774f7212149f56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Thu, 26 Feb 2015 06:41:26 +0100 Subject: [PATCH] kernelbase: Add support for progress callback in CopyFileEx. --- - dlls/kernel32/tests/file.c | 6 ---- - dlls/kernelbase/file.c | 72 ++++++++++++++++++++++++++++++++++---- - 2 files changed, 66 insertions(+), 12 deletions(-) + dlls/kernel32/tests/file.c | 6 --- + dlls/kernelbase/file.c | 87 ++++++++++++++++++++++++++++++++------ + 2 files changed, 73 insertions(+), 20 deletions(-) diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c index 02625140702..251010eb5d8 100644 @@ -37,10 +37,21 @@ index 02625140702..251010eb5d8 100644 retok = CopyFileExA(source, NULL, copy_progress_cb, hfile, NULL, 0); diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c -index b6f8208ac9e..32a672fc9d9 100644 +index 7806ad2ec1f..e5adc0d4e2c 100644 --- a/dlls/kernelbase/file.c +++ b/dlls/kernelbase/file.c -@@ -499,11 +499,16 @@ static BOOL copy_file( const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDE +@@ -490,23 +490,29 @@ BOOL WINAPI DECLSPEC_HOTPATCH AreFileApisANSI(void) + /****************************************************************************** + * copy_file + */ +-static BOOL copy_file( const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDED_PARAMETERS *params ) ++static BOOL copy_file( const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDED_PARAMETERS *params, LPPROGRESS_ROUTINE progress ) + { + DWORD flags = params ? params->dwCopyFlags : 0; + BOOL *cancel_ptr = params ? params->pfCancel : NULL; +- PCOPYFILE2_PROGRESS_ROUTINE progress = params ? params->pProgressRoutine : NULL; ++ void *param = params ? params->pvCallbackContext : NULL; ++ PCOPYFILE2_PROGRESS_ROUTINE progress2 = params ? params->pProgressRoutine : NULL; static const int buffer_size = 65536; HANDLE h1, h2; @@ -58,7 +69,12 @@ index b6f8208ac9e..32a672fc9d9 100644 if (cancel_ptr) FIXME("pfCancel is not supported\n"); -@@ -530,7 +535,10 @@ static BOOL copy_file( const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDE +- if (progress) ++ if (progress2) + FIXME("PCOPYFILE2_PROGRESS_ROUTINE is not supported\n"); + + if (!source || !dest) +@@ -529,7 +535,10 @@ static BOOL copy_file( const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDE if (flags & COPY_FILE_OPEN_SOURCE_FOR_WRITE) FIXME("COPY_FILE_OPEN_SOURCE_FOR_WRITE is not supported\n"); @@ -70,7 +86,7 @@ index b6f8208ac9e..32a672fc9d9 100644 NULL, OPEN_EXISTING, 0, 0 )) == INVALID_HANDLE_VALUE) { WARN("Unable to open source %s\n", debugstr_w(source)); -@@ -538,7 +546,7 @@ static BOOL copy_file( const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDE +@@ -537,7 +546,7 @@ static BOOL copy_file( const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDE return FALSE; } @@ -79,7 +95,7 @@ index b6f8208ac9e..32a672fc9d9 100644 { WARN("GetFileInformationByHandle returned error for %s\n", debugstr_w(source)); HeapFree( GetProcessHeap(), 0, buffer ); -@@ -564,7 +572,11 @@ static BOOL copy_file( const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDE +@@ -563,7 +572,11 @@ static BOOL copy_file( const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDE } } @@ -92,7 +108,7 @@ index b6f8208ac9e..32a672fc9d9 100644 (flags & COPY_FILE_FAIL_IF_EXISTS) ? CREATE_NEW : CREATE_ALWAYS, info.FileAttributes, h1 )) == INVALID_HANDLE_VALUE) { -@@ -574,6 +586,29 @@ static BOOL copy_file( const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDE +@@ -573,6 +586,29 @@ static BOOL copy_file( const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDE return FALSE; } @@ -122,7 +138,7 @@ index b6f8208ac9e..32a672fc9d9 100644 while (ReadFile( h1, buffer, buffer_size, &count, NULL ) && count) { char *p = buffer; -@@ -583,13 +618,38 @@ static BOOL copy_file( const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDE +@@ -582,13 +618,38 @@ static BOOL copy_file( const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDE if (!WriteFile( h2, p, count, &res, NULL ) || !res) goto done; p += res; count -= res; @@ -163,6 +179,36 @@ index b6f8208ac9e..32a672fc9d9 100644 HeapFree( GetProcessHeap(), 0, buffer ); CloseHandle( h1 ); CloseHandle( h2 ); +@@ -601,7 +662,7 @@ done: + */ + HRESULT WINAPI CopyFile2( const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDED_PARAMETERS *params ) + { +- return copy_file(source, dest, params) ? S_OK : HRESULT_FROM_WIN32(GetLastError()); ++ return copy_file(source, dest, params, NULL) ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + } + + +@@ -613,18 +674,16 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT + { + COPYFILE2_EXTENDED_PARAMETERS params; + +- if (progress) +- FIXME("LPPROGRESS_ROUTINE is not supported\n"); + if (cancel_ptr) + FIXME("cancel_ptr is not supported\n"); + + params.dwSize = sizeof(params); + params.dwCopyFlags = flags; + params.pProgressRoutine = NULL; +- params.pvCallbackContext = NULL; ++ params.pvCallbackContext = param; + params.pfCancel = NULL; + +- return copy_file( source, dest, ¶ms ); ++ return copy_file( source, dest, ¶ms, progress ); + } + + -- 2.43.0 diff --git a/patches/kernel32-CopyFileEx/definition b/patches/kernel32-CopyFileEx/definition index 2fa3df37..0d53c43d 100644 --- a/patches/kernel32-CopyFileEx/definition +++ b/patches/kernel32-CopyFileEx/definition @@ -1,3 +1,2 @@ Fixes: [22692] Add support for CopyFileEx progress callback Fixes: [22690] Allow to cancel a file operation via progress callback -Disabled: True diff --git a/patches/shell32-ACE_Viewer/definition b/patches/shell32-ACE_Viewer/definition index 9c0290e2..04a44434 100644 --- a/patches/shell32-ACE_Viewer/definition +++ b/patches/shell32-ACE_Viewer/definition @@ -1,3 +1,2 @@ Fixes: Implement a basic security property tab Depends: shell32-Progress_Dialog -Disabled: True diff --git a/patches/shell32-Progress_Dialog/definition b/patches/shell32-Progress_Dialog/definition index b30ab4f5..c0dfa7ec 100644 --- a/patches/shell32-Progress_Dialog/definition +++ b/patches/shell32-Progress_Dialog/definition @@ -1,4 +1,3 @@ Fixes: Support for shell32 file operation progress dialog Depends: kernel32-CopyFileEx Depends: shell32-SHFileOperation_Move -Disabled: True