server: Use a standard object for object attribute roots instead of a directory.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
dcca411ac3
commit
ff9d90bbb0
|
@ -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);
|
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,
|
unsigned int attr, unsigned int concurrent,
|
||||||
const struct security_descriptor *sd )
|
const struct security_descriptor *sd )
|
||||||
{
|
{
|
||||||
struct completion *completion;
|
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)
|
if (get_error() != STATUS_OBJECT_NAME_EXISTS)
|
||||||
{
|
{
|
||||||
|
@ -179,7 +179,7 @@ DECL_HANDLER(create_completion)
|
||||||
{
|
{
|
||||||
struct completion *completion;
|
struct completion *completion;
|
||||||
struct unicode_str name;
|
struct unicode_str name;
|
||||||
struct directory *root;
|
struct object *root;
|
||||||
const struct security_descriptor *sd;
|
const struct security_descriptor *sd;
|
||||||
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
||||||
|
|
||||||
|
|
|
@ -599,12 +599,12 @@ static obj_handle_t device_file_ioctl( struct fd *fd, ioctl_code_t code, const a
|
||||||
return handle;
|
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_manager *manager, unsigned int attr )
|
||||||
{
|
{
|
||||||
struct device *device;
|
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)
|
if (get_error() != STATUS_OBJECT_NAME_EXISTS)
|
||||||
{
|
{
|
||||||
|
@ -618,12 +618,12 @@ static struct device *create_device( struct directory *root, const struct unicod
|
||||||
return device;
|
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 )
|
const char *unix_path )
|
||||||
{
|
{
|
||||||
struct device *device;
|
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->unix_path = strdup( unix_path );
|
||||||
device->manager = NULL; /* no manager, requests go straight to the Unix device */
|
device->manager = NULL; /* no manager, requests go straight to the Unix device */
|
||||||
|
@ -718,13 +718,13 @@ DECL_HANDLER(create_device)
|
||||||
struct device *device;
|
struct device *device;
|
||||||
struct unicode_str name = get_req_unicode_str();
|
struct unicode_str name = get_req_unicode_str();
|
||||||
struct device_manager *manager;
|
struct device_manager *manager;
|
||||||
struct directory *root = NULL;
|
struct object *root = NULL;
|
||||||
|
|
||||||
if (!(manager = (struct device_manager *)get_handle_obj( current->process, req->manager,
|
if (!(manager = (struct device_manager *)get_handle_obj( current->process, req->manager,
|
||||||
0, &device_manager_ops )))
|
0, &device_manager_ops )))
|
||||||
return;
|
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 );
|
release_object( manager );
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -198,13 +198,13 @@ static void directory_destroy( struct object *obj )
|
||||||
free( dir->entries );
|
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,
|
unsigned int attr, unsigned int hash_size,
|
||||||
const struct security_descriptor *sd )
|
const struct security_descriptor *sd )
|
||||||
{
|
{
|
||||||
struct directory *dir;
|
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)
|
get_error() != STATUS_OBJECT_NAME_EXISTS)
|
||||||
{
|
{
|
||||||
if (!(dir->entries = create_namespace( hash_size )))
|
if (!(dir->entries = create_namespace( hash_size )))
|
||||||
|
@ -223,16 +223,10 @@ struct object *get_root_directory(void)
|
||||||
return grab_object( root_directory );
|
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 );
|
return get_handle_obj( process, handle, 0, &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 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* retrieve an object type, creating it if needed */
|
/* 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;
|
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)
|
if (get_error() != STATUS_OBJECT_NAME_EXISTS)
|
||||||
{
|
{
|
||||||
|
@ -335,13 +329,13 @@ void init_directories(void)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
root_directory = create_directory( NULL, NULL, 0, HASH_SIZE, NULL );
|
root_directory = create_directory( NULL, NULL, 0, HASH_SIZE, NULL );
|
||||||
dir_driver = create_directory( root_directory, &dir_driver_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, &dir_device_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, &dir_objtype_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, &dir_sessions_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, &dir_kernel_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, &dir_windows_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, &dir_winstations_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( &root_directory->obj );
|
||||||
make_object_static( &dir_driver->obj );
|
make_object_static( &dir_driver->obj );
|
||||||
make_object_static( &dir_objtype->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 );
|
dir_basenamed = create_directory( NULL, &dir_basenamed_str, 0, 37, NULL );
|
||||||
|
|
||||||
/* devices */
|
/* devices */
|
||||||
create_named_pipe_device( dir_device, &named_pipe_str );
|
create_named_pipe_device( &dir_device->obj, &named_pipe_str );
|
||||||
create_mailslot_device( dir_device, &mailslot_str );
|
create_mailslot_device( &dir_device->obj, &mailslot_str );
|
||||||
create_unix_device( dir_device, &null_str, "/dev/null" );
|
create_unix_device( &dir_device->obj, &null_str, "/dev/null" );
|
||||||
|
|
||||||
/* symlinks */
|
/* symlinks */
|
||||||
link_dosdev = create_symlink( root_directory, &link_dosdev_str, 0, &dir_global_str, NULL );
|
link_dosdev = create_symlink( &root_directory->obj, &link_dosdev_str, 0, &dir_global_str, NULL );
|
||||||
link_global1 = create_symlink( dir_global, &link_global_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, &link_global_str, 0, &dir_basenamed_str, NULL );
|
link_global2 = create_symlink( &dir_basenamed->obj, &link_global_str, 0, &dir_basenamed_str, NULL );
|
||||||
link_local = create_symlink( dir_basenamed, &link_local_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, &link_nul_str, 0, &dir_null_str, NULL );
|
link_nul = create_symlink( &dir_global->obj, &link_nul_str, 0, &dir_null_str, NULL );
|
||||||
link_pipe = create_symlink( dir_global, &link_pipe_str, 0, &dir_named_pipe_str, NULL );
|
link_pipe = create_symlink( &dir_global->obj, &link_pipe_str, 0, &dir_named_pipe_str, NULL );
|
||||||
link_mailslot = create_symlink( dir_global, &link_mailslot_str, 0, &dir_mailslot_str, NULL );
|
link_mailslot = create_symlink( &dir_global->obj, &link_mailslot_str, 0, &dir_mailslot_str, NULL );
|
||||||
link_0 = create_symlink( dir_sessions, &link_0_str, 0, &dir_basenamed_str, NULL );
|
link_0 = create_symlink( &dir_sessions->obj, &link_0_str, 0, &dir_basenamed_str, NULL );
|
||||||
link_session = create_symlink( dir_basenamed, &link_session_str, 0, &link_sessions_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_dosdev );
|
||||||
make_object_static( (struct object *)link_global1 );
|
make_object_static( (struct object *)link_global1 );
|
||||||
make_object_static( (struct object *)link_global2 );
|
make_object_static( (struct object *)link_global2 );
|
||||||
|
@ -379,10 +373,10 @@ void init_directories(void)
|
||||||
/* events */
|
/* events */
|
||||||
for (i = 0; i < sizeof(kernel_events)/sizeof(kernel_events[0]); i++)
|
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 );
|
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 );
|
make_object_static( (struct object *)keyed_event );
|
||||||
|
|
||||||
/* the objects hold references so we can release these directories */
|
/* the objects hold references so we can release these directories */
|
||||||
|
@ -398,7 +392,8 @@ void init_directories(void)
|
||||||
DECL_HANDLER(create_directory)
|
DECL_HANDLER(create_directory)
|
||||||
{
|
{
|
||||||
struct unicode_str name;
|
struct unicode_str name;
|
||||||
struct directory *dir, *root;
|
struct object *root;
|
||||||
|
struct directory *dir;
|
||||||
const struct security_descriptor *sd;
|
const struct security_descriptor *sd;
|
||||||
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
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 */
|
/* get a directory entry by index */
|
||||||
DECL_HANDLER(get_directory_entry)
|
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)
|
if (dir)
|
||||||
{
|
{
|
||||||
struct object *obj = find_object_index( dir->entries, req->index );
|
struct object *obj = find_object_index( dir->entries, req->index );
|
||||||
|
|
|
@ -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,
|
unsigned int attr, int manual_reset, int initial_state,
|
||||||
const struct security_descriptor *sd )
|
const struct security_descriptor *sd )
|
||||||
{
|
{
|
||||||
struct event *event;
|
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)
|
if (get_error() != STATUS_OBJECT_NAME_EXISTS)
|
||||||
{
|
{
|
||||||
|
@ -206,12 +206,12 @@ static int event_signal( struct object *obj, unsigned int access )
|
||||||
return 1;
|
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 )
|
unsigned int attr, const struct security_descriptor *sd )
|
||||||
{
|
{
|
||||||
struct keyed_event *event;
|
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)
|
if (get_error() != STATUS_OBJECT_NAME_EXISTS)
|
||||||
{
|
{
|
||||||
|
@ -284,7 +284,7 @@ DECL_HANDLER(create_event)
|
||||||
{
|
{
|
||||||
struct event *event;
|
struct event *event;
|
||||||
struct unicode_str name;
|
struct unicode_str name;
|
||||||
struct directory *root;
|
struct object *root;
|
||||||
const struct security_descriptor *sd;
|
const struct security_descriptor *sd;
|
||||||
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
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 keyed_event *event;
|
||||||
struct unicode_str name;
|
struct unicode_str name;
|
||||||
struct directory *root;
|
struct object *root;
|
||||||
const struct security_descriptor *sd;
|
const struct security_descriptor *sd;
|
||||||
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
||||||
|
|
||||||
|
|
|
@ -141,9 +141,9 @@ extern int get_page_size(void);
|
||||||
|
|
||||||
/* device functions */
|
/* device functions */
|
||||||
|
|
||||||
extern void create_named_pipe_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 directory *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 directory *root, const struct unicode_str *name,
|
extern struct device *create_unix_device( struct object *root, const struct unicode_str *name,
|
||||||
const char *unix_path );
|
const char *unix_path );
|
||||||
|
|
||||||
/* change notification functions */
|
/* change notification functions */
|
||||||
|
|
|
@ -397,11 +397,11 @@ static enum server_fd_type mailslot_device_get_fd_type( struct fd *fd )
|
||||||
return FD_TYPE_DEVICE;
|
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;
|
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)
|
get_error() != STATUS_OBJECT_NAME_EXISTS)
|
||||||
{
|
{
|
||||||
dev->mailslots = NULL;
|
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 );
|
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,
|
const struct unicode_str *name, unsigned int attr,
|
||||||
int max_msgsize, timeout_t read_timeout,
|
int max_msgsize, timeout_t read_timeout,
|
||||||
const struct security_descriptor *sd )
|
const struct security_descriptor *sd )
|
||||||
|
@ -423,7 +423,7 @@ static struct mailslot *create_mailslot( struct directory *root,
|
||||||
struct mailslot *mailslot;
|
struct mailslot *mailslot;
|
||||||
int fds[2];
|
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->fd = NULL;
|
||||||
mailslot->write_fd = -1;
|
mailslot->write_fd = -1;
|
||||||
|
@ -497,7 +497,7 @@ DECL_HANDLER(create_mailslot)
|
||||||
{
|
{
|
||||||
struct mailslot *mailslot;
|
struct mailslot *mailslot;
|
||||||
struct unicode_str name;
|
struct unicode_str name;
|
||||||
struct directory *root;
|
struct object *root;
|
||||||
const struct security_descriptor *sd;
|
const struct security_descriptor *sd;
|
||||||
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
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 );
|
set_error( STATUS_OBJECT_PATH_SYNTAX_BAD );
|
||||||
return;
|
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,
|
if ((mailslot = create_mailslot( root, &name, objattr->attributes, req->max_msgsize,
|
||||||
|
|
|
@ -470,7 +470,7 @@ static unsigned int get_image_params( struct mapping *mapping, int unix_fd, int
|
||||||
return STATUS_INVALID_FILE_FOR_SECTION;
|
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,
|
unsigned int attr, mem_size_t size, int protect,
|
||||||
obj_handle_t handle, const struct security_descriptor *sd )
|
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 (!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;
|
return NULL;
|
||||||
if (get_error() == STATUS_OBJECT_NAME_EXISTS)
|
if (get_error() == STATUS_OBJECT_NAME_EXISTS)
|
||||||
return &mapping->obj; /* Nothing else to do */
|
return &mapping->obj; /* Nothing else to do */
|
||||||
|
@ -661,9 +661,8 @@ int get_page_size(void)
|
||||||
/* create a file mapping */
|
/* create a file mapping */
|
||||||
DECL_HANDLER(create_mapping)
|
DECL_HANDLER(create_mapping)
|
||||||
{
|
{
|
||||||
struct object *obj;
|
struct object *root, *obj;
|
||||||
struct unicode_str name;
|
struct unicode_str name;
|
||||||
struct directory *root;
|
|
||||||
const struct security_descriptor *sd;
|
const struct security_descriptor *sd;
|
||||||
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
||||||
|
|
||||||
|
|
|
@ -99,12 +99,12 @@ static void do_release( struct mutex *mutex )
|
||||||
wake_up( &mutex->obj, 0 );
|
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 )
|
unsigned int attr, int owned, const struct security_descriptor *sd )
|
||||||
{
|
{
|
||||||
struct mutex *mutex;
|
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)
|
if (get_error() != STATUS_OBJECT_NAME_EXISTS)
|
||||||
{
|
{
|
||||||
|
@ -210,7 +210,7 @@ DECL_HANDLER(create_mutex)
|
||||||
{
|
{
|
||||||
struct mutex *mutex;
|
struct mutex *mutex;
|
||||||
struct unicode_str name;
|
struct unicode_str name;
|
||||||
struct directory *root;
|
struct object *root;
|
||||||
const struct security_descriptor *sd;
|
const struct security_descriptor *sd;
|
||||||
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
||||||
|
|
||||||
|
|
|
@ -500,11 +500,11 @@ static enum server_fd_type named_pipe_device_get_fd_type( struct fd *fd )
|
||||||
return FD_TYPE_DEVICE;
|
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;
|
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)
|
get_error() != STATUS_OBJECT_NAME_EXISTS)
|
||||||
{
|
{
|
||||||
dev->pipes = NULL;
|
dev->pipes = NULL;
|
||||||
|
@ -892,7 +892,7 @@ DECL_HANDLER(create_named_pipe)
|
||||||
struct named_pipe *pipe;
|
struct named_pipe *pipe;
|
||||||
struct pipe_server *server;
|
struct pipe_server *server;
|
||||||
struct unicode_str name;
|
struct unicode_str name;
|
||||||
struct directory *root;
|
struct object *root;
|
||||||
const struct security_descriptor *sd;
|
const struct security_descriptor *sd;
|
||||||
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
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 );
|
set_error( STATUS_OBJECT_PATH_SYNTAX_BAD );
|
||||||
return;
|
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 (root) release_object( root );
|
||||||
if (!pipe) return;
|
if (!pipe) return;
|
||||||
|
|
|
@ -44,7 +44,6 @@ struct wait_queue_entry;
|
||||||
struct async;
|
struct async;
|
||||||
struct async_queue;
|
struct async_queue;
|
||||||
struct winstation;
|
struct winstation;
|
||||||
struct directory;
|
|
||||||
struct object_type;
|
struct object_type;
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,10 +176,10 @@ extern void close_objects(void);
|
||||||
struct event;
|
struct event;
|
||||||
struct keyed_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,
|
unsigned int attr, int manual_reset, int initial_state,
|
||||||
const struct security_descriptor *sd );
|
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 );
|
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 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 );
|
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 */
|
/* directory functions */
|
||||||
|
|
||||||
extern struct object *get_root_directory(void);
|
extern struct object *get_root_directory(void);
|
||||||
extern struct directory *get_directory_obj( struct process *process, obj_handle_t handle, unsigned int access );
|
extern struct object *get_directory_obj( struct process *process, obj_handle_t handle );
|
||||||
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_type *get_object_type( const struct unicode_str *name );
|
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 int directory_link_name( struct object *obj, struct object_name *name, struct object *parent );
|
||||||
extern void init_directories(void);
|
extern void init_directories(void);
|
||||||
|
|
||||||
/* symbolic link functions */
|
/* 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,
|
unsigned int attr, const struct unicode_str *target,
|
||||||
const struct security_descriptor *sd );
|
const struct security_descriptor *sd );
|
||||||
|
|
||||||
|
|
|
@ -181,12 +181,12 @@ static const struct object_ops job_ops =
|
||||||
job_destroy /* destroy */
|
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 )
|
unsigned int attr, const struct security_descriptor *sd )
|
||||||
{
|
{
|
||||||
struct job *job;
|
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)
|
if (get_error() != STATUS_OBJECT_NAME_EXISTS)
|
||||||
{
|
{
|
||||||
|
@ -1544,7 +1544,7 @@ DECL_HANDLER(create_job)
|
||||||
{
|
{
|
||||||
struct job *job;
|
struct job *job;
|
||||||
struct unicode_str name;
|
struct unicode_str name;
|
||||||
struct directory *root;
|
struct object *root;
|
||||||
const struct security_descriptor *sd;
|
const struct security_descriptor *sd;
|
||||||
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ void *set_reply_data_size( data_size_t size )
|
||||||
/* return object attributes from the current request */
|
/* return object attributes from the current request */
|
||||||
const struct object_attributes *get_req_object_attributes( const struct security_descriptor **sd,
|
const struct object_attributes *get_req_object_attributes( const struct security_descriptor **sd,
|
||||||
struct unicode_str *name,
|
struct unicode_str *name,
|
||||||
struct directory **root )
|
struct object **root )
|
||||||
{
|
{
|
||||||
static const struct object_attributes empty_attributes;
|
static const struct object_attributes empty_attributes;
|
||||||
const struct object_attributes *attr = get_req_data();
|
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 && 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;
|
*sd = attr->sd_len ? (const struct security_descriptor *)(attr + 1) : NULL;
|
||||||
name->len = attr->name_len;
|
name->len = attr->name_len;
|
||||||
|
|
|
@ -48,7 +48,7 @@ extern const char *get_config_dir(void);
|
||||||
extern void *set_reply_data_size( data_size_t size );
|
extern void *set_reply_data_size( data_size_t size );
|
||||||
extern const struct object_attributes *get_req_object_attributes( const struct security_descriptor **sd,
|
extern const struct object_attributes *get_req_object_attributes( const struct security_descriptor **sd,
|
||||||
struct unicode_str *name,
|
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 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 receive_fd( struct process *process );
|
||||||
extern int send_client_fd( struct process *process, int fd, obj_handle_t handle );
|
extern int send_client_fd( struct process *process, int fd, obj_handle_t handle );
|
||||||
|
|
|
@ -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,
|
unsigned int attr, unsigned int initial, unsigned int max,
|
||||||
const struct security_descriptor *sd )
|
const struct security_descriptor *sd )
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ static struct semaphore *create_semaphore( struct directory *root, const struct
|
||||||
set_error( STATUS_INVALID_PARAMETER );
|
set_error( STATUS_INVALID_PARAMETER );
|
||||||
return NULL;
|
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)
|
if (get_error() != STATUS_OBJECT_NAME_EXISTS)
|
||||||
{
|
{
|
||||||
|
@ -178,7 +178,7 @@ DECL_HANDLER(create_semaphore)
|
||||||
{
|
{
|
||||||
struct semaphore *sem;
|
struct semaphore *sem;
|
||||||
struct unicode_str name;
|
struct unicode_str name;
|
||||||
struct directory *root;
|
struct object *root;
|
||||||
const struct security_descriptor *sd;
|
const struct security_descriptor *sd;
|
||||||
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ static void symlink_destroy( struct object *obj )
|
||||||
free( symlink->target );
|
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,
|
unsigned int attr, const struct unicode_str *target,
|
||||||
const struct security_descriptor *sd )
|
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 );
|
set_error( STATUS_INVALID_PARAMETER );
|
||||||
return NULL;
|
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))
|
(get_error() != STATUS_OBJECT_NAME_EXISTS))
|
||||||
{
|
{
|
||||||
if ((symlink->target = memdup( target->str, target->len )))
|
if ((symlink->target = memdup( target->str, target->len )))
|
||||||
|
@ -170,7 +170,7 @@ DECL_HANDLER(create_symlink)
|
||||||
{
|
{
|
||||||
struct symlink *symlink;
|
struct symlink *symlink;
|
||||||
struct unicode_str name, target;
|
struct unicode_str name, target;
|
||||||
struct directory *root;
|
struct object *root;
|
||||||
const struct security_descriptor *sd;
|
const struct security_descriptor *sd;
|
||||||
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
||||||
|
|
||||||
|
|
|
@ -81,12 +81,12 @@ static const struct object_ops timer_ops =
|
||||||
|
|
||||||
|
|
||||||
/* create a timer object */
|
/* 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 )
|
unsigned int attr, int manual, const struct security_descriptor *sd )
|
||||||
{
|
{
|
||||||
struct timer *timer;
|
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)
|
if (get_error() != STATUS_OBJECT_NAME_EXISTS)
|
||||||
{
|
{
|
||||||
|
@ -234,7 +234,7 @@ DECL_HANDLER(create_timer)
|
||||||
{
|
{
|
||||||
struct timer *timer;
|
struct timer *timer;
|
||||||
struct unicode_str name;
|
struct unicode_str name;
|
||||||
struct directory *root;
|
struct object *root;
|
||||||
const struct security_descriptor *sd;
|
const struct security_descriptor *sd;
|
||||||
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
|
||||||
|
|
||||||
|
|
|
@ -105,12 +105,12 @@ static const struct object_ops desktop_ops =
|
||||||
#define DESKTOP_ALL_ACCESS 0x01ff
|
#define DESKTOP_ALL_ACCESS 0x01ff
|
||||||
|
|
||||||
/* create a winstation object */
|
/* 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 )
|
unsigned int attr, unsigned int flags )
|
||||||
{
|
{
|
||||||
struct winstation *winstation;
|
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)
|
if (get_error() != STATUS_OBJECT_NAME_EXISTS)
|
||||||
{
|
{
|
||||||
|
@ -438,10 +438,10 @@ DECL_HANDLER(create_winstation)
|
||||||
{
|
{
|
||||||
struct winstation *winstation;
|
struct winstation *winstation;
|
||||||
struct unicode_str name = get_req_unicode_str();
|
struct unicode_str name = get_req_unicode_str();
|
||||||
struct directory *root = NULL;
|
struct object *root = NULL;
|
||||||
|
|
||||||
reply->handle = 0;
|
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 )))
|
if ((winstation = create_winstation( root, &name, req->attributes, req->flags )))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue