Rebase against e8f4909ac3cc58e67ad73b9d4a0cbe6fe7b3bf90.

This commit is contained in:
Zebediah Figura
2024-02-12 17:29:03 -06:00
parent dc3b4e6589
commit eedc72d581
5 changed files with 15 additions and 352 deletions

View File

@ -1,4 +1,4 @@
From 8b435d44bcbeb2e6fd1ef37c8a23405dea88b685 Mon Sep 17 00:00:00 2001
From 2b6ee689166a59bf023b59cd9c1dd8b0b661a89e 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.
@ -9,10 +9,10 @@ Subject: [PATCH] kernelbase: Add support for progress callback in CopyFileEx.
2 files changed, 66 insertions(+), 12 deletions(-)
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index 1c4cdfea1b4..0d0e6a893c9 100644
index 02625140702..251010eb5d8 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -1169,23 +1169,17 @@ static void test_CopyFileEx(void)
@@ -1211,23 +1211,17 @@ static void test_CopyFileEx(void)
ok(hfile != INVALID_HANDLE_VALUE, "failed to open destination file, error %ld\n", GetLastError());
SetLastError(0xdeadbeef);
retok = CopyFileExA(source, dest, copy_progress_cb, hfile, NULL, 0);
@ -37,10 +37,10 @@ index 1c4cdfea1b4..0d0e6a893c9 100644
retok = CopyFileExA(source, NULL, copy_progress_cb, hfile, NULL, 0);
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
index 7b1858de424..a98a54ae9b1 100644
index cef861492e0..6f6343f6eaf 100644
--- a/dlls/kernelbase/file.c
+++ b/dlls/kernelbase/file.c
@@ -500,11 +500,16 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
@@ -496,11 +496,16 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
{
static const int buffer_size = 65536;
HANDLE h1, h2;
@ -58,7 +58,7 @@ index 7b1858de424..a98a54ae9b1 100644
if (!source || !dest)
{
@@ -526,7 +531,10 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
@@ -522,7 +527,10 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
if (flags & COPY_FILE_OPEN_SOURCE_FOR_WRITE)
FIXME("COPY_FILE_OPEN_SOURCE_FOR_WRITE is not supported\n");
@ -70,7 +70,7 @@ index 7b1858de424..a98a54ae9b1 100644
NULL, OPEN_EXISTING, 0, 0 )) == INVALID_HANDLE_VALUE)
{
WARN("Unable to open source %s\n", debugstr_w(source));
@@ -534,7 +542,7 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
@@ -530,7 +538,7 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
return FALSE;
}
@ -79,7 +79,7 @@ index 7b1858de424..a98a54ae9b1 100644
{
WARN("GetFileInformationByHandle returned error for %s\n", debugstr_w(source));
HeapFree( GetProcessHeap(), 0, buffer );
@@ -560,7 +568,11 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
@@ -556,7 +564,11 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
}
}
@ -92,7 +92,7 @@ index 7b1858de424..a98a54ae9b1 100644
(flags & COPY_FILE_FAIL_IF_EXISTS) ? CREATE_NEW : CREATE_ALWAYS,
info.FileAttributes, h1 )) == INVALID_HANDLE_VALUE)
{
@@ -570,6 +582,29 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
@@ -566,6 +578,29 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
return FALSE;
}
@ -122,7 +122,7 @@ index 7b1858de424..a98a54ae9b1 100644
while (ReadFile( h1, buffer, buffer_size, &count, NULL ) && count)
{
char *p = buffer;
@@ -579,13 +614,38 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
@@ -575,13 +610,38 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
if (!WriteFile( h2, p, count, &res, NULL ) || !res) goto done;
p += res;
count -= res;
@ -151,18 +151,18 @@ index 7b1858de424..a98a54ae9b1 100644
}
ret = TRUE;
done:
/* Maintain the timestamp of source file to destination file */
- info.FileAttributes = 0;
/* Maintain the timestamp of source file to destination file and read-only attribute */
- info.FileAttributes &= FILE_ATTRIBUTE_READONLY;
- NtSetInformationFile( h2, &io, &info, sizeof(info), FileBasicInformation );
+ basic_info.CreationTime = info.CreationTime;
+ basic_info.LastAccessTime = info.LastAccessTime;
+ basic_info.LastWriteTime = info.LastWriteTime;
+ basic_info.ChangeTime = info.ChangeTime;
+ basic_info.FileAttributes = 0;
+ basic_info.FileAttributes &= FILE_ATTRIBUTE_READONLY;
+ NtSetInformationFile( h2, &io, &basic_info, sizeof(basic_info), FileBasicInformation );
HeapFree( GetProcessHeap(), 0, buffer );
CloseHandle( h1 );
CloseHandle( h2 );
--
2.35.1
2.43.0