ntdll: NtReadFile should fail for overlapped IO on files if offset is NULL.

This commit is contained in:
Dmitry Timoshkov 2013-09-02 18:30:27 +09:00 committed by Alexandre Julliard
parent d37fac0519
commit 2d5ecbee43
1 changed files with 23 additions and 14 deletions

View File

@ -604,7 +604,15 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
goto done; goto done;
} }
if (type == FD_TYPE_FILE && offset && offset->QuadPart != (LONGLONG)-2 /* FILE_USE_FILE_POINTER_POSITION */ ) if (type == FD_TYPE_FILE)
{
if (!(options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT)) && !offset)
{
status = STATUS_INVALID_PARAMETER;
goto done;
}
if (offset && offset->QuadPart != (LONGLONG)-2 /* FILE_USE_FILE_POINTER_POSITION */)
{ {
/* async I/O doesn't make sense on regular files */ /* async I/O doesn't make sense on regular files */
while ((result = pread( unix_handle, buffer, length, offset->QuadPart )) == -1) while ((result = pread( unix_handle, buffer, length, offset->QuadPart )) == -1)
@ -623,6 +631,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
status = total ? STATUS_SUCCESS : STATUS_END_OF_FILE; status = total ? STATUS_SUCCESS : STATUS_END_OF_FILE;
goto done; goto done;
} }
}
for (;;) for (;;)
{ {