diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index a8c25d60d30fb300f03dfd2cfdc1e4d61cf01ca0..94845fa7c1987881867811e3554faf02d8e8d15e 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -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; diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 4fb5fec35be7c667d55d919a22b1b531acd1a72e..66786ef15bd60793c4a5ce31489e27c583da3b42 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -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);