const
SHUTDOWN_FORCE_OTHERS = $00000001;
SHUTDOWN_FORCE_SELF = $00000002;
SHUTDOWN_GRACE_OVERRIDE = $00000020;
SHUTDOWN_HYBRID = $00000200;
SHUTDOWN_INSTALL_UPDATES = $00000040;
SHUTDOWN_NOREBOOT = $00000010;
SHUTDOWN_POWEROFF = $00000008;
SHUTDOWN_RESTART = $00000004;
SHUTDOWN_RESTARTAPPS = $00000080;
type
TInitiateShutdown =
function(
{$IFDEF UNICODE}
lpMachineName, lpMessage: PWideChar;
{$ELSE}
lpMachineName, lpMessage: PAnsiChar;
{$ENDIF}
dwGracePeriode, dwShutdownFlags, dwReason: DWORD): DWORD;
stdcall;
function InitiateShutdownA(lpMachineName, lpMessage: PAnsiChar; dwGracePeriode, dwShutdownFlags, dwReason: DWORD): DWORD;
stdcall;
function InitiateShutdownW(lpMachineName, lpMessage: PWideChar; dwGracePeriode, dwShutdownFlags, dwReason: DWORD): DWORD;
stdcall;
var
InitiateShutdown: TInitiateShutdown =
{$IFDEF UNICODE}
InitiateShutdownW;
{$ELSE}
InitiateShutdownA;
{$ENDIF}
implementation
function InitiateShutdownA;
external advapi32
name '
InitiateShutdownA';
function InitiateShutdownW;
external advapi32
name '
InitiateShutdownW';