[3/3] kernel32: Return success from ReadFileEx/WriteFileEx when I/O is pending.
Vincent Povirk
madewokherd at gmail.com
Thu Jun 14 15:00:26 CDT 2012
-------------- next part --------------
From 761e0cfe6b863edebc2cfc6225c5d8f6b8799845 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Thu, 14 Jun 2012 14:42:47 -0500
Subject: [PATCH 3/3] 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");
--
1.7.9.5
More information about the wine-patches
mailing list