kernel32: Fix handling of GetOverlappedResult when status remains STATUS_PENDING.

Spotted by Michael Müller.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sebastian Lackner 2016-03-31 05:19:43 +02:00 committed by Alexandre Julliard
parent a919a02ac3
commit 455e6c64ae
2 changed files with 7 additions and 0 deletions

View File

@ -625,7 +625,9 @@ BOOL WINAPI GetOverlappedResult(HANDLE hFile, LPOVERLAPPED lpOverlapped,
if (WaitForSingleObject( lpOverlapped->hEvent ? lpOverlapped->hEvent : hFile, if (WaitForSingleObject( lpOverlapped->hEvent ? lpOverlapped->hEvent : hFile,
INFINITE ) == WAIT_FAILED) INFINITE ) == WAIT_FAILED)
return FALSE; return FALSE;
status = lpOverlapped->Internal; status = lpOverlapped->Internal;
if (status == STATUS_PENDING) status = STATUS_SUCCESS;
} }
*lpTransferred = lpOverlapped->InternalHigh; *lpTransferred = lpOverlapped->InternalHigh;

View File

@ -3361,6 +3361,11 @@ static void test_overlapped(void)
"wrong error %u\n", GetLastError() ); "wrong error %u\n", GetLastError() );
ok( r == FALSE, "should return false\n"); 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 ); ResetEvent( ov.hEvent );
SetLastError( 0xb00 ); SetLastError( 0xb00 );