[SYSSETUP] Save the HKEY_USERS\.DEFAULT hive in the ntuser.dat file of the default...
authorEric Kohl <eric.kohl@reactos.org>
Wed, 30 May 2018 06:18:55 +0000 (08:18 +0200)
committerEric Kohl <eric.kohl@reactos.org>
Wed, 30 May 2018 06:18:55 +0000 (08:18 +0200)
dll/win32/syssetup/install.c

index e5b5530..ad14449 100644 (file)
@@ -1171,6 +1171,52 @@ done:
 }
 
 
+static
+DWORD
+SaveDefaultUserHive(VOID)
+{
+    WCHAR szDefaultUserHive[MAX_PATH];
+    HKEY hUserKey = NULL;
+    DWORD cchSize;
+    DWORD dwError;
+
+    DPRINT("SaveDefaultUserHive()\n");
+
+    cchSize = ARRAYSIZE(szDefaultUserHive);
+    GetDefaultUserProfileDirectoryW(szDefaultUserHive, &cchSize);
+
+    wcscat(szDefaultUserHive, L"\\ntuser.dat");
+
+    dwError = RegOpenKeyExW(HKEY_USERS,
+                            L".DEFAULT",
+                            0,
+                            KEY_READ,
+                            &hUserKey);
+    if (dwError != ERROR_SUCCESS)
+    {
+        DPRINT1("RegOpenKeyExW() failed (Error %lu)\n", dwError);
+        return dwError;
+    }
+
+    pSetupEnablePrivilege(L"SeBackupPrivilege", TRUE);
+
+    dwError = RegSaveKeyExW(hUserKey,
+                            szDefaultUserHive,
+                            NULL,
+                            REG_STANDARD_FORMAT);
+    if (dwError != ERROR_SUCCESS)
+    {
+        DPRINT1("RegSaveKeyExW() failed (Error %lu)\n", dwError);
+    }
+
+    pSetupEnablePrivilege(L"SeBackupPrivilege", FALSE);
+
+    RegCloseKey(hUserKey);
+
+    return dwError;
+}
+
+
 static
 DWORD
 InstallReactOS(VOID)
@@ -1233,6 +1279,8 @@ InstallReactOS(VOID)
         CreateDirectory(szBuffer, NULL);
     }
 
+    SaveDefaultUserHive();
+
     hHotkeyThread = CreateThread(NULL, 0, HotkeyThread, NULL, 0, NULL);
 
     /* Hack: Install TCP/IP protocol driver */