Program je prajednoduchý:
function ShutDown (const Computer, Msg: string; const Time: Word; const Force, Reboot: Boolean): Boolean;
var rl: Cardinal; hToken: Cardinal; tkp: TOKEN_PRIVILEGES;
begin
	if not OpenProcessToken (GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, hToken) then
		ShowMessage ('Nejde otevřít Token procesu.')
	else begin
		if LookupPrivilegeValue (nil, 'SeShutdownPrivilege', tkp.Privileges [0].Luid) then begin
			tkp.Privileges [0].Attributes	:= SE_PRIVILEGE_ENABLED;
			tkp.PrivilegeCount		:= 1;
			AdjustTokenPrivileges (hToken, False, tkp, 0, nil, rl);
			if GetLastError () <> ERROR_SUCCESS then ShowMessage ('Nepodařilo se nastavit privilegia.') end
		else begin
			ShowMessage('Nenalezana privilegia k ShutDown.');
		end
	end;
	Result	:= InitiateSystemShutdown (PChar (Computer), PChar(Msg), Time, Force, Reboot);
end;
 
 
