mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-05 20:09:10 +00:00
Allow the file names and paths for the registry files (user.reg and
system.reg) to be specified in a [Registry] section of wine.ini or other config file.
This commit is contained in:
parent
1dc7cbd965
commit
bd3771c2ee
|
@ -679,6 +679,8 @@ void SHELL_SaveRegistry( void )
|
|||
char buf[4];
|
||||
HKEY hkey;
|
||||
int all;
|
||||
int usedCfgUser = 0;
|
||||
int usedCfgLM = 0;
|
||||
|
||||
TRACE(reg,"(void)\n");
|
||||
|
||||
|
@ -703,11 +705,31 @@ void SHELL_SaveRegistry( void )
|
|||
}
|
||||
if (lstrcmpiA(buf,"yes"))
|
||||
all=1;
|
||||
|
||||
/* Try saving a config file specified User.reg save/load name */
|
||||
fn = xmalloc( MAX_PATHNAME_LEN );
|
||||
if (PROFILE_GetWineIniString ("Registry", "UserFileName", "", fn, MAX_PATHNAME_LEN - 1)) {
|
||||
_savereg(lookup_hkey(HKEY_CURRENT_USER),fn,all);
|
||||
usedCfgUser = 1;
|
||||
}
|
||||
free (fn);
|
||||
|
||||
/* Try saving a config file specified System.reg save/load name*/
|
||||
fn = xmalloc ( MAX_PATHNAME_LEN);
|
||||
if (PROFILE_GetWineIniString ("Registry", "LocalMachineFileName", "", fn, MAX_PATHNAME_LEN - 1)){
|
||||
_savereg(lookup_hkey(HKEY_LOCAL_MACHINE), fn, all);
|
||||
usedCfgLM = 1;
|
||||
}
|
||||
free (fn);
|
||||
|
||||
pwd=getpwuid(getuid());
|
||||
if (pwd!=NULL && pwd->pw_dir!=NULL)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
/* Hack to disable double save */
|
||||
if (usedCfgUser == 0){
|
||||
|
||||
fn=(char*)xmalloc( strlen(pwd->pw_dir) + strlen(WINE_PREFIX) +
|
||||
strlen(SAVE_CURRENT_USER) + 2 );
|
||||
strcpy(fn,pwd->pw_dir);
|
||||
|
@ -725,6 +747,12 @@ void SHELL_SaveRegistry( void )
|
|||
}
|
||||
free(tmp);
|
||||
free(fn);
|
||||
|
||||
}
|
||||
|
||||
/* Hack to disable double save */
|
||||
if (usedCfgLM == 0){
|
||||
|
||||
fn=(char*)xmalloc(strlen(pwd->pw_dir)+strlen(WINE_PREFIX)+strlen(SAVE_LOCAL_MACHINE)+2);
|
||||
strcpy(fn,pwd->pw_dir);
|
||||
strcat(fn,WINE_PREFIX"/"SAVE_LOCAL_MACHINE);
|
||||
|
@ -738,6 +766,8 @@ void SHELL_SaveRegistry( void )
|
|||
}
|
||||
free(tmp);
|
||||
free(fn);
|
||||
|
||||
}
|
||||
} else
|
||||
WARN(reg,"Failed to get homedirectory of UID %d.\n",getuid());
|
||||
}
|
||||
|
@ -1743,7 +1773,24 @@ void SHELL_LoadRegistry( void )
|
|||
|
||||
/* load the user saved registries */
|
||||
|
||||
/* Try to load config file specified files */
|
||||
|
||||
fn = xmalloc( MAX_PATHNAME_LEN );
|
||||
if (PROFILE_GetWineIniString ("Registry", "UserFileName", "", fn, MAX_PATHNAME_LEN - 1)) {
|
||||
_wine_loadreg(lookup_hkey(HKEY_CURRENT_USER),fn,0);
|
||||
}
|
||||
free (fn);
|
||||
|
||||
fn = xmalloc ( MAX_PATHNAME_LEN);
|
||||
if (PROFILE_GetWineIniString ("Registry", "LocalMachineFileName", "", fn, MAX_PATHNAME_LEN - 1)){
|
||||
_savereg(lookup_hkey(HKEY_LOCAL_MACHINE), fn, 0);
|
||||
}
|
||||
free (fn);
|
||||
|
||||
/* FIXME: use getenv("HOME") or getpwuid(getuid())->pw_dir ?? */
|
||||
/* FIXME: user's home/.wine/user.reg and system.reg files are not
|
||||
blocked from loading not sure if we want to or not.*/
|
||||
|
||||
|
||||
pwd=getpwuid(getuid());
|
||||
if (pwd!=NULL && pwd->pw_dir!=NULL) {
|
||||
|
|
7
wine.ini
7
wine.ini
|
@ -83,6 +83,13 @@ LPT3:=/dev/lp3
|
|||
[spy]
|
||||
Exclude=WM_SIZE;WM_TIMER;
|
||||
|
||||
[Registry]
|
||||
; Paths must be given in /dir/dir/file.reg format.
|
||||
; Wine will not understand dos file names here...
|
||||
|
||||
;UserFileName=xxx ; alternate registry file name (user.reg)
|
||||
;LocalMachineFileName=xxx ; (system.reg)
|
||||
|
||||
[Tweak.Layout]
|
||||
;; WineLook=xxx (supported styles are 'Win31'(default), 'Win95', 'Win98')
|
||||
;WineLook=Win95
|
||||
|
|
Loading…
Reference in a new issue