ntdll: NtWriteFile should fail for overlapped IO on files if offset is NULL.
This commit is contained in:
parent
6666614a19
commit
d37fac0519
|
@ -950,7 +950,15 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
|
|||
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 */
|
||||
while ((result = pwrite( unix_handle, buffer, length, offset->QuadPart )) == -1)
|
||||
|
@ -971,6 +979,7 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
|
|||
status = STATUS_SUCCESS;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
|
|
@ -2109,21 +2109,15 @@ todo_wine
|
|||
bytes = 0xdeadbeef;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = WriteFile(hfile, contents, sizeof(contents), &bytes, NULL);
|
||||
todo_wine
|
||||
ok(!ret, "WriteFile should fail\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
todo_wine
|
||||
ok(bytes == 0, "bytes %u\n", bytes);
|
||||
|
||||
iob.Status = -1;
|
||||
iob.Information = -1;
|
||||
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, contents, sizeof(contents), NULL, NULL);
|
||||
todo_wine
|
||||
ok(status == STATUS_INVALID_PARAMETER, "expected STATUS_INVALID_PARAMETER, got %#x\n", status);
|
||||
todo_wine
|
||||
ok(iob.Status == -1, "expected -1, got %#x\n", iob.Status);
|
||||
todo_wine
|
||||
ok(iob.Information == -1, "expected -1, got %ld\n", iob.Information);
|
||||
|
||||
iob.Status = -1;
|
||||
|
|
Loading…
Reference in New Issue