mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
Enable shutdown privilege before trying to reboot
svn path=/trunk/; revision=28191
This commit is contained in:
parent
ca34acb3d6
commit
8642e3d307
1 changed files with 30 additions and 0 deletions
|
@ -628,6 +628,8 @@ InstallReactOS(HINSTANCE hInstance)
|
|||
{
|
||||
TCHAR szBuffer[MAX_PATH];
|
||||
DWORD LastError;
|
||||
HANDLE token;
|
||||
TOKEN_PRIVILEGES privs;
|
||||
|
||||
InitializeSetupActionLog(FALSE);
|
||||
LogItem(SYSSETUP_SEVERITY_INFORMATION, L"Installing ReactOS");
|
||||
|
@ -723,6 +725,34 @@ InstallReactOS(HINSTANCE hInstance)
|
|||
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");
|
||||
|
|
Loading…
Reference in a new issue