Alexandre Julliard : server: Use the generic named object functions for named pipes.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Feb 8 10:09:20 CST 2016


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Feb  8 14:30:07 2016 +0900

server: Use the generic named object functions for named pipes.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 server/named_pipe.c | 50 +++-----------------------------------------------
 1 file changed, 3 insertions(+), 47 deletions(-)

diff --git a/server/named_pipe.c b/server/named_pipe.c
index 1e4169d..934b6a3 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -668,47 +668,6 @@ static obj_handle_t pipe_server_ioctl( struct fd *fd, ioctl_code_t code, const a
     }
 }
 
-static struct named_pipe *create_named_pipe( struct directory *root, const struct unicode_str *name,
-                                             unsigned int attr, const struct security_descriptor *sd )
-{
-    struct object *obj;
-    struct named_pipe *pipe = NULL;
-    struct unicode_str new_name;
-
-    if (!name || !name->len)
-    {
-        if ((pipe = alloc_object( &named_pipe_ops ))) clear_error();
-        return pipe;
-    }
-
-    if (!(obj = find_object_dir( root, name, attr, &new_name )))
-    {
-        set_error( STATUS_OBJECT_NAME_INVALID );
-        return NULL;
-    }
-    if (!new_name.len)
-    {
-        if (attr & OBJ_OPENIF && obj->ops == &named_pipe_ops)
-            set_error( STATUS_OBJECT_NAME_EXISTS );
-        else
-        {
-            release_object( obj );
-            obj = NULL;
-            if (attr & OBJ_OPENIF)
-                set_error( STATUS_OBJECT_TYPE_MISMATCH );
-            else
-                set_error( STATUS_OBJECT_NAME_COLLISION );
-        }
-        return (struct named_pipe *)obj;
-    }
-
-    if ((pipe = create_object( obj, &named_pipe_ops, &new_name )))
-        clear_error();
-
-    release_object( obj );
-    return pipe;
-}
-
 static struct pipe_server *get_pipe_server_obj( struct process *process,
                                 obj_handle_t handle, unsigned int access )
 {
@@ -896,11 +855,8 @@ static obj_handle_t named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code,
             }
             name.str = buffer->Name;
             name.len = (buffer->NameLength / sizeof(WCHAR)) * sizeof(WCHAR);
-            if (!(pipe = (struct named_pipe *)find_object( device->pipes, &name, OBJ_CASE_INSENSITIVE )))
-            {
-                set_error( STATUS_OBJECT_NAME_NOT_FOUND );
-                return 0;
-            }
+            if (!(pipe = open_named_object( &device->obj, &named_pipe_ops, &name, 0 ))) return 0;
+
             if (!(server = find_available_server( pipe )))
             {
                 struct async *async;
@@ -957,7 +913,7 @@ DECL_HANDLER(create_named_pipe)
         else if (!(root = get_directory_obj( current->process, objattr->rootdir, 0 ))) return;
     }
 
-    pipe = create_named_pipe( root, &name, objattr->attributes | OBJ_OPENIF, sd );
+    pipe = create_named_object_dir( root, &name, objattr->attributes | OBJ_OPENIF, &named_pipe_ops );
 
     if (root) release_object( root );
     if (!pipe) return;




More information about the wine-cvs mailing list