wine-staging/patches/kernel32-GetOverlappedResult/0001-kernel32-Fix-handling-of-GetOverlappedResult-when-st.patch

49 lines
1.7 KiB
Diff
Raw Normal View History

From d424317603a8ddce1475af26071374642edba457 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 13 Mar 2016 07:25:01 +0100
Subject: kernel32: Fix handling of GetOverlappedResult when status remains
STATUS_PENDING.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Spotted by Michael Müller.
---
dlls/kernel32/file.c | 2 ++
dlls/kernel32/tests/file.c | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c
index b6dba6a..a518e08 100644
--- a/dlls/kernel32/file.c
+++ b/dlls/kernel32/file.c
@@ -625,7 +625,9 @@ BOOL WINAPI GetOverlappedResult(HANDLE hFile, LPOVERLAPPED lpOverlapped,
if (WaitForSingleObject( lpOverlapped->hEvent ? lpOverlapped->hEvent : hFile,
INFINITE ) == WAIT_FAILED)
return FALSE;
+
status = lpOverlapped->Internal;
+ if (status == STATUS_PENDING) status = STATUS_SUCCESS;
}
*lpTransferred = lpOverlapped->InternalHigh;
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index 8353c21..a066692 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -3361,6 +3361,11 @@ static void test_overlapped(void)
"wrong error %u\n", GetLastError() );
ok( r == FALSE, "should return false\n");
+ r = GetOverlappedResult( 0, &ov, &result, TRUE );
+ ok( r == TRUE, "should return TRUE\n" );
+ ok( result == 0xabcd, "wrong result %u\n", result );
+ ok( ov.Internal == STATUS_PENDING, "expected STATUS_PENDING, got %08lx\n", ov.Internal );
+
ResetEvent( ov.hEvent );
SetLastError( 0xb00 );
--
2.7.1