[4/5] ntdll: Make asynchronous NtWriteFile on a disk file always return STATUS_PENDING.

Dmitry Timoshkov dmitry at baikal.ru
Mon Sep 30 06:19:43 CDT 2013


---
 dlls/ntdll/file.c       | 3 ++-
 dlls/ntdll/tests/file.c | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 62ae135..772564b 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1131,7 +1131,8 @@ err:
     if (needs_close) close( unix_handle );
     if (status == STATUS_SUCCESS)
     {
-        io_status->u.Status = status;
+        if (async_write && type == FD_TYPE_FILE) status = STATUS_PENDING;
+        io_status->u.Status = STATUS_SUCCESS;
         io_status->Information = total;
         TRACE("= SUCCESS (%u)\n", total);
         if (hEvent) NtSetEvent( hEvent, NULL );
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 73b4559..c16ff2e 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -2291,7 +2291,6 @@ todo_wine
     iob.Information = -1;
     offset.QuadPart = 0;
     status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, contents, sizeof(contents), &offset, NULL);
-todo_wine
     ok(status == STATUS_PENDING || broken(status == STATUS_SUCCESS) /* see below */, "expected STATUS_PENDING, got %#x\n", status);
     ok(iob.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iob.Status);
     ok(iob.Information == sizeof(contents), "expected sizeof(contents), got %lu\n", iob.Information);
@@ -2302,7 +2301,6 @@ todo_wine
      */
     if (status != STATUS_PENDING)
     {
-todo_wine
         win_skip("broken overlapped IO implementation, update your OS\n");
         CloseHandle(hfile);
         return;
@@ -2348,7 +2346,9 @@ todo_wine
     bytes = 0xdeadbeef;
     SetLastError(0xdeadbeef);
     ret = ReadFile(hfile, buf, sizeof(buf), &bytes, &ovl);
+todo_wine
     ok(!ret, "ReadFile should fail\n");
+todo_wine
     ok(GetLastError() == ERROR_IO_PENDING || broken(GetLastError() == ERROR_HANDLE_EOF), "expected ERROR_IO_PENDING, got %d\n", GetLastError());
     /* even fully updated XP passes this test, but it looks like some VMs
      * in a testbot get never updated, so overlapped IO is broken. Instead
@@ -2357,6 +2357,7 @@ todo_wine
      */
     if (GetLastError() != ERROR_IO_PENDING)
     {
+todo_wine
         win_skip("broken overlapped IO implementation, update your OS\n");
         CloseHandle(hfile);
         return;
-- 
1.8.3.4




More information about the wine-patches mailing list