From 82da5b425ae379825eecd6a3437a2d2e6b88890e Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 13 Mar 2016 20:28:15 +0100
Subject: ntdll/tests: Add tests for iosb.Status value after pending
 FSCTL_PIPE_LISTEN call.

---
 dlls/ntdll/tests/pipe.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/dlls/ntdll/tests/pipe.c b/dlls/ntdll/tests/pipe.c
index 7c30408..5b19ad3 100644
--- a/dlls/ntdll/tests/pipe.c
+++ b/dlls/ntdll/tests/pipe.c
@@ -277,10 +277,9 @@ static void test_overlapped(void)
     ok(!res, "NtCreateNamedPipeFile returned %x\n", res);
 
     memset(&iosb, 0x55, sizeof(iosb));
-
-/* try with event and apc */
     res = listen_pipe(hPipe, hEvent, &iosb, TRUE);
     ok(res == STATUS_PENDING, "NtFsControlFile returned %x\n", res);
+    ok(U(iosb).Status == 0x55555555, "iosb.Status got changed to %x\n", U(iosb).Status);
 
     hClient = CreateFileW(testpipe, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
     ok(hClient != INVALID_HANDLE_VALUE, "can't open pipe, GetLastError: %x\n", GetLastError());
@@ -294,9 +293,24 @@ static void test_overlapped(void)
 
     ok(ioapc_called, "IOAPC didn't run\n");
 
-    CloseHandle(hEvent);
     CloseHandle(hPipe);
     CloseHandle(hClient);
+
+    res = create_pipe(&hPipe, FILE_SHARE_READ | FILE_SHARE_WRITE, 0 /* OVERLAPPED */);
+    ok(!res, "NtCreateNamedPipeFile returned %x\n", res);
+
+    hClient = CreateFileW(testpipe, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
+    ok(hClient != INVALID_HANDLE_VALUE, "can't open pipe, GetLastError: %x\n", GetLastError());
+
+    memset(&iosb, 0x55, sizeof(iosb));
+    res = listen_pipe(hPipe, hEvent, &iosb, TRUE);
+    ok(res == STATUS_PIPE_CONNECTED, "NtFsControlFile returned %x\n", res);
+    todo_wine ok(U(iosb).Status == 0x55555555, "iosb.Status got changed to %x\n", U(iosb).Status);
+
+    CloseHandle(hPipe);
+    CloseHandle(hClient);
+
+    CloseHandle(hEvent);
 }
 
 static BOOL userapc_called;
-- 
2.7.1

