Commit acb43cfe authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Wait in overlapped Read/WriteFile even when no overlapped structure is passed.

parent d362b58d
......@@ -424,6 +424,12 @@ BOOL WINAPI ReadFile( HANDLE hFile, LPVOID buffer, DWORD bytesToRead,
status = NtReadFile(hFile, hEvent, NULL, NULL, io_status, buffer, bytesToRead, poffset, NULL);
if (status == STATUS_PENDING && !overlapped)
{
WaitForSingleObject( hFile, INFINITE );
status = io_status->u.Status;
}
if (status != STATUS_PENDING && bytesRead)
*bytesRead = io_status->Information;
......@@ -510,6 +516,12 @@ BOOL WINAPI WriteFile( HANDLE hFile, LPCVOID buffer, DWORD bytesToWrite,
buffer, bytesToWrite);
}
if (status == STATUS_PENDING && !overlapped)
{
WaitForSingleObject( hFile, INFINITE );
status = piosb->u.Status;
}
if (status != STATUS_PENDING && bytesWritten)
*bytesWritten = piosb->Information;
......
......@@ -1293,10 +1293,7 @@ static DWORD CALLBACK overlapped_server(LPVOID arg)
/* This should block */
ret = ReadFile(pipe, buf, sizeof(buf), &num, NULL);
if(ret == 0)
todo_wine ok(ret == 1, "ret %d\n", ret);
else
ok(ret == 1, "ret %d\n", ret);
ok(ret == 1, "ret %d\n", ret);
DisconnectNamedPipe(pipe);
CloseHandle(ol.hEvent);
......@@ -1322,10 +1319,7 @@ static void test_overlapped(void)
Sleep(1);
ret = WriteFile(pipe, "x", 1, &num, NULL);
if(ret == 0)
todo_wine ok(ret == 1, "ret %d\n", ret);
else
ok(ret == 1, "ret %d\n", ret);
ok(ret == 1, "ret %d\n", ret);
WaitForSingleObject(thread, INFINITE);
CloseHandle(pipe);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment