diff --git a/server/console.c b/server/console.c index 4ed14a2d3f5..b0b6de2eef9 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 371943acee9..652da83e1e2 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 ef0a1038a50..cae75d2b690 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 5fb4e5614b9..477720f8b18 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 9c58ed77a51..e0294d946e4 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 8955df7ec2e..769a986ae21 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 1ac35cf1185..07a14502b30 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 c9cf2d56da3..3f19c77964a 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 */