[SYSSETUP][USERENV] Create the system profile after the creation of the default profile has been finished

CopySystemProfile: Don't try to create the user hive. Just copy it as it has already been created.
This commit is contained in:
Eric Kohl 2018-05-30 09:21:14 +02:00
parent e7340a2800
commit f0273d814e
2 changed files with 12 additions and 42 deletions

View file

@ -1279,7 +1279,17 @@ InstallReactOS(VOID)
CreateDirectory(szBuffer, NULL);
}
SaveDefaultUserHive();
if (SaveDefaultUserHive() != ERROR_SUCCESS)
{
FatalError("SaveDefaultUserHive() failed");
return 0;
}
if (!CopySystemProfile(0))
{
FatalError("CopySystemProfile() failed");
return 0;
}
hHotkeyThread = CreateThread(NULL, 0, HotkeyThread, NULL, 0, NULL);

View file

@ -109,7 +109,7 @@ AcquireRemoveRestorePrivilege(IN BOOL bAcquire)
BOOL
WINAPI
CopySystemProfile(
IN ULONG Unused)
_In_ ULONG Unused)
{
WCHAR szKeyName[MAX_PATH];
WCHAR szRawProfilePath[MAX_PATH];
@ -231,46 +231,6 @@ CopySystemProfile(
goto done;
}
/* Create user hive file */
#if 0
/* Use the default hive file name */
// StringCbCopyW(szBuffer, sizeof(szBuffer), szProfilePath);
StringCbCatW(szProfilePath, sizeof(szProfilePath), L"\\ntuser.dat");
/* Acquire restore privilege */
if (!AcquireRemoveRestorePrivilege(TRUE))
{
DPRINT1("Failed to acquire the restore privilege (Error %lu)\n", GetLastError());
goto done;
}
/* Load the user hive */
dwError = RegLoadKeyW(HKEY_USERS,
SidString.Buffer,
szProfilePath);
AcquireRemoveRestorePrivilege(FALSE);
if (dwError != ERROR_SUCCESS)
{
DPRINT1("Failed to load the new registry hive (Error %lu)\n", dwError);
goto done;
}
bResult = TRUE;
/* Initialize the user hive */
if (!CreateUserHive(SidString.Buffer, szProfilePath))
{
DPRINT1("Failed to create the new hive (Error %lu)\n", GetLastError());
bResult = FALSE;
}
/* Unload the user hive */
AcquireRemoveRestorePrivilege(TRUE);
RegUnLoadKeyW(HKEY_USERS, SidString.Buffer);
AcquireRemoveRestorePrivilege(FALSE);
#endif
bResult = TRUE;
done: