Commit 705686e2 authored by Alexandre Julliard's avatar Alexandre Julliard

Added wine.conf option for new format registry files.

Added optional periodic saving of the registry.
parent 53f3a831
......@@ -963,6 +963,7 @@ struct set_registry_levels_request
{
IN int current; /* new current level */
IN int saving; /* new saving level */
IN int version; /* file format version for saving */
};
......
......@@ -47,6 +47,7 @@
#include "winreg.h"
#include "winversion.h"
#include "server.h"
#include "services.h"
DEFAULT_DEBUG_CHANNEL(reg)
......@@ -333,6 +334,7 @@ void SHELL_SaveRegistry( void )
/* set saving level (0 for saving everything, 1 for saving only modified keys) */
req->current = 1;
req->saving = !all;
req->version = PROFILE_GetWineIniBool( "registry", "UseNewFormat", 0 ) ? 2 : 1;
server_call( REQ_SET_REGISTRY_LEVELS );
SHELL_SaveRegistryBranch(HKEY_CURRENT_USER);
......@@ -340,6 +342,11 @@ void SHELL_SaveRegistry( void )
SHELL_SaveRegistryBranch(HKEY_USERS);
}
/* Periodic save callback */
static void CALLBACK periodic_save( ULONG_PTR dummy )
{
SHELL_SaveRegistry();
}
/************************ LOAD Registry Function ****************************/
......@@ -1275,6 +1282,7 @@ void _w31_loadreg(void) {
void SHELL_LoadRegistry( void )
{
struct set_registry_levels_request *req = get_req_buffer();
int save_timeout;
char *fn, *home;
HKEY hkey;
......@@ -1285,6 +1293,7 @@ void SHELL_LoadRegistry( void )
/* set level to 0 for loading system files */
req->current = 0;
req->saving = 0;
req->version = 1;
server_call( REQ_SET_REGISTRY_LEVELS );
if (PROFILE_GetWineIniBool ("registry", "LoadWindowsRegistryFiles", 1))
......@@ -1313,6 +1322,7 @@ void SHELL_LoadRegistry( void )
/* set level to 1 for loading user files */
req->current = 1;
req->saving = 0;
req->version = 1;
server_call( REQ_SET_REGISTRY_LEVELS );
/*
......@@ -1442,6 +1452,11 @@ void SHELL_LoadRegistry( void )
RegCloseKey(hkey);
}
if ((save_timeout = PROFILE_GetWineIniInt( "registry", "PeriodicSave", 0 )))
{
SERVICE_AddTimer( save_timeout * 1000000, periodic_save, 0 );
}
}
......
......@@ -1532,5 +1532,6 @@ DECL_HANDLER(set_registry_levels)
{
current_level = req->current;
saving_level = req->saving;
saving_version = req->version;
}
......@@ -990,7 +990,8 @@ static void dump_save_registry_request( struct save_registry_request *req )
static void dump_set_registry_levels_request( struct set_registry_levels_request *req )
{
fprintf( stderr, " current=%d,", req->current );
fprintf( stderr, " saving=%d", req->saving );
fprintf( stderr, " saving=%d,", req->saving );
fprintf( stderr, " version=%d", req->version );
}
static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
......
......@@ -152,6 +152,10 @@ LoadAltRegistryFiles=Y
WritetoHomeRegistryFiles=Y
; TRY to write all changes to alt registries
WritetoAltRegistryFiles=Y
; Use new file format
UseNewFormat=N
; Registry periodic save timeout in seconds
; PeriodicSave=600
[Tweak.Layout]
;; WineLook=xxx (supported styles are 'Win31'(default), 'Win95', 'Win98')
......
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