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
This commit is contained in:
Eric Pouech 2003-08-18 19:45:53 +00:00 committed by Alexandre Julliard
parent 2caec6fe3b
commit a851c88001

View File

@ -416,6 +416,19 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
ret = register_new_async(&ovp->async);
if (ret != STATUS_SUCCESS)
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;
}
switch (type)
@ -577,6 +590,19 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
ret = register_new_async(&ovp->async);
if (ret != STATUS_SUCCESS)
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;
}
switch (type)