Einzelnen Beitrag anzeigen

Dax
(Gast)

n/a Beiträge
 
#5

Re: Runterfahren in weniger als einer Sekunde - Geht nicht

  Alt 17. Dez 2006, 19:00
Delphi-Quellcode:
program SEShutodwn;

uses
  Windows;

const
  SE_SHUTDOWN_PRIVILEGE = 19;
  SH_SHUTDOWN = 0;
  SH_RESTART = 1;
  SH_POWEROFF = 2;

function NtShutdownSystem(
    Action : DWORD
  ): DWORD; stdcall; external 'ntdll';

function RtlAdjustPrivilege(
    Privilege : ULONG;
    Enable : BOOLEAN;
    CurrentThread : BOOLEAN;
    Enabled : PBOOLEAN
  ): DWORD; stdcall; external 'ntdll';

var b: Boolean;

begin
  b := True;
  RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE, true, true, @b);
  NtShutdownSystem(SH_SHUTDOWN);
end.
So?
  Mit Zitat antworten Zitat