Commit 8573cc7f authored by Juergen Schmied's avatar Juergen Schmied Committed by Alexandre Julliard

- fixes, loading of settings per user

- autodetecting of windows registry version
parent f82a723a
......@@ -118,6 +118,14 @@ default: C:\\TEMP
Used to specify a directory where Windows applications can store
temporary files.
.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>
.br
default: C:\\WINDOWS;C:\\WINDOWS\\SYSTEM
......@@ -288,23 +296,9 @@ Home registries (stored in ~user/.wine/)
.br
TRY to write all changes to alt registries
.PP
.I format: LoadWin311RegistryFiles=<boolean>
.br
Windows 3.1 registry files stored in windows directory
.PP
.I format: LoadWin95RegistryFiles=<boolean>
.I format: LoadWindowsRegistryFiles=<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.
Load Windows registry from the current Windows directory.
.PP
booleans: Y/y/T/t/1 are true, N/n/F/f/0 are false.
.br
......
......@@ -66,7 +66,7 @@ static int DIR_GetPath( const char *keyname, const char *defval,
int DIR_Init(void)
{
char path[MAX_PATHNAME_LEN];
DOS_FULL_NAME tmp_dir;
DOS_FULL_NAME tmp_dir, profile_dir;
int drive;
const char *cwd;
......@@ -141,6 +141,15 @@ int DIR_Init(void)
TRACE("Cwd = %c:\\%s\n",
'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;
}
......
......@@ -1478,11 +1478,19 @@ static void SetLoadLevel(int level)
/**********************************************************************************
* SHELL_LoadRegistry [Internal]
*/
#define REG_DONTLOAD -1
#define REG_WIN31 0
#define REG_WIN95 1
#define REG_WINNT 2
void SHELL_LoadRegistry( void )
{
int save_timeout;
char *fn, *home;
HKEY hkey;
char windir[MAX_PATHNAME_LEN];
char path[MAX_PATHNAME_LEN];
int systemtype = REG_WIN31;
TRACE("(void)\n");
......@@ -1491,59 +1499,132 @@ void SHELL_LoadRegistry( void )
REGISTRY_Init();
SetLoadLevel(0);
if (PROFILE_GetWineIniBool ("registry", "LoadWin311RegistryFiles", 1))
{
/* Load windows 3.1 entries */
_w31_loadreg();
GetWindowsDirectoryA( windir, MAX_PATHNAME_LEN );
if (PROFILE_GetWineIniBool( "Registry", "LoadWindowsRegistryFiles", 1))
{
/* 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 */
NativeRegLoadKey(HKEY_LOCAL_MACHINE, "C:\\system.1st", 0);
NativeRegLoadKey(HKEY_LOCAL_MACHINE, "system.dat", 0);
NativeRegLoadKey(HKEY_CURRENT_USER, "user.dat", 1);
}
if (PROFILE_GetWineIniBool ("registry", "LoadWinNTRegistryFiles", 1))
{
fn = xmalloc( MAX_PATHNAME_LEN );
home = xmalloc ( MAX_PATHNAME_LEN );
if ( PROFILE_GetWineIniString( "registry", "NTUser", "", home, MAX_PATHNAME_LEN - 1))
strcpy(path, windir);
strncat(path, "\\system.dat", MAX_PATHNAME_LEN - strlen(path) - 1);
NativeRegLoadKey(HKEY_LOCAL_MACHINE, path, 0);
if (PROFILE_GetWineIniString( "Wine", "Profile", "", path, MAX_PATHNAME_LEN))
{
/* user specific user.dat */
strncat(path, "\\user.dat", MAX_PATHNAME_LEN - strlen(path) - 1);
if (!NativeRegLoadKey( HKEY_CURRENT_USER, path, 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))
{
GetWindowsDirectoryA( fn, MAX_PATHNAME_LEN );
strncat(fn, "\\Profiles\\", MAX_PATHNAME_LEN - strlen(fn) - 1);
strncat(fn, home, MAX_PATHNAME_LEN - strlen(fn) - 1);
strncat(fn, "\\ntuser.dat", MAX_PATHNAME_LEN - strlen(fn) - 1);
NativeRegLoadKey( HKEY_CURRENT_USER, fn, 1 );
}
strcpy(path, windir);
strncat(path, "\\system32\\config\\default", MAX_PATHNAME_LEN - strlen(path) - 1);
NativeRegLoadKey(hkey, path, 1);
RegCloseKey(hkey);
}
/*
* FIXME
* map HLM\System\ControlSet001 to HLM\System\CurrentControlSet
*/
GetSystemDirectoryA( fn, MAX_PATHNAME_LEN );
strcpy(home, fn);
strncat(home, "\\config\\system", MAX_PATHNAME_LEN - strlen(home) - 1);
NativeRegLoadKey(HKEY_LOCAL_MACHINE, home, 0);
strcpy(path, windir);
strncat(path, "\\system32\\config\\system", MAX_PATHNAME_LEN - strlen(path) - 1);
NativeRegLoadKey(HKEY_LOCAL_MACHINE, path, 0);
strcpy(home, fn);
strncat(home, "\\config\\software", MAX_PATHNAME_LEN - strlen(home) - 1);
NativeRegLoadKey(HKEY_LOCAL_MACHINE, home, 0);
strcpy(path, windir);
strncat(path, "\\system32\\config\\software", MAX_PATHNAME_LEN - strlen(path) - 1);
NativeRegLoadKey(HKEY_LOCAL_MACHINE, path, 0);
strcpy(home, fn);
strncat(home, "\\config\\sam", MAX_PATHNAME_LEN - strlen(home) - 1);
NativeRegLoadKey(HKEY_LOCAL_MACHINE, home, 0);
strcpy(path, windir);
strncat(path, "\\system32\\config\\sam", MAX_PATHNAME_LEN - strlen(path) - 1);
NativeRegLoadKey(HKEY_LOCAL_MACHINE, path, 0);
strcpy(home, fn);
strncat(home, "\\config\\security", MAX_PATHNAME_LEN - strlen(home) - 1);
NativeRegLoadKey(HKEY_LOCAL_MACHINE, home, 0);
strcpy(path, windir);
strncat(path, "\\system32\\config\\security", MAX_PATHNAME_LEN - strlen(path) - 1);
NativeRegLoadKey(HKEY_LOCAL_MACHINE, path, 0);
free (home);
free (fn);
/* this key is generated when the nt-core booted successfully */
if (!RegCreateKeyA(HKEY_LOCAL_MACHINE,"System\\Clone",&hkey))
RegCloseKey(hkey);
}
break;
} /* switch */
if (PROFILE_GetWineIniBool ("registry","LoadGlobalRegistryFiles", 1))
{
/*
......
......@@ -54,6 +54,7 @@ Windows=c:\windows
System=c:\windows\system
Temp=e:\
Path=c:\windows;c:\windows\system;e:\;e:\test;f:\
Profile=c:\windows\Profiles\Administrator
SymbolTableFile=./wine.sym
# <wineconf>
......@@ -148,6 +149,8 @@ LoadGlobalRegistryFiles=Y
LoadHomeRegistryFiles=Y
; Load above registries.
LoadAltRegistryFiles=Y
; Load Windows registries from the Windows directory
LoadWindowsRegistryFiles=Y
; TRY to write all changes to home registries
WritetoHomeRegistryFiles=Y
; TRY to write all changes to alt registries
......@@ -157,14 +160,6 @@ UseNewFormat=N
; Registry periodic save timeout in seconds
; 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]
;; WineLook=xxx (supported styles are 'Win31'(default), 'Win95', 'Win98')
;WineLook=Win95
......
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