Vincent Povirk : kernel32: Return success from ReadFileEx/ WriteFileEx when I/O is pending.

Alexandre Julliard julliard at winehq.org
Fri Jun 15 13:34:38 CDT 2012


Module: wine
Branch: master
Commit: 14404713de18cc04e2f9b91603c4c68397a16820
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=14404713de18cc04e2f9b91603c4c68397a16820

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Thu Jun 14 14:42:47 2012 -0500

kernel32: Return success from ReadFileEx/WriteFileEx when I/O is pending.

---

 dlls/kernel32/file.c       |   10 +++++++---
 dlls/kernel32/tests/pipe.c |    4 ++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c
index 089f693..18ed188 100644
--- a/dlls/kernel32/file.c
+++ b/dlls/kernel32/file.c
@@ -352,7 +352,7 @@ BOOL WINAPI ReadFileEx(HANDLE hFile, LPVOID buffer, DWORD bytesToRead,
     status = NtReadFile(hFile, NULL, FILE_ReadWriteApc, lpCompletionRoutine,
                         io_status, buffer, bytesToRead, &offset, NULL);
 
-    if (status)
+    if (status && status != STATUS_PENDING)
     {
         SetLastError( RtlNtStatusToDosError(status) );
         return FALSE;
@@ -484,8 +484,12 @@ BOOL WINAPI WriteFileEx(HANDLE hFile, LPCVOID buffer, DWORD bytesToWrite,
     status = NtWriteFile(hFile, NULL, FILE_ReadWriteApc, lpCompletionRoutine,
                          io_status, buffer, bytesToWrite, &offset, NULL);
 
-    if (status) SetLastError( RtlNtStatusToDosError(status) );
-    return !status;
+    if (status && status != STATUS_PENDING)
+    {
+        SetLastError( RtlNtStatusToDosError(status) );
+        return FALSE;
+    }
+    return TRUE;
 }
 
 
diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c
index 64af60331..1a33e10 100644
--- a/dlls/kernel32/tests/pipe.c
+++ b/dlls/kernel32/tests/pipe.c
@@ -1795,7 +1795,7 @@ static void test_readfileex_pending(void)
     completion_called = 0;
     ResetEvent(event);
     ret = ReadFileEx(server, read_buf, sizeof(read_buf), &overlapped, completion_routine);
-    todo_wine ok(ret == TRUE, "ReadFileEx failed, err=%i\n", GetLastError());
+    ok(ret == TRUE, "ReadFileEx failed, err=%i\n", GetLastError());
     ok(completion_called == 0, "completion routine called before ReadFileEx returned\n");
 
     ret = WriteFile(client, test_string, sizeof(test_string), &num_bytes, NULL);
@@ -1837,7 +1837,7 @@ static void test_readfileex_pending(void)
         ok(completion_lpoverlapped == &overlapped, "completion called with wrong overlapped pointer\n");
     }
 
-    todo_wine ok(ret == TRUE, "WriteFileEx failed, err=%i\n", err);
+    ok(ret == TRUE, "WriteFileEx failed, err=%i\n", err);
     ok(completion_called == 0, "completion routine called but wait timed out\n");
     ok(completion_errorcode == 0, "completion called with error %x\n", completion_errorcode);
     ok(completion_lpoverlapped == &overlapped, "completion called with wrong overlapped pointer\n");




More information about the wine-cvs mailing list