server: Directly return a structure in get_req_unicode_str().

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-01-29 16:36:45 +09:00
parent ed268bbf91
commit 008f14f03f
17 changed files with 32 additions and 58 deletions

View File

@ -382,12 +382,11 @@ void release_global_atom( struct winstation *winstation, atom_t atom )
/* add a global 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 );
if (table)
{
get_req_unicode_str( &name );
reply->atom = add_atom( table, &name );
release_object( table );
}
@ -407,12 +406,11 @@ DECL_HANDLER(delete_atom)
/* find a global 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 );
if (table)
{
get_req_unicode_str( &name );
reply->atom = find_atom( table, &name );
release_object( table );
}

View File

@ -150,10 +150,9 @@ client_ptr_t get_class_client_ptr( struct window_class *class )
DECL_HANDLER(create_class)
{
struct window_class *class;
struct unicode_str name;
struct unicode_str name = get_req_unicode_str();
atom_t atom;
get_req_unicode_str( &name );
if (name.len)
{
atom = add_global_atom( NULL, &name );
@ -197,10 +196,9 @@ DECL_HANDLER(create_class)
DECL_HANDLER(destroy_class)
{
struct window_class *class;
struct unicode_str name;
struct unicode_str name = get_req_unicode_str();
atom_t atom = req->atom;
get_req_unicode_str( &name );
if (name.len) atom = find_global_atom( NULL, &name );
if (!(class = find_class( current->process, atom, req->instance )))

View File

@ -196,9 +196,8 @@ DECL_HANDLER(create_completion)
/* open a 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,
&completion_ops, &name, req->attributes );
}

View File

@ -708,7 +708,7 @@ DECL_HANDLER(create_device_manager)
DECL_HANDLER(create_device)
{
struct device *device;
struct unicode_str name;
struct unicode_str name = get_req_unicode_str();
struct device_manager *manager;
struct directory *root = NULL;
@ -716,7 +716,6 @@ DECL_HANDLER(create_device)
0, &device_manager_ops )))
return;
get_req_unicode_str( &name );
if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 )))
{
release_object( manager );

View File

@ -522,9 +522,8 @@ DECL_HANDLER(create_directory)
/* open a directory object */
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,
&directory_ops, &name, req->attributes );
}

View File

@ -306,9 +306,8 @@ DECL_HANDLER(create_event)
/* open a handle to an 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,
&event_ops, &name, req->attributes );
}
@ -378,9 +377,8 @@ DECL_HANDLER(create_keyed_event)
/* open a handle to a 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,
&keyed_event_ops, &name, req->attributes );
}

View File

@ -2384,11 +2384,10 @@ DECL_HANDLER(flush)
/* open a file object */
DECL_HANDLER(open_file_object)
{
struct unicode_str name;
struct unicode_str name = get_req_unicode_str();
struct directory *root = NULL;
struct object *obj, *result;
get_req_unicode_str( &name );
if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 )))
{
if (get_error() != STATUS_OBJECT_TYPE_MISMATCH) return;

View File

@ -687,9 +687,8 @@ DECL_HANDLER(create_mapping)
/* open a handle to a 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,
&mapping_ops, &name, req->attributes );
}

View File

@ -233,9 +233,8 @@ DECL_HANDLER(create_mutex)
/* open a handle to a 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,
&mutex_ops, &name, req->attributes );
}

View File

@ -1561,9 +1561,8 @@ DECL_HANDLER(create_job)
/* open a job object */
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,
&job_ops, &name, req->attributes );
}

View File

@ -2142,12 +2142,11 @@ DECL_HANDLER(set_key_value)
DECL_HANDLER(get_key_value)
{
struct key *key;
struct unicode_str name;
struct unicode_str name = get_req_unicode_str();
reply->total = 0;
if ((key = get_hkey_obj( req->hkey, KEY_QUERY_VALUE )))
{
get_req_unicode_str( &name );
get_value( key, &name, &reply->type, &reply->total );
release_object( key );
}
@ -2169,11 +2168,10 @@ DECL_HANDLER(enum_key_value)
DECL_HANDLER(delete_key_value)
{
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 )))
{
get_req_unicode_str( &name );
delete_value( key, &name );
release_object( key );
}

View File

@ -77,10 +77,12 @@ static inline data_size_t get_req_data_size(void)
}
/* 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();
str->len = (get_req_data_size() / sizeof(WCHAR)) * sizeof(WCHAR);
struct unicode_str ret;
ret.str = get_req_data();
ret.len = (get_req_data_size() / sizeof(WCHAR)) * sizeof(WCHAR);
return ret;
}
/* get the reply maximum vararg size */

View File

@ -201,9 +201,8 @@ DECL_HANDLER(create_semaphore)
/* open a handle to a 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,
&semaphore_ops, &name, req->attributes );
}

View File

@ -189,9 +189,8 @@ DECL_HANDLER(create_symlink)
/* open a symbolic link object */
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,
&symlink_ops, &name, req->attributes | OBJ_OPENLINK );
}

View File

@ -251,9 +251,8 @@ DECL_HANDLER(create_timer)
/* open a handle to a 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,
&timer_ops, &name, req->attributes );
}

View File

@ -1884,7 +1884,7 @@ void destroy_window( struct window *win )
DECL_HANDLER(create_window)
{
struct window *win, *parent = NULL, *owner = NULL;
struct unicode_str cls_name;
struct unicode_str cls_name = get_req_unicode_str();
atom_t atom;
reply->handle = 0;
@ -1904,7 +1904,6 @@ DECL_HANDLER(create_window)
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;
if (!(win = create_window( parent, owner, atom, req->instance ))) return;
@ -2118,11 +2117,10 @@ DECL_HANDLER(get_window_children)
unsigned int total;
user_handle_t *data;
data_size_t len;
struct unicode_str cls_name;
struct unicode_str cls_name = get_req_unicode_str();
atom_t atom = req->atom;
struct desktop *desktop = NULL;
get_req_unicode_str( &cls_name );
if (cls_name.len && !(atom = find_global_atom( NULL, &cls_name ))) return;
if (req->desktop)
@ -2673,12 +2671,11 @@ DECL_HANDLER(redraw_window)
/* set a 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 );
if (!win) return;
get_req_unicode_str( &name );
if (name.len)
{
atom_t atom = add_global_atom( NULL, &name );
@ -2695,10 +2692,9 @@ DECL_HANDLER(set_window_property)
/* remove a 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 );
get_req_unicode_str( &name );
if (win)
{
atom_t atom = name.len ? find_global_atom( NULL, &name ) : req->atom;
@ -2710,10 +2706,9 @@ DECL_HANDLER(remove_window_property)
/* get a 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 );
get_req_unicode_str( &name );
if (win)
{
atom_t atom = name.len ? find_global_atom( NULL, &name ) : req->atom;

View File

@ -401,11 +401,10 @@ void close_thread_desktop( struct thread *thread )
DECL_HANDLER(create_winstation)
{
struct winstation *winstation;
struct unicode_str name;
struct unicode_str name = get_req_unicode_str();
struct directory *root = NULL;
reply->handle = 0;
get_req_unicode_str( &name );
if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 ))) return;
if ((winstation = create_winstation( root, &name, req->attributes, req->flags )))
@ -419,9 +418,8 @@ DECL_HANDLER(create_winstation)
/* open a handle to a window station */
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,
&winstation_ops, &name, req->attributes );
}
@ -467,10 +465,9 @@ DECL_HANDLER(create_desktop)
{
struct desktop *desktop;
struct winstation *winstation;
struct unicode_str name;
struct unicode_str name = get_req_unicode_str();
reply->handle = 0;
get_req_unicode_str( &name );
if ((winstation = get_process_winstation( current->process, WINSTA_CREATEDESKTOP )))
{
if ((desktop = create_desktop( &name, req->attributes, req->flags, winstation )))
@ -487,9 +484,7 @@ DECL_HANDLER(open_desktop)
{
struct winstation *winstation;
struct object *obj;
struct unicode_str name;
get_req_unicode_str( &name );
struct unicode_str name = get_req_unicode_str();
/* FIXME: check access rights */
if (!req->winsta)