[ros-diffs] [hpoussin] 28191: Enable shutdown privilege before trying to reboot
hpoussin at svn.reactos.org
hpoussin at svn.reactos.org
Mon Aug 6 13:57:15 CEST 2007
Author: hpoussin
Date: Mon Aug 6 15:57:15 2007
New Revision: 28191
URL: http://svn.reactos.org/svn/reactos?rev=28191&view=rev
Log:
Enable shutdown privilege before trying to reboot
Modified:
trunk/reactos/dll/win32/syssetup/install.c
Modified: trunk/reactos/dll/win32/syssetup/install.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/install.c?rev=28191&r1=28190&r2=28191&view=diff
==============================================================================
--- trunk/reactos/dll/win32/syssetup/install.c (original)
+++ trunk/reactos/dll/win32/syssetup/install.c Mon Aug 6 15:57:15 2007
@@ -628,6 +628,8 @@
{
TCHAR szBuffer[MAX_PATH];
DWORD LastError;
+ HANDLE token;
+ TOKEN_PRIVILEGES privs;
InitializeSetupActionLog(FALSE);
LogItem(SYSSETUP_SEVERITY_INFORMATION, L"Installing ReactOS");
@@ -723,6 +725,34 @@
LogItem(SYSSETUP_SEVERITY_INFORMATION, L"Installing ReactOS done");
TerminateSetupActionLog();
+ /* Get shutdown privilege */
+ if (! OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &token))
+ {
+ DebugPrint("OpenProcessToken() failed!");
+ return 0;
+ }
+ if (!LookupPrivilegeValue(
+ NULL,
+ SE_SHUTDOWN_NAME,
+ &privs.Privileges[0].Luid))
+ {
+ DebugPrint("LookupPrivilegeValue() failed!");
+ return 0;
+ }
+ privs.PrivilegeCount = 1;
+ privs.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+ if (AdjustTokenPrivileges(
+ token,
+ FALSE,
+ &privs,
+ 0,
+ (PTOKEN_PRIVILEGES)NULL,
+ NULL) == 0)
+ {
+ DebugPrint("AdjustTokenPrivileges() failed!");
+ return 0;
+ }
+
/// THE FOLLOWING DPRINT IS FOR THE SYSTEM REGRESSION TOOL
/// DO NOT REMOVE!!!
DbgPrint("SYSREG_CHECKPOINT:SYSSETUP_COMPLETE\n");
More information about the Ros-diffs
mailing list