procedure Reboot;<br>var<br> hToken : THandle;<br> tkp : TOKEN_PRIVILEGES;<br> ReturnLength : DWord;<br>begin<br> try<br> OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES or TOKEN_ALL_ACCESS or TOKEN_QUERY, hToken);<br> LookupPrivilegeValue(nil, 'SeShutdownPrivilege', tkp.Privileges[0].Luid);<br> tkp.PrivilegeCount := 1;<br> tkp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;<br> ReturnLength :=0;<br> AdjustTokenPrivileges(hToken, False, tkp, 0, nil, ReturnLength);<br> ExitWindowsEx(EWX_REBOOT or EWX_FORCE, 0);<br> except<br> //<br> end;<br>end; <br>