[PATCH v2 2/2] server: FSCTL_PIPE_LISTEN on a pipe client should return STATUS_ILLEGAL_FUNCTION.

Zebediah Figura z.figura12 at gmail.com
Mon Oct 9 11:48:04 CDT 2017


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/kernel32/tests/pipe.c | 6 ++++++
 dlls/ntdll/tests/pipe.c    | 3 +++
 server/named_pipe.c        | 3 +++
 3 files changed, 12 insertions(+)

diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c
index 13afa10..9ecb916 100644
--- a/dlls/kernel32/tests/pipe.c
+++ b/dlls/kernel32/tests/pipe.c
@@ -224,6 +224,12 @@ static void test_CreateNamedPipe(int pipemode)
 
     ok(GetLastError() == ERROR_SEM_TIMEOUT, "wrong error %u\n", GetLastError());
 
+    /* Test ConnectNamedPipe() in both directions */
+    ok(!ConnectNamedPipe(hnp, NULL), "ConnectNamedPipe(server) succeeded\n");
+    ok(GetLastError() == ERROR_PIPE_CONNECTED, "expected ERROR_PIPE_CONNECTED, got %u\n", GetLastError());
+    ok(!ConnectNamedPipe(hFile, NULL), "ConnectNamedPipe(client) succeeded\n");
+    ok(GetLastError() == ERROR_INVALID_FUNCTION, "expected ERROR_INVALID_FUNCTION, got %u\n", GetLastError());
+
     /* don't try to do i/o if one side couldn't be opened, as it hangs */
     if (hFile != INVALID_HANDLE_VALUE) {
         HANDLE hFile2;
diff --git a/dlls/ntdll/tests/pipe.c b/dlls/ntdll/tests/pipe.c
index 13b77d8..ca195bf 100644
--- a/dlls/ntdll/tests/pipe.c
+++ b/dlls/ntdll/tests/pipe.c
@@ -256,6 +256,9 @@ static void test_create(void)
                    res, access[k], sharing[j]);
                 ok(info.NamedPipeConfiguration == pipe_config[j], "wrong duplex status for pipe: %d, expected %d\n",
                    info.NamedPipeConfiguration, pipe_config[j]);
+
+                res = listen_pipe(hclient, hEvent, &iosb, FALSE);
+                ok(res == STATUS_ILLEGAL_FUNCTION, "expected STATUS_ILLEGAL_FUNCTION, got %x\n", res);
                 CloseHandle(hclient);
             }
 
diff --git a/server/named_pipe.c b/server/named_pipe.c
index b5738ad..746bf10 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -910,6 +910,9 @@ static int pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *as
 
     switch(code)
     {
+    case FSCTL_PIPE_LISTEN:
+        set_error( STATUS_ILLEGAL_FUNCTION );
+        return 0;
     case FSCTL_PIPE_PEEK:
         return pipe_end_peek( &client->pipe_end );
 
-- 
2.7.4




More information about the wine-patches mailing list