procedure ApagarEquipo;
var hdlProcessHandle:THandle;
hdlTokenHandle:cardinal;
tmpLuid:TLargeInteger;
tkp,tkpNewButIgnored:TTokenPrivileges;
lBufferNeeded:DWord;
tokenBol:BOOL;
begin
hdlProcessHandle := GetCurrentProcess;
OpenProcessToken (hdlProcessHandle, (TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY), hdlTokenHandle);
//Get the LUID for shutdown privilege.
LookupPrivilegeValue(\'\', \'SeShutdownPrivilege\', tmpLuid);
tkp.PrivilegeCount := 1; // One privilege to set
tkp.Privileges[0].Luid := tmpLuid;
tkp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
//Enable the shutdown privilege in the access token of this process.
tokenBol:=False;
AdjustTokenPrivileges (hdlTokenHandle, tokenBol, tkp, DWORD(sizeof(tkpNewButIgnored)), PTokenPrivileges(@tkpNewButIgnored), lBufferNeeded);
ExitWindowsEx ( EWX_SHUTDOWN {or EWX_FORCE}, 0 );
end;