https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f0273d814e67acd4da28bf7edd3de403e62f7738

commit f0273d814e67acd4da28bf7edd3de403e62f7738
Author:     Eric Kohl <eric.k...@reactos.org>
AuthorDate: Wed May 30 09:21:14 2018 +0200
Commit:     Eric Kohl <eric.k...@reactos.org>
CommitDate: Wed May 30 09:21:14 2018 +0200

    [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.
---
 dll/win32/syssetup/install.c | 12 +++++++++++-
 dll/win32/userenv/profile.c  | 42 +-----------------------------------------
 2 files changed, 12 insertions(+), 42 deletions(-)

diff --git a/dll/win32/syssetup/install.c b/dll/win32/syssetup/install.c
index ad14449a56..74b357d444 100644
--- a/dll/win32/syssetup/install.c
+++ b/dll/win32/syssetup/install.c
@@ -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);
 
diff --git a/dll/win32/userenv/profile.c b/dll/win32/userenv/profile.c
index 0b49d7a869..a7289211be 100644
--- a/dll/win32/userenv/profile.c
+++ b/dll/win32/userenv/profile.c
@@ -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:

Reply via email to