From ff9d90bbb0116e62a69e9accb13d1327a1e890c8 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 12 Feb 2016 21:00:41 +0900 Subject: [PATCH] server: Use a standard object for object attribute roots instead of a directory. Signed-off-by: Alexandre Julliard --- server/completion.c | 6 ++--- server/device.c | 12 ++++----- server/directory.c | 66 +++++++++++++++++++++------------------------ server/event.c | 12 ++++----- server/file.h | 6 ++--- server/mailslot.c | 12 ++++----- server/mapping.c | 7 +++-- server/mutex.c | 6 ++--- server/named_pipe.c | 10 +++---- server/object.h | 11 +++----- server/process.c | 6 ++--- server/request.c | 4 +-- server/request.h | 2 +- server/semaphore.c | 6 ++--- server/symlink.c | 6 ++--- server/timer.c | 6 ++--- server/winstation.c | 8 +++--- 17 files changed, 89 insertions(+), 97 deletions(-) diff --git a/server/completion.c b/server/completion.c index 759c6e2f5d5..575c51026ef 100644 --- a/server/completion.c +++ b/server/completion.c @@ -130,13 +130,13 @@ static unsigned int completion_map_access( struct object *obj, unsigned int acce return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL); } -static struct completion *create_completion( struct directory *root, const struct unicode_str *name, +static struct completion *create_completion( struct object *root, const struct unicode_str *name, unsigned int attr, unsigned int concurrent, const struct security_descriptor *sd ) { struct completion *completion; - if ((completion = create_named_object_dir( root, name, attr, &completion_ops ))) + if ((completion = create_named_object( root, &completion_ops, name, attr ))) { if (get_error() != STATUS_OBJECT_NAME_EXISTS) { @@ -179,7 +179,7 @@ DECL_HANDLER(create_completion) { struct completion *completion; struct unicode_str name; - struct directory *root; + struct object *root; const struct security_descriptor *sd; const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root ); diff --git a/server/device.c b/server/device.c index a8f6f5d97b6..259efcc83fb 100644 --- a/server/device.c +++ b/server/device.c @@ -599,12 +599,12 @@ static obj_handle_t device_file_ioctl( struct fd *fd, ioctl_code_t code, const a return handle; } -static struct device *create_device( struct directory *root, const struct unicode_str *name, +static struct device *create_device( struct object *root, const struct unicode_str *name, struct device_manager *manager, unsigned int attr ) { struct device *device; - if ((device = create_named_object_dir( root, name, attr, &device_ops ))) + if ((device = create_named_object( root, &device_ops, name, attr ))) { if (get_error() != STATUS_OBJECT_NAME_EXISTS) { @@ -618,12 +618,12 @@ static struct device *create_device( struct directory *root, const struct unicod return device; } -struct device *create_unix_device( struct directory *root, const struct unicode_str *name, +struct device *create_unix_device( struct object *root, const struct unicode_str *name, const char *unix_path ) { struct device *device; - if ((device = create_named_object_dir( root, name, 0, &device_ops ))) + if ((device = create_named_object( root, &device_ops, name, 0 ))) { device->unix_path = strdup( unix_path ); device->manager = NULL; /* no manager, requests go straight to the Unix device */ @@ -718,13 +718,13 @@ DECL_HANDLER(create_device) struct device *device; struct unicode_str name = get_req_unicode_str(); struct device_manager *manager; - struct directory *root = NULL; + struct object *root = NULL; if (!(manager = (struct device_manager *)get_handle_obj( current->process, req->manager, 0, &device_manager_ops ))) return; - if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 ))) + if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir ))) { release_object( manager ); return; diff --git a/server/directory.c b/server/directory.c index 6a5af9a5479..0d4074de7f0 100644 --- a/server/directory.c +++ b/server/directory.c @@ -198,13 +198,13 @@ static void directory_destroy( struct object *obj ) free( dir->entries ); } -static struct directory *create_directory( struct directory *root, const struct unicode_str *name, +static struct directory *create_directory( struct object *root, const struct unicode_str *name, unsigned int attr, unsigned int hash_size, const struct security_descriptor *sd ) { struct directory *dir; - if ((dir = create_named_object_dir( root, name, attr, &directory_ops )) && + if ((dir = create_named_object( root, &directory_ops, name, attr )) && get_error() != STATUS_OBJECT_NAME_EXISTS) { if (!(dir->entries = create_namespace( hash_size ))) @@ -223,16 +223,10 @@ struct object *get_root_directory(void) return grab_object( root_directory ); } -struct directory *get_directory_obj( struct process *process, obj_handle_t handle, unsigned int access ) +/* return a directory object for creating/opening some object; no access rights are required */ +struct object *get_directory_obj( struct process *process, obj_handle_t handle ) { - return (struct directory *)get_handle_obj( process, handle, access, &directory_ops ); -} - -/* create a named (if name is present) or unnamed object. */ -void *create_named_object_dir( struct directory *root, const struct unicode_str *name, - unsigned int attributes, const struct object_ops *ops ) -{ - return create_named_object( &root->obj, ops, name, attributes ); + return get_handle_obj( process, handle, 0, &directory_ops ); } /* retrieve an object type, creating it if needed */ @@ -240,7 +234,7 @@ struct object_type *get_object_type( const struct unicode_str *name ) { struct object_type *type; - if ((type = create_named_object_dir( dir_objtype, name, OBJ_OPENIF, &object_type_ops ))) + if ((type = create_named_object( &dir_objtype->obj, &object_type_ops, name, OBJ_OPENIF ))) { if (get_error() != STATUS_OBJECT_NAME_EXISTS) { @@ -335,13 +329,13 @@ void init_directories(void) unsigned int i; root_directory = create_directory( NULL, NULL, 0, HASH_SIZE, NULL ); - dir_driver = create_directory( root_directory, &dir_driver_str, 0, HASH_SIZE, NULL ); - dir_device = create_directory( root_directory, &dir_device_str, 0, HASH_SIZE, NULL ); - dir_objtype = create_directory( root_directory, &dir_objtype_str, 0, HASH_SIZE, NULL ); - dir_sessions = create_directory( root_directory, &dir_sessions_str, 0, HASH_SIZE, NULL ); - dir_kernel = create_directory( root_directory, &dir_kernel_str, 0, HASH_SIZE, NULL ); - dir_windows = create_directory( root_directory, &dir_windows_str, 0, HASH_SIZE, NULL ); - dir_winstation = create_directory( dir_windows, &dir_winstations_str, 0, HASH_SIZE, NULL ); + dir_driver = create_directory( &root_directory->obj, &dir_driver_str, 0, HASH_SIZE, NULL ); + dir_device = create_directory( &root_directory->obj, &dir_device_str, 0, HASH_SIZE, NULL ); + dir_objtype = create_directory( &root_directory->obj, &dir_objtype_str, 0, HASH_SIZE, NULL ); + dir_sessions = create_directory( &root_directory->obj, &dir_sessions_str, 0, HASH_SIZE, NULL ); + dir_kernel = create_directory( &root_directory->obj, &dir_kernel_str, 0, HASH_SIZE, NULL ); + dir_windows = create_directory( &root_directory->obj, &dir_windows_str, 0, HASH_SIZE, NULL ); + dir_winstation = create_directory( &dir_windows->obj, &dir_winstations_str, 0, HASH_SIZE, NULL ); make_object_static( &root_directory->obj ); make_object_static( &dir_driver->obj ); make_object_static( &dir_objtype->obj ); @@ -352,20 +346,20 @@ void init_directories(void) dir_basenamed = create_directory( NULL, &dir_basenamed_str, 0, 37, NULL ); /* devices */ - create_named_pipe_device( dir_device, &named_pipe_str ); - create_mailslot_device( dir_device, &mailslot_str ); - create_unix_device( dir_device, &null_str, "/dev/null" ); + create_named_pipe_device( &dir_device->obj, &named_pipe_str ); + create_mailslot_device( &dir_device->obj, &mailslot_str ); + create_unix_device( &dir_device->obj, &null_str, "/dev/null" ); /* symlinks */ - link_dosdev = create_symlink( root_directory, &link_dosdev_str, 0, &dir_global_str, NULL ); - link_global1 = create_symlink( dir_global, &link_global_str, 0, &dir_global_str, NULL ); - link_global2 = create_symlink( dir_basenamed, &link_global_str, 0, &dir_basenamed_str, NULL ); - link_local = create_symlink( dir_basenamed, &link_local_str, 0, &dir_basenamed_str, NULL ); - link_nul = create_symlink( dir_global, &link_nul_str, 0, &dir_null_str, NULL ); - link_pipe = create_symlink( dir_global, &link_pipe_str, 0, &dir_named_pipe_str, NULL ); - link_mailslot = create_symlink( dir_global, &link_mailslot_str, 0, &dir_mailslot_str, NULL ); - link_0 = create_symlink( dir_sessions, &link_0_str, 0, &dir_basenamed_str, NULL ); - link_session = create_symlink( dir_basenamed, &link_session_str, 0, &link_sessions_str, NULL ); + link_dosdev = create_symlink( &root_directory->obj, &link_dosdev_str, 0, &dir_global_str, NULL ); + link_global1 = create_symlink( &dir_global->obj, &link_global_str, 0, &dir_global_str, NULL ); + link_global2 = create_symlink( &dir_basenamed->obj, &link_global_str, 0, &dir_basenamed_str, NULL ); + link_local = create_symlink( &dir_basenamed->obj, &link_local_str, 0, &dir_basenamed_str, NULL ); + link_nul = create_symlink( &dir_global->obj, &link_nul_str, 0, &dir_null_str, NULL ); + link_pipe = create_symlink( &dir_global->obj, &link_pipe_str, 0, &dir_named_pipe_str, NULL ); + link_mailslot = create_symlink( &dir_global->obj, &link_mailslot_str, 0, &dir_mailslot_str, NULL ); + link_0 = create_symlink( &dir_sessions->obj, &link_0_str, 0, &dir_basenamed_str, NULL ); + link_session = create_symlink( &dir_basenamed->obj, &link_session_str, 0, &link_sessions_str, NULL ); make_object_static( (struct object *)link_dosdev ); make_object_static( (struct object *)link_global1 ); make_object_static( (struct object *)link_global2 ); @@ -379,10 +373,10 @@ void init_directories(void) /* events */ for (i = 0; i < sizeof(kernel_events)/sizeof(kernel_events[0]); i++) { - struct event *event = create_event( dir_kernel, &kernel_events[i], 0, 1, 0, NULL ); + struct event *event = create_event( &dir_kernel->obj, &kernel_events[i], 0, 1, 0, NULL ); make_object_static( (struct object *)event ); } - keyed_event = create_keyed_event( dir_kernel, &keyed_event_crit_sect_str, 0, NULL ); + keyed_event = create_keyed_event( &dir_kernel->obj, &keyed_event_crit_sect_str, 0, NULL ); make_object_static( (struct object *)keyed_event ); /* the objects hold references so we can release these directories */ @@ -398,7 +392,8 @@ void init_directories(void) DECL_HANDLER(create_directory) { struct unicode_str name; - struct directory *dir, *root; + struct object *root; + struct directory *dir; const struct security_descriptor *sd; const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root ); @@ -425,7 +420,8 @@ DECL_HANDLER(open_directory) /* get a directory entry by index */ DECL_HANDLER(get_directory_entry) { - struct directory *dir = get_directory_obj( current->process, req->handle, DIRECTORY_QUERY ); + struct directory *dir = (struct directory *)get_handle_obj( current->process, req->handle, + DIRECTORY_QUERY, &directory_ops ); if (dir) { struct object *obj = find_object_index( dir->entries, req->index ); diff --git a/server/event.c b/server/event.c index c9a0ebbe319..84eddbb6ca7 100644 --- a/server/event.c +++ b/server/event.c @@ -106,13 +106,13 @@ static const struct object_ops keyed_event_ops = }; -struct event *create_event( struct directory *root, const struct unicode_str *name, +struct event *create_event( struct object *root, const struct unicode_str *name, unsigned int attr, int manual_reset, int initial_state, const struct security_descriptor *sd ) { struct event *event; - if ((event = create_named_object_dir( root, name, attr, &event_ops ))) + if ((event = create_named_object( root, &event_ops, name, attr ))) { if (get_error() != STATUS_OBJECT_NAME_EXISTS) { @@ -206,12 +206,12 @@ static int event_signal( struct object *obj, unsigned int access ) return 1; } -struct keyed_event *create_keyed_event( struct directory *root, const struct unicode_str *name, +struct keyed_event *create_keyed_event( struct object *root, const struct unicode_str *name, unsigned int attr, const struct security_descriptor *sd ) { struct keyed_event *event; - if ((event = create_named_object_dir( root, name, attr, &keyed_event_ops ))) + if ((event = create_named_object( root, &keyed_event_ops, name, attr ))) { if (get_error() != STATUS_OBJECT_NAME_EXISTS) { @@ -284,7 +284,7 @@ DECL_HANDLER(create_event) { struct event *event; struct unicode_str name; - struct directory *root; + struct object *root; const struct security_descriptor *sd; const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root ); @@ -355,7 +355,7 @@ DECL_HANDLER(create_keyed_event) { struct keyed_event *event; struct unicode_str name; - struct directory *root; + struct object *root; const struct security_descriptor *sd; const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root ); diff --git a/server/file.h b/server/file.h index b59de1c3c76..2a72568276c 100644 --- a/server/file.h +++ b/server/file.h @@ -141,9 +141,9 @@ extern int get_page_size(void); /* device functions */ -extern void create_named_pipe_device( struct directory *root, const struct unicode_str *name ); -extern void create_mailslot_device( struct directory *root, const struct unicode_str *name ); -extern struct device *create_unix_device( struct directory *root, const struct unicode_str *name, +extern void create_named_pipe_device( struct object *root, const struct unicode_str *name ); +extern void create_mailslot_device( struct object *root, const struct unicode_str *name ); +extern struct device *create_unix_device( struct object *root, const struct unicode_str *name, const char *unix_path ); /* change notification functions */ diff --git a/server/mailslot.c b/server/mailslot.c index 262c4f66629..05a357b9fe7 100644 --- a/server/mailslot.c +++ b/server/mailslot.c @@ -397,11 +397,11 @@ static enum server_fd_type mailslot_device_get_fd_type( struct fd *fd ) return FD_TYPE_DEVICE; } -void create_mailslot_device( struct directory *root, const struct unicode_str *name ) +void create_mailslot_device( struct object *root, const struct unicode_str *name ) { struct mailslot_device *dev; - if ((dev = create_named_object_dir( root, name, 0, &mailslot_device_ops )) && + if ((dev = create_named_object( root, &mailslot_device_ops, name, 0 )) && get_error() != STATUS_OBJECT_NAME_EXISTS) { dev->mailslots = NULL; @@ -415,7 +415,7 @@ void create_mailslot_device( struct directory *root, const struct unicode_str *n if (dev) make_object_static( &dev->obj ); } -static struct mailslot *create_mailslot( struct directory *root, +static struct mailslot *create_mailslot( struct object *root, const struct unicode_str *name, unsigned int attr, int max_msgsize, timeout_t read_timeout, const struct security_descriptor *sd ) @@ -423,7 +423,7 @@ static struct mailslot *create_mailslot( struct directory *root, struct mailslot *mailslot; int fds[2]; - if (!(mailslot = create_named_object_dir( root, name, attr, &mailslot_ops ))) return NULL; + if (!(mailslot = create_named_object( root, &mailslot_ops, name, attr ))) return NULL; mailslot->fd = NULL; mailslot->write_fd = -1; @@ -497,7 +497,7 @@ DECL_HANDLER(create_mailslot) { struct mailslot *mailslot; struct unicode_str name; - struct directory *root; + struct object *root; const struct security_descriptor *sd; const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root ); @@ -510,7 +510,7 @@ DECL_HANDLER(create_mailslot) set_error( STATUS_OBJECT_PATH_SYNTAX_BAD ); return; } - else if (!(root = get_directory_obj( current->process, objattr->rootdir, 0 ))) return; + if (!(root = get_directory_obj( current->process, objattr->rootdir ))) return; } if ((mailslot = create_mailslot( root, &name, objattr->attributes, req->max_msgsize, diff --git a/server/mapping.c b/server/mapping.c index 4384cecd0a9..1be3beecc11 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -470,7 +470,7 @@ static unsigned int get_image_params( struct mapping *mapping, int unix_fd, int return STATUS_INVALID_FILE_FOR_SECTION; } -static struct object *create_mapping( struct directory *root, const struct unicode_str *name, +static struct object *create_mapping( struct object *root, const struct unicode_str *name, unsigned int attr, mem_size_t size, int protect, obj_handle_t handle, const struct security_descriptor *sd ) { @@ -483,7 +483,7 @@ static struct object *create_mapping( struct directory *root, const struct unico if (!page_mask) page_mask = sysconf( _SC_PAGESIZE ) - 1; - if (!(mapping = create_named_object_dir( root, name, attr, &mapping_ops ))) + if (!(mapping = create_named_object( root, &mapping_ops, name, attr ))) return NULL; if (get_error() == STATUS_OBJECT_NAME_EXISTS) return &mapping->obj; /* Nothing else to do */ @@ -661,9 +661,8 @@ int get_page_size(void) /* create a file mapping */ DECL_HANDLER(create_mapping) { - struct object *obj; + struct object *root, *obj; struct unicode_str name; - struct directory *root; const struct security_descriptor *sd; const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root ); diff --git a/server/mutex.c b/server/mutex.c index ca0da593f17..c70b437ef5c 100644 --- a/server/mutex.c +++ b/server/mutex.c @@ -99,12 +99,12 @@ static void do_release( struct mutex *mutex ) wake_up( &mutex->obj, 0 ); } -static struct mutex *create_mutex( struct directory *root, const struct unicode_str *name, +static struct mutex *create_mutex( struct object *root, const struct unicode_str *name, unsigned int attr, int owned, const struct security_descriptor *sd ) { struct mutex *mutex; - if ((mutex = create_named_object_dir( root, name, attr, &mutex_ops ))) + if ((mutex = create_named_object( root, &mutex_ops, name, attr ))) { if (get_error() != STATUS_OBJECT_NAME_EXISTS) { @@ -210,7 +210,7 @@ DECL_HANDLER(create_mutex) { struct mutex *mutex; struct unicode_str name; - struct directory *root; + struct object *root; const struct security_descriptor *sd; const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root ); diff --git a/server/named_pipe.c b/server/named_pipe.c index 4dbc0f35a0e..ab958771196 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -500,11 +500,11 @@ static enum server_fd_type named_pipe_device_get_fd_type( struct fd *fd ) return FD_TYPE_DEVICE; } -void create_named_pipe_device( struct directory *root, const struct unicode_str *name ) +void create_named_pipe_device( struct object *root, const struct unicode_str *name ) { struct named_pipe_device *dev; - if ((dev = create_named_object_dir( root, name, 0, &named_pipe_device_ops )) && + if ((dev = create_named_object( root, &named_pipe_device_ops, name, 0 )) && get_error() != STATUS_OBJECT_NAME_EXISTS) { dev->pipes = NULL; @@ -892,7 +892,7 @@ DECL_HANDLER(create_named_pipe) struct named_pipe *pipe; struct pipe_server *server; struct unicode_str name; - struct directory *root; + struct object *root; const struct security_descriptor *sd; const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root ); @@ -912,10 +912,10 @@ DECL_HANDLER(create_named_pipe) set_error( STATUS_OBJECT_PATH_SYNTAX_BAD ); return; } - else if (!(root = get_directory_obj( current->process, objattr->rootdir, 0 ))) return; + if (!(root = get_directory_obj( current->process, objattr->rootdir ))) return; } - pipe = create_named_object_dir( root, &name, objattr->attributes | OBJ_OPENIF, &named_pipe_ops ); + pipe = create_named_object( root, &named_pipe_ops, &name, objattr->attributes | OBJ_OPENIF ); if (root) release_object( root ); if (!pipe) return; diff --git a/server/object.h b/server/object.h index 566b6da90a6..27bd8697855 100644 --- a/server/object.h +++ b/server/object.h @@ -44,7 +44,6 @@ struct wait_queue_entry; struct async; struct async_queue; struct winstation; -struct directory; struct object_type; @@ -177,10 +176,10 @@ extern void close_objects(void); struct event; struct keyed_event; -extern struct event *create_event( struct directory *root, const struct unicode_str *name, +extern struct event *create_event( struct object *root, const struct unicode_str *name, unsigned int attr, int manual_reset, int initial_state, const struct security_descriptor *sd ); -extern struct keyed_event *create_keyed_event( struct directory *root, const struct unicode_str *name, +extern struct keyed_event *create_keyed_event( struct object *root, const struct unicode_str *name, unsigned int attr, const struct security_descriptor *sd ); extern struct event *get_event_obj( struct process *process, obj_handle_t handle, unsigned int access ); extern struct keyed_event *get_keyed_event_obj( struct process *process, obj_handle_t handle, unsigned int access ); @@ -230,16 +229,14 @@ extern void release_global_atom( struct winstation *winstation, atom_t atom ); /* directory functions */ extern struct object *get_root_directory(void); -extern struct directory *get_directory_obj( struct process *process, obj_handle_t handle, unsigned int access ); -extern void *create_named_object_dir( struct directory *root, const struct unicode_str *name, - unsigned int attr, const struct object_ops *ops ); +extern struct object *get_directory_obj( struct process *process, obj_handle_t handle ); extern struct object_type *get_object_type( const struct unicode_str *name ); extern int directory_link_name( struct object *obj, struct object_name *name, struct object *parent ); extern void init_directories(void); /* symbolic link functions */ -extern struct symlink *create_symlink( struct directory *root, const struct unicode_str *name, +extern struct symlink *create_symlink( struct object *root, const struct unicode_str *name, unsigned int attr, const struct unicode_str *target, const struct security_descriptor *sd ); diff --git a/server/process.c b/server/process.c index c9bcabb3a3d..ec33cc835df 100644 --- a/server/process.c +++ b/server/process.c @@ -181,12 +181,12 @@ static const struct object_ops job_ops = job_destroy /* destroy */ }; -static struct job *create_job_object( struct directory *root, const struct unicode_str *name, +static struct job *create_job_object( struct object *root, const struct unicode_str *name, unsigned int attr, const struct security_descriptor *sd ) { struct job *job; - if ((job = create_named_object_dir( root, name, attr, &job_ops ))) + if ((job = create_named_object( root, &job_ops, name, attr ))) { if (get_error() != STATUS_OBJECT_NAME_EXISTS) { @@ -1544,7 +1544,7 @@ DECL_HANDLER(create_job) { struct job *job; struct unicode_str name; - struct directory *root; + struct object *root; const struct security_descriptor *sd; const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root ); diff --git a/server/request.c b/server/request.c index dfa44858a5f..597bf886c84 100644 --- a/server/request.c +++ b/server/request.c @@ -170,7 +170,7 @@ void *set_reply_data_size( data_size_t size ) /* return object attributes from the current request */ const struct object_attributes *get_req_object_attributes( const struct security_descriptor **sd, struct unicode_str *name, - struct directory **root ) + struct object **root ) { static const struct object_attributes empty_attributes; const struct object_attributes *attr = get_req_data(); @@ -203,7 +203,7 @@ const struct object_attributes *get_req_object_attributes( const struct security } if (root && attr->rootdir && attr->name_len) { - if (!(*root = get_directory_obj( current->process, attr->rootdir, 0 ))) return NULL; + if (!(*root = get_directory_obj( current->process, attr->rootdir ))) return NULL; } *sd = attr->sd_len ? (const struct security_descriptor *)(attr + 1) : NULL; name->len = attr->name_len; diff --git a/server/request.h b/server/request.h index 7ec00cdd86b..5fd07fdf268 100644 --- a/server/request.h +++ b/server/request.h @@ -48,7 +48,7 @@ extern const char *get_config_dir(void); extern void *set_reply_data_size( data_size_t size ); extern const struct object_attributes *get_req_object_attributes( const struct security_descriptor **sd, struct unicode_str *name, - struct directory **root ); + struct object **root ); extern const void *get_req_data_after_objattr( const struct object_attributes *attr, data_size_t *len ); extern int receive_fd( struct process *process ); extern int send_client_fd( struct process *process, int fd, obj_handle_t handle ); diff --git a/server/semaphore.c b/server/semaphore.c index c77bd581652..c6b0d408f14 100644 --- a/server/semaphore.c +++ b/server/semaphore.c @@ -73,7 +73,7 @@ static const struct object_ops semaphore_ops = }; -static struct semaphore *create_semaphore( struct directory *root, const struct unicode_str *name, +static struct semaphore *create_semaphore( struct object *root, const struct unicode_str *name, unsigned int attr, unsigned int initial, unsigned int max, const struct security_descriptor *sd ) { @@ -84,7 +84,7 @@ static struct semaphore *create_semaphore( struct directory *root, const struct set_error( STATUS_INVALID_PARAMETER ); return NULL; } - if ((sem = create_named_object_dir( root, name, attr, &semaphore_ops ))) + if ((sem = create_named_object( root, &semaphore_ops, name, attr ))) { if (get_error() != STATUS_OBJECT_NAME_EXISTS) { @@ -178,7 +178,7 @@ DECL_HANDLER(create_semaphore) { struct semaphore *sem; struct unicode_str name; - struct directory *root; + struct object *root; const struct security_descriptor *sd; const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root ); diff --git a/server/symlink.c b/server/symlink.c index 048cd5d230d..3fabd9a2d83 100644 --- a/server/symlink.c +++ b/server/symlink.c @@ -133,7 +133,7 @@ static void symlink_destroy( struct object *obj ) free( symlink->target ); } -struct symlink *create_symlink( struct directory *root, const struct unicode_str *name, +struct symlink *create_symlink( struct object *root, const struct unicode_str *name, unsigned int attr, const struct unicode_str *target, const struct security_descriptor *sd ) { @@ -144,7 +144,7 @@ struct symlink *create_symlink( struct directory *root, const struct unicode_str set_error( STATUS_INVALID_PARAMETER ); return NULL; } - if ((symlink = create_named_object_dir( root, name, attr, &symlink_ops )) && + if ((symlink = create_named_object( root, &symlink_ops, name, attr )) && (get_error() != STATUS_OBJECT_NAME_EXISTS)) { if ((symlink->target = memdup( target->str, target->len ))) @@ -170,7 +170,7 @@ DECL_HANDLER(create_symlink) { struct symlink *symlink; struct unicode_str name, target; - struct directory *root; + struct object *root; const struct security_descriptor *sd; const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root ); diff --git a/server/timer.c b/server/timer.c index 0d81d90f362..45902150dc4 100644 --- a/server/timer.c +++ b/server/timer.c @@ -81,12 +81,12 @@ static const struct object_ops timer_ops = /* create a timer object */ -static struct timer *create_timer( struct directory *root, const struct unicode_str *name, +static struct timer *create_timer( struct object *root, const struct unicode_str *name, unsigned int attr, int manual, const struct security_descriptor *sd ) { struct timer *timer; - if ((timer = create_named_object_dir( root, name, attr, &timer_ops ))) + if ((timer = create_named_object( root, &timer_ops, name, attr ))) { if (get_error() != STATUS_OBJECT_NAME_EXISTS) { @@ -234,7 +234,7 @@ DECL_HANDLER(create_timer) { struct timer *timer; struct unicode_str name; - struct directory *root; + struct object *root; const struct security_descriptor *sd; const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root ); diff --git a/server/winstation.c b/server/winstation.c index 5d20cdc9881..dbb1d261e88 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -105,12 +105,12 @@ static const struct object_ops desktop_ops = #define DESKTOP_ALL_ACCESS 0x01ff /* create a winstation object */ -static struct winstation *create_winstation( struct directory *root, const struct unicode_str *name, +static struct winstation *create_winstation( struct object *root, const struct unicode_str *name, unsigned int attr, unsigned int flags ) { struct winstation *winstation; - if ((winstation = create_named_object_dir( root, name, attr, &winstation_ops ))) + if ((winstation = create_named_object( root, &winstation_ops, name, attr ))) { if (get_error() != STATUS_OBJECT_NAME_EXISTS) { @@ -438,10 +438,10 @@ DECL_HANDLER(create_winstation) { struct winstation *winstation; struct unicode_str name = get_req_unicode_str(); - struct directory *root = NULL; + struct object *root = NULL; reply->handle = 0; - if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 ))) return; + if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir ))) return; if ((winstation = create_winstation( root, &name, req->attributes, req->flags ))) {