server: Pass full object attributes in the load_registry request.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-01-19 15:17:00 +09:00
parent d01deff9cf
commit b99d1525de
6 changed files with 24 additions and 18 deletions

View File

@ -660,6 +660,8 @@ NTSTATUS WINAPI NtLoadKey( const OBJECT_ATTRIBUTES *attr, OBJECT_ATTRIBUTES *fil
NTSTATUS ret; NTSTATUS ret;
HANDLE hive; HANDLE hive;
IO_STATUS_BLOCK io; IO_STATUS_BLOCK io;
data_size_t len;
struct object_attributes *objattr;
TRACE("(%p,%p)\n", attr, file); TRACE("(%p,%p)\n", attr, file);
@ -667,17 +669,18 @@ NTSTATUS WINAPI NtLoadKey( const OBJECT_ATTRIBUTES *attr, OBJECT_ATTRIBUTES *fil
FILE_OPEN, 0, NULL, 0); FILE_OPEN, 0, NULL, 0);
if (ret) return ret; if (ret) return ret;
if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret;
SERVER_START_REQ( load_registry ) SERVER_START_REQ( load_registry )
{ {
req->hkey = wine_server_obj_handle( attr->RootDirectory );
req->file = wine_server_obj_handle( hive ); req->file = wine_server_obj_handle( hive );
wine_server_add_data(req, attr->ObjectName->Buffer, attr->ObjectName->Length); wine_server_add_data( req, objattr, len );
ret = wine_server_call( req ); ret = wine_server_call( req );
} }
SERVER_END_REQ; SERVER_END_REQ;
NtClose(hive); NtClose(hive);
RtlFreeHeap( GetProcessHeap(), 0, objattr );
return ret; return ret;
} }

View File

@ -2541,10 +2541,8 @@ struct delete_key_value_reply
struct load_registry_request struct load_registry_request
{ {
struct request_header __header; struct request_header __header;
obj_handle_t hkey;
obj_handle_t file; obj_handle_t file;
/* VARARG(name,unicode_str); */ /* VARARG(objattr,object_attributes); */
char __pad_20[4];
}; };
struct load_registry_reply struct load_registry_reply
{ {
@ -6157,6 +6155,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply; struct terminate_job_reply terminate_job_reply;
}; };
#define SERVER_PROTOCOL_VERSION 498 #define SERVER_PROTOCOL_VERSION 499
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -1916,9 +1916,8 @@ enum char_info_mode
/* Load a registry branch from a file */ /* Load a registry branch from a file */
@REQ(load_registry) @REQ(load_registry)
obj_handle_t hkey; /* root key to load to */
obj_handle_t file; /* file to load from */ obj_handle_t file; /* file to load from */
VARARG(name,unicode_str); /* subkey name */ VARARG(objattr,object_attributes); /* object attributes */
@END @END

View File

@ -2184,6 +2184,8 @@ DECL_HANDLER(load_registry)
{ {
struct key *key, *parent; struct key *key, *parent;
struct unicode_str name; struct unicode_str name;
const struct security_descriptor *sd;
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name );
if (!thread_single_check_privilege( current, &SeRestorePrivilege )) if (!thread_single_check_privilege( current, &SeRestorePrivilege ))
{ {
@ -2191,11 +2193,17 @@ DECL_HANDLER(load_registry)
return; return;
} }
if ((parent = get_parent_hkey_obj( req->hkey ))) if (!objattr->rootdir && name.len >= sizeof(root_name) &&
!memicmpW( name.str, root_name, sizeof(root_name)/sizeof(WCHAR) ))
{
name.str += sizeof(root_name)/sizeof(WCHAR);
name.len -= sizeof(root_name);
}
if ((parent = get_parent_hkey_obj( objattr->rootdir )))
{ {
int dummy; int dummy;
get_req_path( &name, !req->hkey ); if ((key = create_key( parent, &name, NULL, 0, KEY_WOW64_64KEY, 0, sd, &dummy )))
if ((key = create_key( parent, &name, NULL, 0, KEY_WOW64_64KEY, 0, NULL, &dummy )))
{ {
load_registry( key, req->file ); load_registry( key, req->file );
release_object( key ); release_object( key );

View File

@ -1336,9 +1336,8 @@ C_ASSERT( FIELD_OFFSET(struct enum_key_value_reply, namelen) == 16 );
C_ASSERT( sizeof(struct enum_key_value_reply) == 24 ); C_ASSERT( sizeof(struct enum_key_value_reply) == 24 );
C_ASSERT( FIELD_OFFSET(struct delete_key_value_request, hkey) == 12 ); C_ASSERT( FIELD_OFFSET(struct delete_key_value_request, hkey) == 12 );
C_ASSERT( sizeof(struct delete_key_value_request) == 16 ); C_ASSERT( sizeof(struct delete_key_value_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct load_registry_request, hkey) == 12 ); C_ASSERT( FIELD_OFFSET(struct load_registry_request, file) == 12 );
C_ASSERT( FIELD_OFFSET(struct load_registry_request, file) == 16 ); C_ASSERT( sizeof(struct load_registry_request) == 16 );
C_ASSERT( sizeof(struct load_registry_request) == 24 );
C_ASSERT( FIELD_OFFSET(struct unload_registry_request, hkey) == 12 ); C_ASSERT( FIELD_OFFSET(struct unload_registry_request, hkey) == 12 );
C_ASSERT( sizeof(struct unload_registry_request) == 16 ); C_ASSERT( sizeof(struct unload_registry_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct save_registry_request, hkey) == 12 ); C_ASSERT( FIELD_OFFSET(struct save_registry_request, hkey) == 12 );

View File

@ -2411,9 +2411,8 @@ static void dump_delete_key_value_request( const struct delete_key_value_request
static void dump_load_registry_request( const struct load_registry_request *req ) static void dump_load_registry_request( const struct load_registry_request *req )
{ {
fprintf( stderr, " hkey=%04x", req->hkey ); fprintf( stderr, " file=%04x", req->file );
fprintf( stderr, ", file=%04x", req->file ); dump_varargs_object_attributes( ", objattr=", cur_size );
dump_varargs_unicode_str( ", name=", cur_size );
} }
static void dump_unload_registry_request( const struct unload_registry_request *req ) static void dump_unload_registry_request( const struct unload_registry_request *req )