ntdll: Offset -1 (FILE_WRITE_TO_END_OF_FILE) is supposed to work in NtWriteFile for disk files in overlapped mode.
Dmitry Timoshkov
dmitry at baikal.ru
Wed Oct 9 04:19:50 CDT 2013
---
dlls/ntdll/file.c | 3 ++-
dlls/ntdll/tests/file.c | 5 -----
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index a8c25d6..94845fa 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 4fb5fec..66786ef 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);
--
1.8.3.4
More information about the wine-patches
mailing list