mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
kernel32-CopyFileEx: Rebase and reënable.
Rebased by Aida Jonikienė.
This commit is contained in:
parent
7d2ceeab63
commit
1ba0c55d0d
@ -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?= <michael@fds-team.de>
|
||||
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
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,2 @@
|
||||
Fixes: Implement a basic security property tab
|
||||
Depends: shell32-Progress_Dialog
|
||||
Disabled: True
|
||||
|
@ -1,4 +1,3 @@
|
||||
Fixes: Support for shell32 file operation progress dialog
|
||||
Depends: kernel32-CopyFileEx
|
||||
Depends: shell32-SHFileOperation_Move
|
||||
Disabled: True
|
||||
|
Loading…
Reference in New Issue
Block a user