Commit 3585f2fa authored by Vitaliy Margolen's avatar Vitaliy Margolen Committed by Alexandre Julliard

Pass object attributes to create_named_object & find_object.

parent 289889c9
...@@ -227,7 +227,7 @@ static struct object *create_console_input( struct thread* renderer ) ...@@ -227,7 +227,7 @@ static struct object *create_console_input( struct thread* renderer )
console_input->history_index = 0; console_input->history_index = 0;
console_input->history_mode = 0; console_input->history_mode = 0;
console_input->edition_mode = 0; console_input->edition_mode = 0;
console_input->event = create_event( NULL, 0, 1, 0 ); console_input->event = create_event( NULL, 0, 0, 1, 0 );
if (!console_input->history || !console_input->evt) if (!console_input->history || !console_input->evt)
{ {
......
...@@ -59,12 +59,12 @@ static const struct object_ops event_ops = ...@@ -59,12 +59,12 @@ static const struct object_ops event_ops =
}; };
struct event *create_event( const WCHAR *name, size_t len, struct event *create_event( const WCHAR *name, size_t len, unsigned int attr,
int manual_reset, int initial_state ) int manual_reset, int initial_state )
{ {
struct event *event; struct event *event;
if ((event = create_named_object( sync_namespace, &event_ops, name, len ))) if ((event = create_named_object( sync_namespace, &event_ops, name, len, attr )))
{ {
if (get_error() != STATUS_OBJECT_NAME_COLLISION) if (get_error() != STATUS_OBJECT_NAME_COLLISION)
{ {
...@@ -147,7 +147,7 @@ DECL_HANDLER(create_event) ...@@ -147,7 +147,7 @@ DECL_HANDLER(create_event)
struct event *event; struct event *event;
reply->handle = 0; reply->handle = 0;
if ((event = create_event( get_req_data(), get_req_data_size(), if ((event = create_event( get_req_data(), get_req_data_size(), req->attributes,
req->manual_reset, req->initial_state ))) req->manual_reset, req->initial_state )))
{ {
reply->handle = alloc_handle( current->process, event, req->access, reply->handle = alloc_handle( current->process, event, req->access,
......
...@@ -525,7 +525,7 @@ obj_handle_t open_object( const struct namespace *namespace, const WCHAR *name, ...@@ -525,7 +525,7 @@ obj_handle_t open_object( const struct namespace *namespace, const WCHAR *name,
const struct object_ops *ops, unsigned int access, unsigned int attr ) const struct object_ops *ops, unsigned int access, unsigned int attr )
{ {
obj_handle_t handle = 0; obj_handle_t handle = 0;
struct object *obj = find_object( namespace, name, len ); struct object *obj = find_object( namespace, name, len, attr );
if (obj) if (obj)
{ {
if (ops && obj->ops != ops) if (ops && obj->ops != ops)
......
...@@ -213,8 +213,8 @@ static void mailslot_queue_async( struct fd *fd, void *apc, void *user, ...@@ -213,8 +213,8 @@ static void mailslot_queue_async( struct fd *fd, void *apc, void *user,
fd_queue_async_timeout( fd, apc, user, iosb, type, count, timeout ); fd_queue_async_timeout( fd, apc, user, iosb, type, count, timeout );
} }
static struct mailslot *create_mailslot( const WCHAR *name, size_t len, int max_msgsize, static struct mailslot *create_mailslot( const WCHAR *name, size_t len, unsigned int attr,
int read_timeout ) int max_msgsize, int read_timeout )
{ {
struct mailslot *mailslot; struct mailslot *mailslot;
int fds[2]; int fds[2];
...@@ -226,7 +226,7 @@ static struct mailslot *create_mailslot( const WCHAR *name, size_t len, int max_ ...@@ -226,7 +226,7 @@ static struct mailslot *create_mailslot( const WCHAR *name, size_t len, int max_
return NULL; return NULL;
} }
mailslot = create_named_object( sync_namespace, &mailslot_ops, name, len ); mailslot = create_named_object( sync_namespace, &mailslot_ops, name, len, attr );
if (!mailslot) if (!mailslot)
return NULL; return NULL;
...@@ -259,11 +259,11 @@ static struct mailslot *create_mailslot( const WCHAR *name, size_t len, int max_ ...@@ -259,11 +259,11 @@ static struct mailslot *create_mailslot( const WCHAR *name, size_t len, int max_
return NULL; return NULL;
} }
static struct mailslot *open_mailslot( const WCHAR *name, size_t len ) static struct mailslot *open_mailslot( const WCHAR *name, size_t len, unsigned int attr )
{ {
struct object *obj; struct object *obj;
obj = find_object( sync_namespace, name, len ); obj = find_object( sync_namespace, name, len, attr );
if (obj) if (obj)
{ {
if (obj->ops == &mailslot_ops) if (obj->ops == &mailslot_ops)
...@@ -352,7 +352,7 @@ DECL_HANDLER(create_mailslot) ...@@ -352,7 +352,7 @@ DECL_HANDLER(create_mailslot)
struct mailslot *mailslot; struct mailslot *mailslot;
reply->handle = 0; reply->handle = 0;
mailslot = create_mailslot( get_req_data(), get_req_data_size(), mailslot = create_mailslot( get_req_data(), get_req_data_size(), req->attributes,
req->max_msgsize, req->read_timeout ); req->max_msgsize, req->read_timeout );
if (mailslot) if (mailslot)
{ {
...@@ -376,7 +376,7 @@ DECL_HANDLER(open_mailslot) ...@@ -376,7 +376,7 @@ DECL_HANDLER(open_mailslot)
return; return;
} }
mailslot = open_mailslot( get_req_data(), get_req_data_size() ); mailslot = open_mailslot( get_req_data(), get_req_data_size(), req->attributes );
if (mailslot) if (mailslot)
{ {
struct mail_writer *writer; struct mail_writer *writer;
......
...@@ -270,15 +270,15 @@ inline static int get_file_size( struct file *file, file_pos_t *size ) ...@@ -270,15 +270,15 @@ inline static int get_file_size( struct file *file, file_pos_t *size )
return 1; return 1;
} }
static struct object *create_mapping( file_pos_t size, int protect, obj_handle_t handle, static struct object *create_mapping( const WCHAR *name, size_t len, unsigned int attr,
const WCHAR *name, size_t len ) file_pos_t size, int protect, obj_handle_t handle )
{ {
struct mapping *mapping; struct mapping *mapping;
int access = 0; int access = 0;
if (!page_mask) init_page_size(); if (!page_mask) init_page_size();
if (!(mapping = create_named_object( sync_namespace, &mapping_ops, name, len ))) if (!(mapping = create_named_object( sync_namespace, &mapping_ops, name, len, attr )))
return NULL; return NULL;
if (get_error() == STATUS_OBJECT_NAME_COLLISION) if (get_error() == STATUS_OBJECT_NAME_COLLISION)
return &mapping->obj; /* Nothing else to do */ return &mapping->obj; /* Nothing else to do */
...@@ -377,8 +377,8 @@ DECL_HANDLER(create_mapping) ...@@ -377,8 +377,8 @@ DECL_HANDLER(create_mapping)
file_pos_t size = ((file_pos_t)req->size_high << 32) | req->size_low; file_pos_t size = ((file_pos_t)req->size_high << 32) | req->size_low;
reply->handle = 0; reply->handle = 0;
if ((obj = create_mapping( size, req->protect, req->file_handle, if ((obj = create_mapping( get_req_data(), get_req_data_size(), req->attributes,
get_req_data(), get_req_data_size() ))) size, req->protect, req->file_handle )))
{ {
reply->handle = alloc_handle( current->process, obj, req->access, reply->handle = alloc_handle( current->process, obj, req->access,
req->attributes & OBJ_INHERIT ); req->attributes & OBJ_INHERIT );
......
...@@ -62,11 +62,12 @@ static const struct object_ops mutex_ops = ...@@ -62,11 +62,12 @@ static const struct object_ops mutex_ops =
}; };
static struct mutex *create_mutex( const WCHAR *name, size_t len, int owned ) static struct mutex *create_mutex( const WCHAR *name, size_t len, unsigned int attr,
int owned )
{ {
struct mutex *mutex; struct mutex *mutex;
if ((mutex = create_named_object( sync_namespace, &mutex_ops, name, len ))) if ((mutex = create_named_object( sync_namespace, &mutex_ops, name, len, attr )))
{ {
if (get_error() != STATUS_OBJECT_NAME_COLLISION) if (get_error() != STATUS_OBJECT_NAME_COLLISION)
{ {
...@@ -172,7 +173,8 @@ DECL_HANDLER(create_mutex) ...@@ -172,7 +173,8 @@ DECL_HANDLER(create_mutex)
struct mutex *mutex; struct mutex *mutex;
reply->handle = 0; reply->handle = 0;
if ((mutex = create_mutex( get_req_data(), get_req_data_size(), req->owned ))) if ((mutex = create_mutex( get_req_data(), get_req_data_size(), req->attributes,
req->owned )))
{ {
reply->handle = alloc_handle( current->process, mutex, req->access, reply->handle = alloc_handle( current->process, mutex, req->access,
req->attributes & OBJ_INHERIT ); req->attributes & OBJ_INHERIT );
......
...@@ -397,7 +397,7 @@ static int pipe_server_flush( struct fd *fd, struct event **event ) ...@@ -397,7 +397,7 @@ static int pipe_server_flush( struct fd *fd, struct event **event )
/* this kind of sux - /* this kind of sux -
there's no unix way to be alerted when a pipe becomes empty */ there's no unix way to be alerted when a pipe becomes empty */
server->event = create_event( NULL, 0, 0, 0 ); server->event = create_event( NULL, 0, 0, 0, 0 );
if (!server->event) if (!server->event)
return 0; return 0;
gettimeofday( &tv, NULL ); gettimeofday( &tv, NULL );
...@@ -440,11 +440,11 @@ static int pipe_client_get_info( struct fd *fd ) ...@@ -440,11 +440,11 @@ static int pipe_client_get_info( struct fd *fd )
return flags; return flags;
} }
static struct named_pipe *create_named_pipe( const WCHAR *name, size_t len ) static struct named_pipe *create_named_pipe( const WCHAR *name, size_t len, unsigned int attr )
{ {
struct named_pipe *pipe; struct named_pipe *pipe;
pipe = create_named_object( sync_namespace, &named_pipe_ops, name, len ); pipe = create_named_object( sync_namespace, &named_pipe_ops, name, len, attr );
if (pipe) if (pipe)
{ {
if (get_error() != STATUS_OBJECT_NAME_COLLISION) if (get_error() != STATUS_OBJECT_NAME_COLLISION)
...@@ -458,11 +458,11 @@ static struct named_pipe *create_named_pipe( const WCHAR *name, size_t len ) ...@@ -458,11 +458,11 @@ static struct named_pipe *create_named_pipe( const WCHAR *name, size_t len )
return pipe; return pipe;
} }
static struct named_pipe *open_named_pipe( const WCHAR *name, size_t len ) static struct named_pipe *open_named_pipe( const WCHAR *name, size_t len, unsigned int attr )
{ {
struct object *obj; struct object *obj;
if ((obj = find_object( sync_namespace, name, len ))) if ((obj = find_object( sync_namespace, name, len, attr )))
{ {
if (obj->ops == &named_pipe_ops) return (struct named_pipe *)obj; if (obj->ops == &named_pipe_ops) return (struct named_pipe *)obj;
release_object( obj ); release_object( obj );
...@@ -548,7 +548,7 @@ DECL_HANDLER(create_named_pipe) ...@@ -548,7 +548,7 @@ DECL_HANDLER(create_named_pipe)
struct pipe_server *server; struct pipe_server *server;
reply->handle = 0; reply->handle = 0;
pipe = create_named_pipe( get_req_data(), get_req_data_size() ); pipe = create_named_pipe( get_req_data(), get_req_data_size(), req->attributes );
if (!pipe) if (!pipe)
return; return;
...@@ -598,7 +598,7 @@ DECL_HANDLER(open_named_pipe) ...@@ -598,7 +598,7 @@ DECL_HANDLER(open_named_pipe)
struct named_pipe *pipe; struct named_pipe *pipe;
int fds[2]; int fds[2];
pipe = open_named_pipe( get_req_data(), get_req_data_size() ); pipe = open_named_pipe( get_req_data(), get_req_data_size(), req->attributes );
if (!pipe) if (!pipe)
{ {
set_error( STATUS_NO_SUCH_FILE ); set_error( STATUS_NO_SUCH_FILE );
...@@ -697,7 +697,7 @@ DECL_HANDLER(wait_named_pipe) ...@@ -697,7 +697,7 @@ DECL_HANDLER(wait_named_pipe)
struct named_pipe *pipe; struct named_pipe *pipe;
struct pipe_server *server; struct pipe_server *server;
if (!(pipe = open_named_pipe( get_req_data(), get_req_data_size() ))) if (!(pipe = open_named_pipe( get_req_data(), get_req_data_size(), OBJ_CASE_INSENSITIVE )))
{ {
set_error( STATUS_PIPE_NOT_AVAILABLE ); set_error( STATUS_PIPE_NOT_AVAILABLE );
return; return;
......
...@@ -157,14 +157,14 @@ void *alloc_object( const struct object_ops *ops ) ...@@ -157,14 +157,14 @@ void *alloc_object( const struct object_ops *ops )
} }
void *create_named_object( struct namespace *namespace, const struct object_ops *ops, void *create_named_object( struct namespace *namespace, const struct object_ops *ops,
const WCHAR *name, size_t len ) const WCHAR *name, size_t len, unsigned int attributes )
{ {
struct object *obj; struct object *obj;
struct object_name *name_ptr; struct object_name *name_ptr;
if (!name || !len) return alloc_object( ops ); if (!name || !len) return alloc_object( ops );
if ((obj = find_object( namespace, name, len ))) if ((obj = find_object( namespace, name, len, attributes )))
{ {
if (obj->ops != ops) if (obj->ops != ops)
{ {
...@@ -225,7 +225,8 @@ void release_object( void *ptr ) ...@@ -225,7 +225,8 @@ void release_object( void *ptr )
} }
/* find an object by its name; the refcount is incremented */ /* find an object by its name; the refcount is incremented */
struct object *find_object( const struct namespace *namespace, const WCHAR *name, size_t len ) struct object *find_object( const struct namespace *namespace, const WCHAR *name, size_t len,
unsigned int attributes )
{ {
const struct list *list, *p; const struct list *list, *p;
......
...@@ -94,13 +94,14 @@ extern void *alloc_object( const struct object_ops *ops ); ...@@ -94,13 +94,14 @@ extern void *alloc_object( const struct object_ops *ops );
extern const WCHAR *get_object_name( struct object *obj, size_t *len ); extern const WCHAR *get_object_name( struct object *obj, size_t *len );
extern void dump_object_name( struct object *obj ); extern void dump_object_name( struct object *obj );
extern void *create_named_object( struct namespace *namespace, const struct object_ops *ops, extern void *create_named_object( struct namespace *namespace, const struct object_ops *ops,
const WCHAR *name, size_t len ); const WCHAR *name, size_t len, unsigned int attributes );
extern struct namespace *create_namespace( unsigned int hash_size, int case_sensitive ); extern struct namespace *create_namespace( unsigned int hash_size, int case_sensitive );
/* grab/release_object can take any pointer, but you better make sure */ /* grab/release_object can take any pointer, but you better make sure */
/* that the thing pointed to starts with a struct object... */ /* that the thing pointed to starts with a struct object... */
extern struct object *grab_object( void *obj ); extern struct object *grab_object( void *obj );
extern void release_object( void *obj ); extern void release_object( void *obj );
extern struct object *find_object( const struct namespace *namespace, const WCHAR *name, size_t len ); extern struct object *find_object( const struct namespace *namespace, const WCHAR *name, size_t len,
unsigned int attributes );
extern int no_add_queue( struct object *obj, struct wait_queue_entry *entry ); extern int no_add_queue( struct object *obj, struct wait_queue_entry *entry );
extern int no_satisfied( struct object *obj, struct thread *thread ); extern int no_satisfied( struct object *obj, struct thread *thread );
extern int no_signal( struct object *obj, unsigned int access ); extern int no_signal( struct object *obj, unsigned int access );
...@@ -115,7 +116,7 @@ extern void dump_objects(void); ...@@ -115,7 +116,7 @@ extern void dump_objects(void);
struct event; struct event;
extern struct event *create_event( const WCHAR *name, size_t len, extern struct event *create_event( const WCHAR *name, size_t len, unsigned int attr,
int manual_reset, int initial_state ); int manual_reset, int initial_state );
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 void pulse_event( struct event *event ); extern void pulse_event( struct event *event );
......
...@@ -993,7 +993,7 @@ DECL_HANDLER(init_process_done) ...@@ -993,7 +993,7 @@ DECL_HANDLER(init_process_done)
generate_startup_debug_events( process, req->entry ); generate_startup_debug_events( process, req->entry );
set_process_startup_state( process, STARTUP_DONE ); set_process_startup_state( process, STARTUP_DONE );
if (req->gui) process->idle_event = create_event( NULL, 0, 1, 0 ); if (req->gui) process->idle_event = create_event( NULL, 0, 0, 1, 0 );
if (current->suspend + process->suspend > 0) stop_thread( current ); if (current->suspend + process->suspend > 0) stop_thread( current );
if (process->debugger) set_process_debug_flag( process, 1 ); if (process->debugger) set_process_debug_flag( process, 1 );
} }
......
...@@ -59,7 +59,7 @@ static const struct object_ops semaphore_ops = ...@@ -59,7 +59,7 @@ static const struct object_ops semaphore_ops =
}; };
static struct semaphore *create_semaphore( const WCHAR *name, size_t len, static struct semaphore *create_semaphore( const WCHAR *name, size_t len, unsigned int attr,
unsigned int initial, unsigned int max ) unsigned int initial, unsigned int max )
{ {
struct semaphore *sem; struct semaphore *sem;
...@@ -69,7 +69,7 @@ static struct semaphore *create_semaphore( const WCHAR *name, size_t len, ...@@ -69,7 +69,7 @@ static struct semaphore *create_semaphore( const WCHAR *name, size_t len,
set_error( STATUS_INVALID_PARAMETER ); set_error( STATUS_INVALID_PARAMETER );
return NULL; return NULL;
} }
if ((sem = create_named_object( sync_namespace, &semaphore_ops, name, len ))) if ((sem = create_named_object( sync_namespace, &semaphore_ops, name, len, attr )))
{ {
if (get_error() != STATUS_OBJECT_NAME_COLLISION) if (get_error() != STATUS_OBJECT_NAME_COLLISION)
{ {
...@@ -147,7 +147,7 @@ DECL_HANDLER(create_semaphore) ...@@ -147,7 +147,7 @@ DECL_HANDLER(create_semaphore)
struct semaphore *sem; struct semaphore *sem;
reply->handle = 0; reply->handle = 0;
if ((sem = create_semaphore( get_req_data(), get_req_data_size(), if ((sem = create_semaphore( get_req_data(), get_req_data_size(), req->attributes,
req->initial, req->max ))) req->initial, req->max )))
{ {
reply->handle = alloc_handle( current->process, sem, req->access, reply->handle = alloc_handle( current->process, sem, req->access,
......
...@@ -68,11 +68,12 @@ static const struct object_ops timer_ops = ...@@ -68,11 +68,12 @@ static const struct object_ops timer_ops =
/* create a timer object */ /* create a timer object */
static struct timer *create_timer( const WCHAR *name, size_t len, int manual ) static struct timer *create_timer( const WCHAR *name, size_t len, unsigned int attr,
int manual )
{ {
struct timer *timer; struct timer *timer;
if ((timer = create_named_object( sync_namespace, &timer_ops, name, len ))) if ((timer = create_named_object( sync_namespace, &timer_ops, name, len, attr )))
{ {
if (get_error() != STATUS_OBJECT_NAME_COLLISION) if (get_error() != STATUS_OBJECT_NAME_COLLISION)
{ {
...@@ -205,7 +206,7 @@ DECL_HANDLER(create_timer) ...@@ -205,7 +206,7 @@ DECL_HANDLER(create_timer)
struct timer *timer; struct timer *timer;
reply->handle = 0; reply->handle = 0;
if ((timer = create_timer( get_req_data(), get_req_data_size(), req->manual ))) if ((timer = create_timer( get_req_data(), get_req_data_size(), req->attributes, req->manual )))
{ {
reply->handle = alloc_handle( current->process, timer, req->access, reply->handle = alloc_handle( current->process, timer, req->access,
req->attributes & OBJ_INHERIT ); req->attributes & OBJ_INHERIT );
......
...@@ -93,7 +93,8 @@ static struct winstation *create_winstation( const WCHAR *name, size_t len, unsi ...@@ -93,7 +93,8 @@ static struct winstation *create_winstation( const WCHAR *name, size_t len, unsi
return NULL; return NULL;
} }
if ((winstation = create_named_object( winstation_namespace, &winstation_ops, name, len ))) if ((winstation = create_named_object( winstation_namespace, &winstation_ops, name, len,
OBJ_CASE_INSENSITIVE )))
{ {
if (get_error() != STATUS_OBJECT_NAME_COLLISION) if (get_error() != STATUS_OBJECT_NAME_COLLISION)
{ {
...@@ -182,7 +183,8 @@ static struct desktop *create_desktop( const WCHAR *name, size_t len, unsigned i ...@@ -182,7 +183,8 @@ static struct desktop *create_desktop( const WCHAR *name, size_t len, unsigned i
if (!(full_name = build_desktop_name( name, len, winstation, &full_len ))) return NULL; if (!(full_name = build_desktop_name( name, len, winstation, &full_len ))) return NULL;
if ((desktop = create_named_object( winstation_namespace, &desktop_ops, full_name, full_len ))) if ((desktop = create_named_object( winstation_namespace, &desktop_ops, full_name, full_len,
OBJ_CASE_INSENSITIVE )))
{ {
if (get_error() != STATUS_OBJECT_NAME_COLLISION) if (get_error() != STATUS_OBJECT_NAME_COLLISION)
{ {
...@@ -323,7 +325,8 @@ DECL_HANDLER(open_winstation) ...@@ -323,7 +325,8 @@ DECL_HANDLER(open_winstation)
{ {
if (winstation_namespace) if (winstation_namespace)
reply->handle = open_object( winstation_namespace, get_req_data(), get_req_data_size(), reply->handle = open_object( winstation_namespace, get_req_data(), get_req_data_size(),
&winstation_ops, req->access, (req->inherit) ? OBJ_INHERIT:0 ); &winstation_ops, req->access,
OBJ_CASE_INSENSITIVE | (req->inherit ? OBJ_INHERIT:0) );
else else
set_error( STATUS_OBJECT_NAME_NOT_FOUND ); set_error( STATUS_OBJECT_NAME_NOT_FOUND );
} }
...@@ -398,7 +401,7 @@ DECL_HANDLER(open_desktop) ...@@ -398,7 +401,7 @@ DECL_HANDLER(open_desktop)
{ {
reply->handle = open_object( winstation_namespace, full_name, full_len, reply->handle = open_object( winstation_namespace, full_name, full_len,
&desktop_ops, req->access, &desktop_ops, req->access,
(req->inherit) ? OBJ_INHERIT:0 ); OBJ_CASE_INSENSITIVE | (req->inherit ? OBJ_INHERIT:0) );
free( full_name ); free( full_name );
} }
release_object( winstation ); release_object( winstation );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment