Alexandre Julliard : server: Pass all creation arguments to the device creation functions.

Alexandre Julliard julliard at winehq.org
Wed Sep 23 15:47:13 CDT 2020


Module: wine
Branch: master
Commit: 5c4d6cf8375b69f15df4e79b23a8c95c634b7421
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5c4d6cf8375b69f15df4e79b23a8c95c634b7421

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Sep 23 11:32:47 2020 +0200

server: Pass all creation arguments to the device creation functions.

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

---

 server/console.c    |  5 +++--
 server/device.c     |  3 ++-
 server/directory.c  | 10 +++++-----
 server/file.h       | 14 +++++++++-----
 server/mailslot.c   |  5 +++--
 server/mapping.c    |  4 ++--
 server/named_pipe.c |  5 +++--
 server/sock.c       |  5 +++--
 8 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/server/console.c b/server/console.c
index 4ed14a2d3f..b0b6de2eef 100644
--- a/server/console.c
+++ b/server/console.c
@@ -2540,9 +2540,10 @@ static struct object *console_device_open_file( struct object *obj, unsigned int
     return is_output ? grab_object( current->process->console->active ) : grab_object( current->process->console );
 }
 
-struct object *create_console_device( struct object *root, const struct unicode_str *name )
+struct object *create_console_device( struct object *root, const struct unicode_str *name,
+                                      unsigned int attr, const struct security_descriptor *sd )
 {
-    return create_named_object( root, &console_device_ops, name, 0, NULL );
+    return create_named_object( root, &console_device_ops, name, attr, sd );
 }
 
 /* allocate a console for the renderer */
diff --git a/server/device.c b/server/device.c
index 371943acee..652da83e1e 100644
--- a/server/device.c
+++ b/server/device.c
@@ -720,11 +720,12 @@ static struct device *create_device( struct object *root, const struct unicode_s
 }
 
 struct object *create_unix_device( struct object *root, const struct unicode_str *name,
+                                   unsigned int attr, const struct security_descriptor *sd,
                                    const char *unix_path )
 {
     struct device *device;
 
-    if ((device = create_named_object( root, &device_ops, name, 0, NULL )))
+    if ((device = create_named_object( root, &device_ops, name, attr, sd )))
     {
         device->unix_path = strdup( unix_path );
         device->manager = NULL;  /* no manager, requests go straight to the Unix device */
diff --git a/server/directory.c b/server/directory.c
index ef0a1038a5..cae75d2b69 100644
--- a/server/directory.c
+++ b/server/directory.c
@@ -423,11 +423,11 @@ void init_directories(void)
     make_object_static( &dir_objtype->obj );
 
     /* devices */
-    named_pipe_device = create_named_pipe_device( &dir_device->obj, &named_pipe_str );
-    mailslot_device   = create_mailslot_device( &dir_device->obj, &mailslot_str );
-    console_device    = create_console_device( &dir_device->obj, &condrv_str );
-    socket_device     = create_socket_device( &dir_device->obj, &afd_str );
-    null_device       = create_unix_device( &dir_device->obj, &null_str, "/dev/null" );
+    named_pipe_device = create_named_pipe_device( &dir_device->obj, &named_pipe_str, 0, NULL );
+    mailslot_device   = create_mailslot_device( &dir_device->obj, &mailslot_str, 0, NULL );
+    console_device    = create_console_device( &dir_device->obj, &condrv_str, 0, NULL );
+    socket_device     = create_socket_device( &dir_device->obj, &afd_str, 0, NULL );
+    null_device       = create_unix_device( &dir_device->obj, &null_str, 0, NULL, "/dev/null" );
     make_object_static( named_pipe_device );
     make_object_static( mailslot_device );
     make_object_static( null_device );
diff --git a/server/file.h b/server/file.h
index 5fb4e5614b..477720f8b1 100644
--- a/server/file.h
+++ b/server/file.h
@@ -176,12 +176,16 @@ extern struct object *create_user_data_mapping( struct object *root, const struc
 
 /* device functions */
 
-extern struct object *create_named_pipe_device( struct object *root, const struct unicode_str *name );
-extern struct object *create_mailslot_device( struct object *root, const struct unicode_str *name );
-extern struct object *create_console_device( struct object *root, const struct unicode_str *name );
-extern struct object *create_socket_device( struct object *root, const struct unicode_str *name );
+extern struct object *create_named_pipe_device( struct object *root, const struct unicode_str *name,
+                                                unsigned int attr, const struct security_descriptor *sd );
+extern struct object *create_mailslot_device( struct object *root, const struct unicode_str *name,
+                                              unsigned int attr, const struct security_descriptor *sd );
+extern struct object *create_console_device( struct object *root, const struct unicode_str *name,
+                                              unsigned int attr, const struct security_descriptor *sd );
+extern struct object *create_socket_device( struct object *root, const struct unicode_str *name,
+                                              unsigned int attr, const struct security_descriptor *sd );
 extern struct object *create_unix_device( struct object *root, const struct unicode_str *name,
-                                          const char *unix_path );
+                                          unsigned int attr, const struct security_descriptor *sd, const char *unix_path );
 
 /* change notification functions */
 
diff --git a/server/mailslot.c b/server/mailslot.c
index 9c58ed77a5..e0294d946e 100644
--- a/server/mailslot.c
+++ b/server/mailslot.c
@@ -433,11 +433,12 @@ static void mailslot_device_destroy( struct object *obj )
     free( device->mailslots );
 }
 
-struct object *create_mailslot_device( struct object *root, const struct unicode_str *name )
+struct object *create_mailslot_device( struct object *root, const struct unicode_str *name,
+                                       unsigned int attr, const struct security_descriptor *sd )
 {
     struct mailslot_device *dev;
 
-    if ((dev = create_named_object( root, &mailslot_device_ops, name, 0, NULL )) &&
+    if ((dev = create_named_object( root, &mailslot_device_ops, name, attr, sd )) &&
         get_error() != STATUS_OBJECT_NAME_EXISTS)
     {
         dev->mailslots = NULL;
diff --git a/server/mapping.c b/server/mapping.c
index 8955df7ec2..769a986ae2 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -964,8 +964,8 @@ struct object *create_user_data_mapping( struct object *root, const struct unico
     void *ptr;
     struct mapping *mapping;
 
-    if (!(mapping = create_mapping( root, name, OBJ_OPENIF, sizeof(KSHARED_USER_DATA),
-                                    SEC_COMMIT, 0, FILE_READ_DATA | FILE_WRITE_DATA, NULL ))) return NULL;
+    if (!(mapping = create_mapping( root, name, attr, sizeof(KSHARED_USER_DATA),
+                                    SEC_COMMIT, 0, FILE_READ_DATA | FILE_WRITE_DATA, sd ))) return NULL;
     ptr = mmap( NULL, mapping->size, PROT_WRITE, MAP_SHARED, get_unix_fd( mapping->fd ), 0 );
     if (ptr != MAP_FAILED)
     {
diff --git a/server/named_pipe.c b/server/named_pipe.c
index 1ac35cf118..07a14502b3 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -507,11 +507,12 @@ static void named_pipe_device_destroy( struct object *obj )
     free( device->pipes );
 }
 
-struct object *create_named_pipe_device( struct object *root, const struct unicode_str *name )
+struct object *create_named_pipe_device( struct object *root, const struct unicode_str *name,
+                                         unsigned int attr, const struct security_descriptor *sd )
 {
     struct named_pipe_device *dev;
 
-    if ((dev = create_named_object( root, &named_pipe_device_ops, name, 0, NULL )) &&
+    if ((dev = create_named_object( root, &named_pipe_device_ops, name, attr, sd )) &&
         get_error() != STATUS_OBJECT_NAME_EXISTS)
     {
         dev->pipes = NULL;
diff --git a/server/sock.c b/server/sock.c
index c9cf2d56da..3f19c77964 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -1247,9 +1247,10 @@ static struct object *socket_device_open_file( struct object *obj, unsigned int
     return &sock->obj;
 }
 
-struct object *create_socket_device( struct object *root, const struct unicode_str *name )
+struct object *create_socket_device( struct object *root, const struct unicode_str *name,
+                                     unsigned int attr, const struct security_descriptor *sd )
 {
-    return create_named_object( root, &socket_device_ops, name, 0, NULL );
+    return create_named_object( root, &socket_device_ops, name, attr, sd );
 }
 
 /* accept a socket */




More information about the wine-cvs mailing list