Commit 008f14f0 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Directly return a structure in get_req_unicode_str().

parent ed268bbf
...@@ -382,12 +382,11 @@ void release_global_atom( struct winstation *winstation, atom_t atom ) ...@@ -382,12 +382,11 @@ void release_global_atom( struct winstation *winstation, atom_t atom )
/* add a global atom */ /* add a global atom */
DECL_HANDLER(add_atom) DECL_HANDLER(add_atom)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
struct atom_table *table = get_table( req->table, 1 ); struct atom_table *table = get_table( req->table, 1 );
if (table) if (table)
{ {
get_req_unicode_str( &name );
reply->atom = add_atom( table, &name ); reply->atom = add_atom( table, &name );
release_object( table ); release_object( table );
} }
...@@ -407,12 +406,11 @@ DECL_HANDLER(delete_atom) ...@@ -407,12 +406,11 @@ DECL_HANDLER(delete_atom)
/* find a global atom */ /* find a global atom */
DECL_HANDLER(find_atom) DECL_HANDLER(find_atom)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
struct atom_table *table = get_table( req->table, 0 ); struct atom_table *table = get_table( req->table, 0 );
if (table) if (table)
{ {
get_req_unicode_str( &name );
reply->atom = find_atom( table, &name ); reply->atom = find_atom( table, &name );
release_object( table ); release_object( table );
} }
......
...@@ -150,10 +150,9 @@ client_ptr_t get_class_client_ptr( struct window_class *class ) ...@@ -150,10 +150,9 @@ client_ptr_t get_class_client_ptr( struct window_class *class )
DECL_HANDLER(create_class) DECL_HANDLER(create_class)
{ {
struct window_class *class; struct window_class *class;
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
atom_t atom; atom_t atom;
get_req_unicode_str( &name );
if (name.len) if (name.len)
{ {
atom = add_global_atom( NULL, &name ); atom = add_global_atom( NULL, &name );
...@@ -197,10 +196,9 @@ DECL_HANDLER(create_class) ...@@ -197,10 +196,9 @@ DECL_HANDLER(create_class)
DECL_HANDLER(destroy_class) DECL_HANDLER(destroy_class)
{ {
struct window_class *class; struct window_class *class;
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
atom_t atom = req->atom; atom_t atom = req->atom;
get_req_unicode_str( &name );
if (name.len) atom = find_global_atom( NULL, &name ); if (name.len) atom = find_global_atom( NULL, &name );
if (!(class = find_class( current->process, atom, req->instance ))) if (!(class = find_class( current->process, atom, req->instance )))
......
...@@ -196,9 +196,8 @@ DECL_HANDLER(create_completion) ...@@ -196,9 +196,8 @@ DECL_HANDLER(create_completion)
/* open a completion */ /* open a completion */
DECL_HANDLER(open_completion) DECL_HANDLER(open_completion)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
get_req_unicode_str( &name );
reply->handle = open_object( current->process, req->rootdir, req->access, reply->handle = open_object( current->process, req->rootdir, req->access,
&completion_ops, &name, req->attributes ); &completion_ops, &name, req->attributes );
} }
......
...@@ -708,7 +708,7 @@ DECL_HANDLER(create_device_manager) ...@@ -708,7 +708,7 @@ DECL_HANDLER(create_device_manager)
DECL_HANDLER(create_device) DECL_HANDLER(create_device)
{ {
struct device *device; struct device *device;
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
struct device_manager *manager; struct device_manager *manager;
struct directory *root = NULL; struct directory *root = NULL;
...@@ -716,7 +716,6 @@ DECL_HANDLER(create_device) ...@@ -716,7 +716,6 @@ DECL_HANDLER(create_device)
0, &device_manager_ops ))) 0, &device_manager_ops )))
return; return;
get_req_unicode_str( &name );
if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 ))) if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 )))
{ {
release_object( manager ); release_object( manager );
......
...@@ -522,9 +522,8 @@ DECL_HANDLER(create_directory) ...@@ -522,9 +522,8 @@ DECL_HANDLER(create_directory)
/* open a directory object */ /* open a directory object */
DECL_HANDLER(open_directory) DECL_HANDLER(open_directory)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
get_req_unicode_str( &name );
reply->handle = open_object( current->process, req->rootdir, req->access, reply->handle = open_object( current->process, req->rootdir, req->access,
&directory_ops, &name, req->attributes ); &directory_ops, &name, req->attributes );
} }
......
...@@ -306,9 +306,8 @@ DECL_HANDLER(create_event) ...@@ -306,9 +306,8 @@ DECL_HANDLER(create_event)
/* open a handle to an event */ /* open a handle to an event */
DECL_HANDLER(open_event) DECL_HANDLER(open_event)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
get_req_unicode_str( &name );
reply->handle = open_object( current->process, req->rootdir, req->access, reply->handle = open_object( current->process, req->rootdir, req->access,
&event_ops, &name, req->attributes ); &event_ops, &name, req->attributes );
} }
...@@ -378,9 +377,8 @@ DECL_HANDLER(create_keyed_event) ...@@ -378,9 +377,8 @@ DECL_HANDLER(create_keyed_event)
/* open a handle to a keyed event */ /* open a handle to a keyed event */
DECL_HANDLER(open_keyed_event) DECL_HANDLER(open_keyed_event)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
get_req_unicode_str( &name );
reply->handle = open_object( current->process, req->rootdir, req->access, reply->handle = open_object( current->process, req->rootdir, req->access,
&keyed_event_ops, &name, req->attributes ); &keyed_event_ops, &name, req->attributes );
} }
...@@ -2384,11 +2384,10 @@ DECL_HANDLER(flush) ...@@ -2384,11 +2384,10 @@ DECL_HANDLER(flush)
/* open a file object */ /* open a file object */
DECL_HANDLER(open_file_object) DECL_HANDLER(open_file_object)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
struct directory *root = NULL; struct directory *root = NULL;
struct object *obj, *result; struct object *obj, *result;
get_req_unicode_str( &name );
if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 ))) if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 )))
{ {
if (get_error() != STATUS_OBJECT_TYPE_MISMATCH) return; if (get_error() != STATUS_OBJECT_TYPE_MISMATCH) return;
......
...@@ -687,9 +687,8 @@ DECL_HANDLER(create_mapping) ...@@ -687,9 +687,8 @@ DECL_HANDLER(create_mapping)
/* open a handle to a mapping */ /* open a handle to a mapping */
DECL_HANDLER(open_mapping) DECL_HANDLER(open_mapping)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
get_req_unicode_str( &name );
reply->handle = open_object( current->process, req->rootdir, req->access, reply->handle = open_object( current->process, req->rootdir, req->access,
&mapping_ops, &name, req->attributes ); &mapping_ops, &name, req->attributes );
} }
......
...@@ -233,9 +233,8 @@ DECL_HANDLER(create_mutex) ...@@ -233,9 +233,8 @@ DECL_HANDLER(create_mutex)
/* open a handle to a mutex */ /* open a handle to a mutex */
DECL_HANDLER(open_mutex) DECL_HANDLER(open_mutex)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
get_req_unicode_str( &name );
reply->handle = open_object( current->process, req->rootdir, req->access, reply->handle = open_object( current->process, req->rootdir, req->access,
&mutex_ops, &name, req->attributes ); &mutex_ops, &name, req->attributes );
} }
......
...@@ -1561,9 +1561,8 @@ DECL_HANDLER(create_job) ...@@ -1561,9 +1561,8 @@ DECL_HANDLER(create_job)
/* open a job object */ /* open a job object */
DECL_HANDLER(open_job) DECL_HANDLER(open_job)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
get_req_unicode_str( &name );
reply->handle = open_object( current->process, req->rootdir, req->access, reply->handle = open_object( current->process, req->rootdir, req->access,
&job_ops, &name, req->attributes ); &job_ops, &name, req->attributes );
} }
......
...@@ -2142,12 +2142,11 @@ DECL_HANDLER(set_key_value) ...@@ -2142,12 +2142,11 @@ DECL_HANDLER(set_key_value)
DECL_HANDLER(get_key_value) DECL_HANDLER(get_key_value)
{ {
struct key *key; struct key *key;
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
reply->total = 0; reply->total = 0;
if ((key = get_hkey_obj( req->hkey, KEY_QUERY_VALUE ))) if ((key = get_hkey_obj( req->hkey, KEY_QUERY_VALUE )))
{ {
get_req_unicode_str( &name );
get_value( key, &name, &reply->type, &reply->total ); get_value( key, &name, &reply->type, &reply->total );
release_object( key ); release_object( key );
} }
...@@ -2169,11 +2168,10 @@ DECL_HANDLER(enum_key_value) ...@@ -2169,11 +2168,10 @@ DECL_HANDLER(enum_key_value)
DECL_HANDLER(delete_key_value) DECL_HANDLER(delete_key_value)
{ {
struct key *key; struct key *key;
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
if ((key = get_hkey_obj( req->hkey, KEY_SET_VALUE ))) if ((key = get_hkey_obj( req->hkey, KEY_SET_VALUE )))
{ {
get_req_unicode_str( &name );
delete_value( key, &name ); delete_value( key, &name );
release_object( key ); release_object( key );
} }
......
...@@ -77,10 +77,12 @@ static inline data_size_t get_req_data_size(void) ...@@ -77,10 +77,12 @@ static inline data_size_t get_req_data_size(void)
} }
/* get the request vararg as unicode string */ /* get the request vararg as unicode string */
static inline void get_req_unicode_str( struct unicode_str *str ) static inline struct unicode_str get_req_unicode_str(void)
{ {
str->str = get_req_data(); struct unicode_str ret;
str->len = (get_req_data_size() / sizeof(WCHAR)) * sizeof(WCHAR); ret.str = get_req_data();
ret.len = (get_req_data_size() / sizeof(WCHAR)) * sizeof(WCHAR);
return ret;
} }
/* get the reply maximum vararg size */ /* get the reply maximum vararg size */
......
...@@ -201,9 +201,8 @@ DECL_HANDLER(create_semaphore) ...@@ -201,9 +201,8 @@ DECL_HANDLER(create_semaphore)
/* open a handle to a semaphore */ /* open a handle to a semaphore */
DECL_HANDLER(open_semaphore) DECL_HANDLER(open_semaphore)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
get_req_unicode_str( &name );
reply->handle = open_object( current->process, req->rootdir, req->access, reply->handle = open_object( current->process, req->rootdir, req->access,
&semaphore_ops, &name, req->attributes ); &semaphore_ops, &name, req->attributes );
} }
......
...@@ -189,9 +189,8 @@ DECL_HANDLER(create_symlink) ...@@ -189,9 +189,8 @@ DECL_HANDLER(create_symlink)
/* open a symbolic link object */ /* open a symbolic link object */
DECL_HANDLER(open_symlink) DECL_HANDLER(open_symlink)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
get_req_unicode_str( &name );
reply->handle = open_object( current->process, req->rootdir, req->access, reply->handle = open_object( current->process, req->rootdir, req->access,
&symlink_ops, &name, req->attributes | OBJ_OPENLINK ); &symlink_ops, &name, req->attributes | OBJ_OPENLINK );
} }
......
...@@ -251,9 +251,8 @@ DECL_HANDLER(create_timer) ...@@ -251,9 +251,8 @@ DECL_HANDLER(create_timer)
/* open a handle to a timer */ /* open a handle to a timer */
DECL_HANDLER(open_timer) DECL_HANDLER(open_timer)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
get_req_unicode_str( &name );
reply->handle = open_object( current->process, req->rootdir, req->access, reply->handle = open_object( current->process, req->rootdir, req->access,
&timer_ops, &name, req->attributes ); &timer_ops, &name, req->attributes );
} }
......
...@@ -1884,7 +1884,7 @@ void destroy_window( struct window *win ) ...@@ -1884,7 +1884,7 @@ void destroy_window( struct window *win )
DECL_HANDLER(create_window) DECL_HANDLER(create_window)
{ {
struct window *win, *parent = NULL, *owner = NULL; struct window *win, *parent = NULL, *owner = NULL;
struct unicode_str cls_name; struct unicode_str cls_name = get_req_unicode_str();
atom_t atom; atom_t atom;
reply->handle = 0; reply->handle = 0;
...@@ -1904,7 +1904,6 @@ DECL_HANDLER(create_window) ...@@ -1904,7 +1904,6 @@ DECL_HANDLER(create_window)
while (!is_desktop_window(owner->parent)) owner = owner->parent; while (!is_desktop_window(owner->parent)) owner = owner->parent;
} }
get_req_unicode_str( &cls_name );
atom = cls_name.len ? find_global_atom( NULL, &cls_name ) : req->atom; atom = cls_name.len ? find_global_atom( NULL, &cls_name ) : req->atom;
if (!(win = create_window( parent, owner, atom, req->instance ))) return; if (!(win = create_window( parent, owner, atom, req->instance ))) return;
...@@ -2118,11 +2117,10 @@ DECL_HANDLER(get_window_children) ...@@ -2118,11 +2117,10 @@ DECL_HANDLER(get_window_children)
unsigned int total; unsigned int total;
user_handle_t *data; user_handle_t *data;
data_size_t len; data_size_t len;
struct unicode_str cls_name; struct unicode_str cls_name = get_req_unicode_str();
atom_t atom = req->atom; atom_t atom = req->atom;
struct desktop *desktop = NULL; struct desktop *desktop = NULL;
get_req_unicode_str( &cls_name );
if (cls_name.len && !(atom = find_global_atom( NULL, &cls_name ))) return; if (cls_name.len && !(atom = find_global_atom( NULL, &cls_name ))) return;
if (req->desktop) if (req->desktop)
...@@ -2673,12 +2671,11 @@ DECL_HANDLER(redraw_window) ...@@ -2673,12 +2671,11 @@ DECL_HANDLER(redraw_window)
/* set a window property */ /* set a window property */
DECL_HANDLER(set_window_property) DECL_HANDLER(set_window_property)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
struct window *win = get_window( req->window ); struct window *win = get_window( req->window );
if (!win) return; if (!win) return;
get_req_unicode_str( &name );
if (name.len) if (name.len)
{ {
atom_t atom = add_global_atom( NULL, &name ); atom_t atom = add_global_atom( NULL, &name );
...@@ -2695,10 +2692,9 @@ DECL_HANDLER(set_window_property) ...@@ -2695,10 +2692,9 @@ DECL_HANDLER(set_window_property)
/* remove a window property */ /* remove a window property */
DECL_HANDLER(remove_window_property) DECL_HANDLER(remove_window_property)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
struct window *win = get_window( req->window ); struct window *win = get_window( req->window );
get_req_unicode_str( &name );
if (win) if (win)
{ {
atom_t atom = name.len ? find_global_atom( NULL, &name ) : req->atom; atom_t atom = name.len ? find_global_atom( NULL, &name ) : req->atom;
...@@ -2710,10 +2706,9 @@ DECL_HANDLER(remove_window_property) ...@@ -2710,10 +2706,9 @@ DECL_HANDLER(remove_window_property)
/* get a window property */ /* get a window property */
DECL_HANDLER(get_window_property) DECL_HANDLER(get_window_property)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
struct window *win = get_window( req->window ); struct window *win = get_window( req->window );
get_req_unicode_str( &name );
if (win) if (win)
{ {
atom_t atom = name.len ? find_global_atom( NULL, &name ) : req->atom; atom_t atom = name.len ? find_global_atom( NULL, &name ) : req->atom;
......
...@@ -401,11 +401,10 @@ void close_thread_desktop( struct thread *thread ) ...@@ -401,11 +401,10 @@ void close_thread_desktop( struct thread *thread )
DECL_HANDLER(create_winstation) DECL_HANDLER(create_winstation)
{ {
struct winstation *winstation; struct winstation *winstation;
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
struct directory *root = NULL; struct directory *root = NULL;
reply->handle = 0; reply->handle = 0;
get_req_unicode_str( &name );
if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 ))) return; if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 ))) return;
if ((winstation = create_winstation( root, &name, req->attributes, req->flags ))) if ((winstation = create_winstation( root, &name, req->attributes, req->flags )))
...@@ -419,9 +418,8 @@ DECL_HANDLER(create_winstation) ...@@ -419,9 +418,8 @@ DECL_HANDLER(create_winstation)
/* open a handle to a window station */ /* open a handle to a window station */
DECL_HANDLER(open_winstation) DECL_HANDLER(open_winstation)
{ {
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
get_req_unicode_str( &name );
reply->handle = open_object( current->process, req->rootdir, req->access, reply->handle = open_object( current->process, req->rootdir, req->access,
&winstation_ops, &name, req->attributes ); &winstation_ops, &name, req->attributes );
} }
...@@ -467,10 +465,9 @@ DECL_HANDLER(create_desktop) ...@@ -467,10 +465,9 @@ DECL_HANDLER(create_desktop)
{ {
struct desktop *desktop; struct desktop *desktop;
struct winstation *winstation; struct winstation *winstation;
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
reply->handle = 0; reply->handle = 0;
get_req_unicode_str( &name );
if ((winstation = get_process_winstation( current->process, WINSTA_CREATEDESKTOP ))) if ((winstation = get_process_winstation( current->process, WINSTA_CREATEDESKTOP )))
{ {
if ((desktop = create_desktop( &name, req->attributes, req->flags, winstation ))) if ((desktop = create_desktop( &name, req->attributes, req->flags, winstation )))
...@@ -487,9 +484,7 @@ DECL_HANDLER(open_desktop) ...@@ -487,9 +484,7 @@ DECL_HANDLER(open_desktop)
{ {
struct winstation *winstation; struct winstation *winstation;
struct object *obj; struct object *obj;
struct unicode_str name; struct unicode_str name = get_req_unicode_str();
get_req_unicode_str( &name );
/* FIXME: check access rights */ /* FIXME: check access rights */
if (!req->winsta) if (!req->winsta)
......
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