procedure TForm1.AdjustToken();
var
  hdlProcessHandle : Cardinal;
  hdlTokenHandle : Cardinal;
  tmpLuid : Int64;
  tkpPrivilegeCount : Int64;
  tkp : TOKEN_PRIVILEGES;
  tkpNewButIgnored : TOKEN_PRIVILEGES;
  lBufferNeeded : Cardinal;
  Privilege : array[0..0] of _LUID_AND_ATTRIBUTES;
begin
         hdlProcessHandle := GetCurrentProcess;
         OpenProcessToken(hdlProcessHandle,
                         (TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY),
                          hdlTokenHandle);       
         LookupPrivilegeValue('', 'SeShutdownPrivilege', tmpLuid);
         Privilege[0].Luid := tmpLuid;
         Privilege[0].Attributes := SE_PRIVILEGE_ENABLED;
         tkp.PrivilegeCount := 1;   
         tkp.Privileges[0] := Privilege[0];
                 AdjustTokenPrivileges(hdlTokenHandle,
                               False,
                               tkp,
                               Sizeof(tkpNewButIgnored),
                               tkpNewButIgnored,
                               lBufferNeeded); end;
procedure TForm1.Button1Click(Sender: TObject);
begin
     AdjustToken;
    ExitWindowsEx(0, $FFFF)
end;