Rebase against 39797dcfb250c4b4497fa003ae67b873427daa37.

This commit is contained in:
Sebastian Lackner
2015-06-11 17:12:42 +02:00
parent a6f687dcc9
commit 2672e6b4c5
18 changed files with 176 additions and 695 deletions

View File

@@ -1,18 +1,18 @@
From 3762d0ebf9a69e4d53344bbed116ce370c2de7a3 Mon Sep 17 00:00:00 2001
From 407cee7ad5b44512ec170665b78bd5243e0345d5 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: kernel32: Add support for progress callback in CopyFileEx.
---
dlls/kernel32/path.c | 68 +++++++++++++++++++++++++++++++++++++++++++---
dlls/kernel32/tests/file.c | 6 ----
2 files changed, 64 insertions(+), 10 deletions(-)
dlls/kernel32/path.c | 66 +++++++++++++++++++++++++++++++++++++++++++---
dlls/kernel32/tests/file.c | 6 -----
2 files changed, 62 insertions(+), 10 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index eae2ca9..a3add7e 100644
index 09b8b7f..18b28f6 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -1112,6 +1112,9 @@ BOOL WINAPI CopyFileExW(LPCWSTR source, LPCWSTR dest,
@@ -1130,6 +1130,9 @@ BOOL WINAPI CopyFileExW(LPCWSTR source, LPCWSTR dest,
DWORD count;
BOOL ret = FALSE;
char *buffer;
@@ -22,7 +22,7 @@ index eae2ca9..a3add7e 100644
if (!source || !dest)
{
@@ -1126,7 +1129,13 @@ BOOL WINAPI CopyFileExW(LPCWSTR source, LPCWSTR dest,
@@ -1144,7 +1147,13 @@ BOOL WINAPI CopyFileExW(LPCWSTR source, LPCWSTR dest,
TRACE("%s -> %s, %x\n", debugstr_w(source), debugstr_w(dest), flags);
@@ -37,7 +37,7 @@ index eae2ca9..a3add7e 100644
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL, OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE)
{
@@ -1162,9 +1171,13 @@ BOOL WINAPI CopyFileExW(LPCWSTR source, LPCWSTR dest,
@@ -1180,9 +1189,13 @@ BOOL WINAPI CopyFileExW(LPCWSTR source, LPCWSTR dest,
}
}
@@ -54,7 +54,7 @@ index eae2ca9..a3add7e 100644
{
WARN("Unable to open dest %s\n", debugstr_w(dest));
HeapFree( GetProcessHeap(), 0, buffer );
@@ -1172,6 +1185,31 @@ BOOL WINAPI CopyFileExW(LPCWSTR source, LPCWSTR dest,
@@ -1190,6 +1203,30 @@ BOOL WINAPI CopyFileExW(LPCWSTR source, LPCWSTR dest,
return FALSE;
}
@@ -75,8 +75,7 @@ index eae2ca9..a3add7e 100644
+ }
+ else if (cbret == PROGRESS_CANCEL)
+ {
+ FILE_DISPOSITION_INFO disp;
+ disp.DoDeleteFile = TRUE;
+ BOOLEAN disp = TRUE;
+ SetFileInformationByHandle( h2, FileDispositionInfo, &disp, sizeof(disp) );
+ SetLastError( ERROR_REQUEST_ABORTED );
+ goto done;
@@ -86,7 +85,7 @@ index eae2ca9..a3add7e 100644
while (ReadFile( h1, buffer, buffer_size, &count, NULL ) && count)
{
char *p = buffer;
@@ -1181,6 +1219,28 @@ BOOL WINAPI CopyFileExW(LPCWSTR source, LPCWSTR dest,
@@ -1199,6 +1236,27 @@ BOOL WINAPI CopyFileExW(LPCWSTR source, LPCWSTR dest,
if (!WriteFile( h2, p, count, &res, NULL ) || !res) goto done;
p += res;
count -= res;
@@ -105,8 +104,7 @@ index eae2ca9..a3add7e 100644
+ }
+ else if (cbret == PROGRESS_CANCEL)
+ {
+ FILE_DISPOSITION_INFO disp;
+ disp.DoDeleteFile = TRUE;
+ BOOLEAN disp = TRUE;
+ SetFileInformationByHandle( h2, FileDispositionInfo, &disp, sizeof(disp) );
+ SetLastError( ERROR_REQUEST_ABORTED );
+ goto done;
@@ -116,10 +114,10 @@ index eae2ca9..a3add7e 100644
}
ret = TRUE;
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index 64b0b8b..d91cab4 100644
index 53d225c..01d342d 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -1131,23 +1131,17 @@ static void test_CopyFileEx(void)
@@ -1137,23 +1137,17 @@ static void test_CopyFileEx(void)
ok(hfile != INVALID_HANDLE_VALUE, "failed to open destination file, error %d\n", GetLastError());
SetLastError(0xdeadbeef);
retok = CopyFileExA(source, dest, copy_progress_cb, hfile, NULL, 0);
@@ -144,5 +142,5 @@ index 64b0b8b..d91cab4 100644
ret = DeleteFileA(source);
--
2.4.0
2.4.2