Bernhard Loos : server: Sharing 0 is not allowed for named pipes.

Alexandre Julliard julliard at winehq.org
Tue Sep 27 13:00:07 CDT 2011


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

Author: Bernhard Loos <bernhardloos at googlemail.com>
Date:   Mon Sep 26 13:57:38 2011 +0200

server: Sharing 0 is not allowed for named pipes.

---

 dlls/ntdll/tests/pipe.c |    2 +-
 server/named_pipe.c     |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/dlls/ntdll/tests/pipe.c b/dlls/ntdll/tests/pipe.c
index 6909882..358e702 100644
--- a/dlls/ntdll/tests/pipe.c
+++ b/dlls/ntdll/tests/pipe.c
@@ -150,7 +150,7 @@ static void test_create_invalid(void)
 /* create a pipe with sharing = 0 */
     res = pNtCreateNamedPipeFile(&handle, FILE_READ_ATTRIBUTES | SYNCHRONIZE, &attr, &iosb, 0, 2 /*FILE_CREATE*/,
                                  0, 1, 0, 0, 0xFFFFFFFF, 500, 500, &timeout);
-    todo_wine ok(res == STATUS_INVALID_PARAMETER, "NtCreateNamedPipeFile returned %x\n", res);
+    ok(res == STATUS_INVALID_PARAMETER, "NtCreateNamedPipeFile returned %x\n", res);
     if (!res)
         CloseHandle(handle);
 
diff --git a/server/named_pipe.c b/server/named_pipe.c
index 0f89f5b..66664bb 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -940,6 +940,12 @@ DECL_HANDLER(create_named_pipe)
     struct unicode_str name;
     struct directory *root = NULL;
 
+    if (!req->sharing || (req->sharing & ~(FILE_SHARE_READ | FILE_SHARE_WRITE)))
+    {
+        set_error( STATUS_INVALID_PARAMETER );
+        return;
+    }
+
     reply->handle = 0;
     get_req_unicode_str( &name );
     if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 )))




More information about the wine-cvs mailing list