ntdll: Offset -1 (FILE_WRITE_TO_END_OF_FILE) is supposed to work in NtWriteFile for disk files in overlapped mode.

This commit is contained in:
Dmitry Timoshkov 2013-10-09 18:19:50 +09:00 committed by Alexandre Julliard
parent 86d63f1d5a
commit 3cae528eef
2 changed files with 2 additions and 6 deletions

View File

@ -980,7 +980,8 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
if (type == FD_TYPE_FILE)
{
if (async_write && (!offset || offset->QuadPart < 0))
if (async_write &&
(!offset || (offset->QuadPart < 0 && offset->QuadPart != (LONGLONG)-1 /* FILE_WRITE_TO_END_OF_FILE */)))
{
status = STATUS_INVALID_PARAMETER;
goto done;

View File

@ -2426,11 +2426,8 @@ todo_wine
iob.Information = -1;
offset.QuadPart = (LONGLONG)-1 /* FILE_WRITE_TO_END_OF_FILE */;
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, "DCBA", 4, &offset, NULL);
todo_wine
ok(status == STATUS_PENDING || status == STATUS_SUCCESS /* before Vista */, "expected STATUS_PENDING or STATUS_SUCCESS, got %#x\n", status);
todo_wine
ok(iob.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iob.Status);
todo_wine
ok(iob.Information == 4, "expected 4, got %lu\n", iob.Information);
off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);
@ -2448,7 +2445,6 @@ todo_wine
status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, sizeof(buf), &offset, NULL);
ok(status == STATUS_PENDING || status == STATUS_SUCCESS, "expected STATUS_PENDING or STATUS_SUCCESS, got %#x\n", status);
ok(iob.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iob.Status);
todo_wine
ok(iob.Information == sizeof(contents), "expected sizeof(contents), got %lu\n", iob.Information);
off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);
@ -2457,7 +2453,6 @@ todo_wine
ret = WaitForSingleObject(hfile, 3000);
ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret);
ok(!memcmp(contents, buf, sizeof(contents) - 4), "file contents mismatch\n");
todo_wine
ok(!memcmp(buf + sizeof(contents) - 4, "DCBA", 4), "file contents mismatch\n");
off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);