- fixes, loading of settings per user

- autodetecting of windows registry version
This commit is contained in:
Juergen Schmied 2000-01-30 03:03:23 +00:00 committed by Alexandre Julliard
parent f82a723a43
commit 8573cc7faf
4 changed files with 141 additions and 62 deletions

View File

@ -118,6 +118,14 @@ default: C:\\TEMP
Used to specify a directory where Windows applications can store Used to specify a directory where Windows applications can store
temporary files. temporary files.
.PP .PP
.I format: profile = <directory>
.br
default: nothing
.br
Used to specify a directory where Windows stores special folders and the user-registry files (user.dat or ntuser.dat).
Mapped to environment variable %USERPROFILE%.
Set this value when running with a native NT or a native win95 directory with per-user settings.
.PP
.I format: path = <directories separated by semi-colons> .I format: path = <directories separated by semi-colons>
.br .br
default: C:\\WINDOWS;C:\\WINDOWS\\SYSTEM default: C:\\WINDOWS;C:\\WINDOWS\\SYSTEM
@ -288,23 +296,9 @@ Home registries (stored in ~user/.wine/)
.br .br
TRY to write all changes to alt registries TRY to write all changes to alt registries
.PP .PP
.I format: LoadWin311RegistryFiles=<boolean> .I format: LoadWindowsRegistryFiles=<boolean>
.br .br
Windows 3.1 registry files stored in windows directory Load Windows registry from the current Windows directory.
.PP
.I format: LoadWin95RegistryFiles=<boolean>
.br
Windows 95 registry files stored in windows directory and c:
.PP
.I format: LoadWinNTRegistryFiles=<boolean>
.br
Windows NT registry files stored in <windows directory>/system32/config and <windows directory>/<profiles>/user.dat. (not yet completely implemented)
.PP
.I format: NTUser=<username>
.br
Needed for building path to the user registry file: <windows directory>/profiles/<username>/ntuser.dat
.PP
To avoid interferences between all registrys you should only activate the win311, win95 or the winnt registry.
.PP .PP
booleans: Y/y/T/t/1 are true, N/n/F/f/0 are false. booleans: Y/y/T/t/1 are true, N/n/F/f/0 are false.
.br .br

View File

@ -66,7 +66,7 @@ static int DIR_GetPath( const char *keyname, const char *defval,
int DIR_Init(void) int DIR_Init(void)
{ {
char path[MAX_PATHNAME_LEN]; char path[MAX_PATHNAME_LEN];
DOS_FULL_NAME tmp_dir; DOS_FULL_NAME tmp_dir, profile_dir;
int drive; int drive;
const char *cwd; const char *cwd;
@ -141,6 +141,15 @@ int DIR_Init(void)
TRACE("Cwd = %c:\\%s\n", TRACE("Cwd = %c:\\%s\n",
'A' + drive, DRIVE_GetDosCwd( drive ) ); 'A' + drive, DRIVE_GetDosCwd( drive ) );
if (DIR_GetPath( "profile", "", &profile_dir ))
{
TRACE("USERPROFILE= %s\n", profile_dir.short_name );
SetEnvironmentVariableA( "USERPROFILE", profile_dir.short_name );
}
TRACE("SYSTEMROOT = %s\n", DIR_Windows.short_name );
SetEnvironmentVariableA( "SYSTEMROOT", DIR_Windows.short_name );
return 1; return 1;
} }

View File

@ -1478,11 +1478,19 @@ static void SetLoadLevel(int level)
/********************************************************************************** /**********************************************************************************
* SHELL_LoadRegistry [Internal] * SHELL_LoadRegistry [Internal]
*/ */
#define REG_DONTLOAD -1
#define REG_WIN31 0
#define REG_WIN95 1
#define REG_WINNT 2
void SHELL_LoadRegistry( void ) void SHELL_LoadRegistry( void )
{ {
int save_timeout; int save_timeout;
char *fn, *home; char *fn, *home;
HKEY hkey; HKEY hkey;
char windir[MAX_PATHNAME_LEN];
char path[MAX_PATHNAME_LEN];
int systemtype = REG_WIN31;
TRACE("(void)\n"); TRACE("(void)\n");
@ -1491,59 +1499,132 @@ void SHELL_LoadRegistry( void )
REGISTRY_Init(); REGISTRY_Init();
SetLoadLevel(0); SetLoadLevel(0);
if (PROFILE_GetWineIniBool ("registry", "LoadWin311RegistryFiles", 1)) GetWindowsDirectoryA( windir, MAX_PATHNAME_LEN );
{
/* Load windows 3.1 entries */ if (PROFILE_GetWineIniBool( "Registry", "LoadWindowsRegistryFiles", 1))
_w31_loadreg(); {
/* test %windir%/system32/config/system --> winnt */
strcpy(path, windir);
strncat(path, "\\system32\\config\\system", MAX_PATHNAME_LEN - strlen(path) - 1);
if(GetFileAttributesA(path) != -1)
{
systemtype = REG_WINNT;
}
else
{
/* test %windir%/system.dat --> win95 */
strcpy(path, windir);
strncat(path, "\\system.dat", MAX_PATHNAME_LEN - strlen(path) - 1);
if(GetFileAttributesA(path) != -1)
{
systemtype = REG_WIN95;
}
}
if ((systemtype==REG_WINNT)
&& (! PROFILE_GetWineIniString( "Wine", "Profile", "", path, MAX_PATHNAME_LEN)))
{
MESSAGE("When you are running with a native NT directory specify\n");
MESSAGE("'Profile=<profiledirectory>' or disable loading of Windows\n");
MESSAGE("registry (LoadWindowsRegistryFiles=N)\n");
systemtype = REG_DONTLOAD;
}
} }
if (PROFILE_GetWineIniBool ("registry", "LoadWin95RegistryFiles", 1)) else
{ {
/* only wine registry */
systemtype = REG_DONTLOAD;
}
switch (systemtype)
{
case REG_WIN31:
_w31_loadreg();
break;
case REG_WIN95:
/* Load windows 95 entries */ /* Load windows 95 entries */
NativeRegLoadKey(HKEY_LOCAL_MACHINE, "C:\\system.1st", 0); NativeRegLoadKey(HKEY_LOCAL_MACHINE, "C:\\system.1st", 0);
NativeRegLoadKey(HKEY_LOCAL_MACHINE, "system.dat", 0);
NativeRegLoadKey(HKEY_CURRENT_USER, "user.dat", 1); strcpy(path, windir);
} strncat(path, "\\system.dat", MAX_PATHNAME_LEN - strlen(path) - 1);
if (PROFILE_GetWineIniBool ("registry", "LoadWinNTRegistryFiles", 1)) NativeRegLoadKey(HKEY_LOCAL_MACHINE, path, 0);
{
fn = xmalloc( MAX_PATHNAME_LEN ); if (PROFILE_GetWineIniString( "Wine", "Profile", "", path, MAX_PATHNAME_LEN))
home = xmalloc ( MAX_PATHNAME_LEN );
if ( PROFILE_GetWineIniString( "registry", "NTUser", "", home, MAX_PATHNAME_LEN - 1))
{ {
GetWindowsDirectoryA( fn, MAX_PATHNAME_LEN ); /* user specific user.dat */
strncat(fn, "\\Profiles\\", MAX_PATHNAME_LEN - strlen(fn) - 1); strncat(path, "\\user.dat", MAX_PATHNAME_LEN - strlen(path) - 1);
strncat(fn, home, MAX_PATHNAME_LEN - strlen(fn) - 1); if (!NativeRegLoadKey( HKEY_CURRENT_USER, path, 1 ))
strncat(fn, "\\ntuser.dat", MAX_PATHNAME_LEN - strlen(fn) - 1); {
NativeRegLoadKey( HKEY_CURRENT_USER, fn, 1 ); MESSAGE("can't load win95 user-registry %s\n", path);
} MESSAGE("check wine.conf, section [Wine], value 'Profile'\n");
}
/* default user.dat */
if (!RegCreateKeyA(HKEY_USERS, ".Default", &hkey))
{
strcpy(path, windir);
strncat(path, "\\user.dat", MAX_PATHNAME_LEN - strlen(path) - 1);
NativeRegLoadKey(hkey, path, 1);
RegCloseKey(hkey);
}
}
else
{
/* global user.dat */
strcpy(path, windir);
strncat(path, "\\user.dat", MAX_PATHNAME_LEN - strlen(path) - 1);
NativeRegLoadKey(HKEY_CURRENT_USER, path, 1);
}
break;
case REG_WINNT:
/* default user.dat */
if (PROFILE_GetWineIniString( "Wine", "Profile", "", path, MAX_PATHNAME_LEN))
{
strncat(path, "\\ntuser.dat", MAX_PATHNAME_LEN - strlen(path) - 1);
if(!NativeRegLoadKey( HKEY_CURRENT_USER, path, 1 ))
{
MESSAGE("can't load NT user-registry %s\n", path);
MESSAGE("check wine.conf, section [Wine], value 'Profile'\n");
}
}
/* default user.dat */
if (!RegCreateKeyA(HKEY_USERS, ".Default", &hkey))
{
strcpy(path, windir);
strncat(path, "\\system32\\config\\default", MAX_PATHNAME_LEN - strlen(path) - 1);
NativeRegLoadKey(hkey, path, 1);
RegCloseKey(hkey);
}
/* /*
* FIXME * FIXME
* map HLM\System\ControlSet001 to HLM\System\CurrentControlSet * map HLM\System\ControlSet001 to HLM\System\CurrentControlSet
*/ */
GetSystemDirectoryA( fn, MAX_PATHNAME_LEN );
strcpy(home, fn); strcpy(path, windir);
strncat(home, "\\config\\system", MAX_PATHNAME_LEN - strlen(home) - 1); strncat(path, "\\system32\\config\\system", MAX_PATHNAME_LEN - strlen(path) - 1);
NativeRegLoadKey(HKEY_LOCAL_MACHINE, home, 0); NativeRegLoadKey(HKEY_LOCAL_MACHINE, path, 0);
strcpy(home, fn); strcpy(path, windir);
strncat(home, "\\config\\software", MAX_PATHNAME_LEN - strlen(home) - 1); strncat(path, "\\system32\\config\\software", MAX_PATHNAME_LEN - strlen(path) - 1);
NativeRegLoadKey(HKEY_LOCAL_MACHINE, home, 0); NativeRegLoadKey(HKEY_LOCAL_MACHINE, path, 0);
strcpy(home, fn); strcpy(path, windir);
strncat(home, "\\config\\sam", MAX_PATHNAME_LEN - strlen(home) - 1); strncat(path, "\\system32\\config\\sam", MAX_PATHNAME_LEN - strlen(path) - 1);
NativeRegLoadKey(HKEY_LOCAL_MACHINE, home, 0); NativeRegLoadKey(HKEY_LOCAL_MACHINE, path, 0);
strcpy(home, fn); strcpy(path, windir);
strncat(home, "\\config\\security", MAX_PATHNAME_LEN - strlen(home) - 1); strncat(path, "\\system32\\config\\security", MAX_PATHNAME_LEN - strlen(path) - 1);
NativeRegLoadKey(HKEY_LOCAL_MACHINE, home, 0); NativeRegLoadKey(HKEY_LOCAL_MACHINE, path, 0);
free (home);
free (fn);
/* this key is generated when the nt-core booted successfully */ /* this key is generated when the nt-core booted successfully */
if (!RegCreateKeyA(HKEY_LOCAL_MACHINE,"System\\Clone",&hkey)) if (!RegCreateKeyA(HKEY_LOCAL_MACHINE,"System\\Clone",&hkey))
RegCloseKey(hkey); RegCloseKey(hkey);
} break;
} /* switch */
if (PROFILE_GetWineIniBool ("registry","LoadGlobalRegistryFiles", 1)) if (PROFILE_GetWineIniBool ("registry","LoadGlobalRegistryFiles", 1))
{ {
/* /*

View File

@ -54,6 +54,7 @@ Windows=c:\windows
System=c:\windows\system System=c:\windows\system
Temp=e:\ Temp=e:\
Path=c:\windows;c:\windows\system;e:\;e:\test;f:\ Path=c:\windows;c:\windows\system;e:\;e:\test;f:\
Profile=c:\windows\Profiles\Administrator
SymbolTableFile=./wine.sym SymbolTableFile=./wine.sym
# <wineconf> # <wineconf>
@ -148,6 +149,8 @@ LoadGlobalRegistryFiles=Y
LoadHomeRegistryFiles=Y LoadHomeRegistryFiles=Y
; Load above registries. ; Load above registries.
LoadAltRegistryFiles=Y LoadAltRegistryFiles=Y
; Load Windows registries from the Windows directory
LoadWindowsRegistryFiles=Y
; TRY to write all changes to home registries ; TRY to write all changes to home registries
WritetoHomeRegistryFiles=Y WritetoHomeRegistryFiles=Y
; TRY to write all changes to alt registries ; TRY to write all changes to alt registries
@ -157,14 +160,6 @@ UseNewFormat=N
; Registry periodic save timeout in seconds ; Registry periodic save timeout in seconds
; PeriodicSave=600 ; PeriodicSave=600
; Windows registries in windows path
LoadWin311RegistryFiles=Y
LoadWin95RegistryFiles=Y
LoadWinNTRegistryFiles=N
;user the private registry is taken from
;(profiles/<username>/ntuser.dat)
;NTUser=username
[Tweak.Layout] [Tweak.Layout]
;; WineLook=xxx (supported styles are 'Win31'(default), 'Win95', 'Win98') ;; WineLook=xxx (supported styles are 'Win31'(default), 'Win95', 'Win98')
;WineLook=Win95 ;WineLook=Win95