Load the HKEY_CURRENT_USER branch at server startup too.

This commit is contained in:
Alexandre Julliard 2005-07-11 20:44:59 +00:00
parent c33bd1b71b
commit 6aa0cc5e3c
6 changed files with 15 additions and 82 deletions

View File

@ -253,23 +253,9 @@ static void create_hardware_branch(void)
*/
void convert_old_config(void)
{
HANDLE hkey_current_user;
if (allocate_default_keys() == REG_OPENED_EXISTING_KEY)
return; /* someone else already loaded the registry */
RtlOpenCurrentUser( KEY_ALL_ACCESS, &hkey_current_user );
/* load the user registry (FIXME: should be done at server init time) */
SERVER_START_REQ( load_user_registries )
{
req->hkey = hkey_current_user;
wine_server_call( req );
}
SERVER_END_REQ;
/* create some hardware keys (FIXME: should not be done here) */
create_hardware_branch();
NtClose( hkey_current_user );
}

View File

@ -1859,20 +1859,6 @@ struct save_registry_reply
struct load_user_registries_request
{
struct request_header __header;
obj_handle_t hkey;
int saving;
int period;
};
struct load_user_registries_reply
{
struct reply_header __header;
};
struct set_registry_notification_request
{
struct request_header __header;
@ -3677,7 +3663,6 @@ enum request
REQ_load_registry,
REQ_unload_registry,
REQ_save_registry,
REQ_load_user_registries,
REQ_set_registry_notification,
REQ_create_timer,
REQ_open_timer,
@ -3889,7 +3874,6 @@ union generic_request
struct load_registry_request load_registry_request;
struct unload_registry_request unload_registry_request;
struct save_registry_request save_registry_request;
struct load_user_registries_request load_user_registries_request;
struct set_registry_notification_request set_registry_notification_request;
struct create_timer_request create_timer_request;
struct open_timer_request open_timer_request;
@ -4099,7 +4083,6 @@ union generic_reply
struct load_registry_reply load_registry_reply;
struct unload_registry_reply unload_registry_reply;
struct save_registry_reply save_registry_reply;
struct load_user_registries_reply load_user_registries_reply;
struct set_registry_notification_reply set_registry_notification_reply;
struct create_timer_reply create_timer_reply;
struct open_timer_reply open_timer_reply;
@ -4206,6 +4189,6 @@ union generic_reply
struct set_mailslot_info_reply set_mailslot_info_reply;
};
#define SERVER_PROTOCOL_VERSION 181
#define SERVER_PROTOCOL_VERSION 182
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -1341,14 +1341,6 @@ enum char_info_mode
@END
/* Load the user registry files */
@REQ(load_user_registries)
obj_handle_t hkey; /* key for HKCU */
int saving; /* new saving level */
int period; /* duration between periodic saves (milliseconds) */
@END
/* Add a registry key change notification */
@REQ(set_registry_notification)
obj_handle_t hkey; /* key to watch for changes */

View File

@ -1421,30 +1421,14 @@ static void load_init_registry_from_file( const char *filename, struct key *key
}
}
/* load the user registry files */
static void load_user_registries( struct key *key_current_user )
{
const char *config = wine_get_config_dir();
char *filename;
/* load user.reg into HKEY_CURRENT_USER */
if (!(filename = mem_alloc( strlen(config) + sizeof("/user.reg") ))) return;
strcpy( filename, config );
strcat( filename, "/user.reg" );
load_init_registry_from_file( filename, key_current_user );
free( filename );
/* start the periodic save timer */
set_periodic_save_timer();
}
/* registry initialisation */
void init_registry(void)
{
static const WCHAR root_name[] = { 0 };
static const WCHAR HKLM[] = { 'M','a','c','h','i','n','e' };
static const WCHAR HKU_default[] = { 'U','s','e','r','\\','.','D','e','f','a','u','l','t' };
/* FIXME: hardcoded to match what NtQueryTokenInformation currently returns */
static const WCHAR HKCU[] = {'U','s','e','r','\\','S','-','1','-','5','-','4',0};
const char *config = wine_get_config_dir();
char *p, *filename;
@ -1479,7 +1463,19 @@ void init_registry(void)
load_init_registry_from_file( filename, key );
release_object( key );
/* load user.reg into HKEY_CURRENT_USER */
if (!(key = create_key( root_key, copy_path( HKCU, sizeof(HKCU), 0 ),
NULL, 0, time(NULL), &dummy )))
fatal_error( "could not create HKEY_CURRENT_USER registry key\n" );
strcpy( p, "/user.reg" );
load_init_registry_from_file( filename, key );
release_object( key );
free( filename );
/* start the periodic save timer */
set_periodic_save_timer();
}
/* save a registry branch to a file */
@ -1894,18 +1890,6 @@ DECL_HANDLER(save_registry)
}
}
/* load the user registry files */
DECL_HANDLER(load_user_registries)
{
struct key *key;
if ((key = get_hkey_obj( req->hkey, KEY_SET_VALUE | KEY_CREATE_SUB_KEY )))
{
load_user_registries( key );
release_object( key );
}
}
/* add a registry key change notification */
DECL_HANDLER(set_registry_notification)
{

View File

@ -203,7 +203,6 @@ DECL_HANDLER(delete_key_value);
DECL_HANDLER(load_registry);
DECL_HANDLER(unload_registry);
DECL_HANDLER(save_registry);
DECL_HANDLER(load_user_registries);
DECL_HANDLER(set_registry_notification);
DECL_HANDLER(create_timer);
DECL_HANDLER(open_timer);
@ -414,7 +413,6 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_load_registry,
(req_handler)req_unload_registry,
(req_handler)req_save_registry,
(req_handler)req_load_user_registries,
(req_handler)req_set_registry_notification,
(req_handler)req_create_timer,
(req_handler)req_open_timer,

View File

@ -1770,13 +1770,6 @@ static void dump_save_registry_request( const struct save_registry_request *req
fprintf( stderr, " file=%p", req->file );
}
static void dump_load_user_registries_request( const struct load_user_registries_request *req )
{
fprintf( stderr, " hkey=%p,", req->hkey );
fprintf( stderr, " saving=%d,", req->saving );
fprintf( stderr, " period=%d", req->period );
}
static void dump_set_registry_notification_request( const struct set_registry_notification_request *req )
{
fprintf( stderr, " hkey=%p,", req->hkey );
@ -3175,7 +3168,6 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_load_registry_request,
(dump_func)dump_unload_registry_request,
(dump_func)dump_save_registry_request,
(dump_func)dump_load_user_registries_request,
(dump_func)dump_set_registry_notification_request,
(dump_func)dump_create_timer_request,
(dump_func)dump_open_timer_request,
@ -3384,7 +3376,6 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)0,
(dump_func)0,
(dump_func)0,
(dump_func)0,
(dump_func)dump_create_timer_reply,
(dump_func)dump_open_timer_reply,
(dump_func)dump_set_timer_reply,
@ -3591,7 +3582,6 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"load_registry",
"unload_registry",
"save_registry",
"load_user_registries",
"set_registry_notification",
"create_timer",
"open_timer",