[PATCH] ntdll: Finish serial reads of size 0 immediately.

Alex Henrie alexhenrie24 at gmail.com
Sun Feb 14 13:50:14 CST 2016


Cc: Dmitry Timoshkov <dmitry at baikal.ru>

Fixes the inifite loop reported in
https://bugs.winehq.org/show_bug.cgi?id=37115

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/kernel32/tests/comm.c | 4 ----
 dlls/ntdll/file.c          | 3 ++-
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/dlls/kernel32/tests/comm.c b/dlls/kernel32/tests/comm.c
index 97ec794..6b0c3ed 100644
--- a/dlls/kernel32/tests/comm.c
+++ b/dlls/kernel32/tests/comm.c
@@ -2151,13 +2151,9 @@ static void test_read_write(void)
                     iob.Information = -1;
                     offset.QuadPart = (LONGLONG)i;
                     status = pNtReadFile(hcom, 0, NULL, NULL, &iob, buf, 0, &offset, NULL);
-                    /* FIXME: Remove once Wine is fixed */
-                    if (status == STATUS_PENDING) WaitForSingleObject(hcom, TIMEOUT);
                     if (i >= 0)
                     {
-todo_wine
                         ok(status == STATUS_SUCCESS, "%d: expected STATUS_SUCCESS, got %#x\n", i, status);
-todo_wine
                         ok(U(iob).Status == STATUS_SUCCESS, "%d: expected STATUS_SUCCESS, got %#x\n", i, U(iob).Status);
                         ok(iob.Information == 0, "%d: expected 0, got %lu\n", i, iob.Information);
                     }
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 3883e5a..1e37ce3 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -883,7 +883,8 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
                     status = length ? STATUS_END_OF_FILE : STATUS_SUCCESS;
                     goto done;
                 case FD_TYPE_SERIAL:
-                    break;
+                    status = STATUS_SUCCESS;
+                    goto done;
                 default:
                     status = STATUS_PIPE_BROKEN;
                     goto done;
-- 
2.7.1




More information about the wine-patches mailing list