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

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-09-23 11:32:47 +02:00
parent 1a7b256f7c
commit 5c4d6cf837
8 changed files with 30 additions and 21 deletions

View File

@ -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 */

View File

@ -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 */

View File

@ -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 );

View File

@ -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 */

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -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 */