procedure
ExitWindowsNT
(
uFlags
:
integer
);
var
hToken : THANDLE ;
tkp , tkDumb : TTokenPrivileges ;
DumbInt : DWORD ;
begin
FillChar ( tkp , sizeof ( tkp ), 0 );
// Get a token for this process
if not ( OpenProcessToken ( GetCurrentProcess , TOKEN_ADJUST_PRIVILEGES
or TOKEN_QUERY , hToken )) then
raise Exception . create ( 'OpenProcessToken failed with code '
+ inttostr ( GetLastError ));
// Get the LUID for the Shutdown privilege
LookupPrivilegeValue ( nil , pchar ( 'SeShutdownPrivilege' ),
tkp . Privileges [ 0 ]. Luid );
tkp . PrivilegeCount := 1 ; // one privilege to set
tkp . Privileges [ 0<
var
hToken : THANDLE ;
tkp , tkDumb : TTokenPrivileges ;
DumbInt : DWORD ;
begin
FillChar ( tkp , sizeof ( tkp ), 0 );
// Get a token for this process
if not ( OpenProcessToken ( GetCurrentProcess , TOKEN_ADJUST_PRIVILEGES
or TOKEN_QUERY , hToken )) then
raise Exception . create ( 'OpenProcessToken failed with code '
+ inttostr ( GetLastError ));
// Get the LUID for the Shutdown privilege
LookupPrivilegeValue ( nil , pchar ( 'SeShutdownPrivilege' ),
tkp . Privileges [ 0 ]. Luid );
tkp . PrivilegeCount := 1 ; // one privilege to set
tkp . Privileges [ 0<