Commit a851c880 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Regression fixes for Nt{Read|Write}File:

- actually block in TIMEOUT mode - in overlapped mode, if any data is already available then process it without returning a pending status code
parent 2caec6fe
...@@ -416,6 +416,19 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent, ...@@ -416,6 +416,19 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
ret = register_new_async(&ovp->async); ret = register_new_async(&ovp->async);
if (ret != STATUS_SUCCESS) if (ret != STATUS_SUCCESS)
return ret; return ret;
if (flags & FD_FLAG_TIMEOUT)
{
NtWaitForSingleObject(hEvent, TRUE, NULL);
NtClose(hEvent);
}
else
{
LARGE_INTEGER timeout;
/* let some APC be run, this will read some already pending data */
timeout.s.LowPart = timeout.s.HighPart = 0;
NtDelayExecution( TRUE, &timeout );
}
return io_status->u.Status; return io_status->u.Status;
} }
switch (type) switch (type)
...@@ -577,6 +590,19 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent, ...@@ -577,6 +590,19 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
ret = register_new_async(&ovp->async); ret = register_new_async(&ovp->async);
if (ret != STATUS_SUCCESS) if (ret != STATUS_SUCCESS)
return ret; return ret;
if (flags & FD_FLAG_TIMEOUT)
{
NtWaitForSingleObject(hEvent, TRUE, NULL);
NtClose(hEvent);
}
else
{
LARGE_INTEGER timeout;
/* let some APC be run, this will write as much data as possible */
timeout.s.LowPart = timeout.s.HighPart = 0;
NtDelayExecution( TRUE, &timeout );
}
return io_status->u.Status; return io_status->u.Status;
} }
switch (type) switch (type)
......
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