[SYSSETUP]
authorEric Kohl <eric.kohl@reactos.org>
Wed, 15 May 2013 22:01:07 +0000 (22:01 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Wed, 15 May 2013 22:01:07 +0000 (22:01 +0000)
Enable the restore privilege before the call to NtUnloadKey. Disable it immediately after the call to NtUnloadKey.

svn path=/trunk/; revision=59021

reactos/dll/win32/syssetup/install.c

index 457dad6..713fadb 100644 (file)
@@ -915,11 +915,14 @@ InstallReactOS(HINSTANCE hInstance)
         return 0;
     }
 
-    SetPrivilege(SE_RESTORE_NAME, SE_PRIVILEGE_ENABLED);
-
     /* ROS HACK, as long as NtUnloadKey is not implemented */
     {
-        NTSTATUS Status = NtUnloadKey(NULL);
+        NTSTATUS Status;
+
+        SetPrivilege(SE_RESTORE_NAME, SE_PRIVILEGE_ENABLED);
+        Status = NtUnloadKey(NULL);
+        SetPrivilege(SE_RESTORE_NAME, 0);
+
         if (Status == STATUS_NOT_IMPLEMENTED)
         {
             /* Create the Administrator profile */
@@ -947,8 +950,6 @@ InstallReactOS(HINSTANCE hInstance)
     }
     /* END OF ROS HACK */
 
-    SetPrivilege(SE_RESTORE_NAME, 0);
-
     SetupCloseInfFile(hSysSetupInf);
     SetSetupType(0);