Introduction - If you have any usage issues, please Google them yourself
procedure tform1.ShutDown procedure AdjustToken ()// obtain the shutdown control varhdlProcessHandle, hdlTokenHandle, lBufferNeeded: Cardinal tmpLuid: Int64// tkpPrivilegeCount: Int64 tkp, tkpNewButIgnored: TOKEN_PRIVILEGES Privilege: array [0 .. 0] of _LUID_AND_ATTRIBUTES beginhdlProcessHandle: = GetCurrentProcess OpenProcessToken (hdlProcessHandle, (TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY), hdlTokenHandle)// Get the LUID for shutdown privilege.LookupPrivilegeValue (, SeShutdownPrivilege, tmpLuid) Privilege [0]. Luid: = tmpLuid Privilege [0]. Attributes: = SE_PRIVILEGE_ENABLED tkp.PrivilegeCount: = 1// One privilege to settkp.Privileges [0]: = Privilege [0]// Enable the shutdown privilege in the access token of this process.AdjustTokenPrivileges (hdlTokenHandle,