发信人: oujiahan()
整理人: teleme(2001-01-03 15:32:47), 站内信件
|
【 在 zzl (龙) 的大作中提到: 】
: 你有没有关机的权限?
procedure ReBootWinNT;
var
currToken : THandle;
prevState,
newState : TTokenPrivileges;
prevStateLen : DWORD;
uid : TLargeInteger;
begin
// Set the privledges so we CAN reboot...
OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES or TOKEN _QUERY, currToken);
LookupPrivilegeValue(nil, 'SeShutdownPrivilege', uid);
newState.PrivilegeCount := 1;
newState.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
newState.Privileges[0].Luid := uid;
AdjustTokenPrivileges(currToken, False, newState, sizeof(TTokenPrivi leges),
prevState, prevStateLen);
// Go ahead and reboot...
ExitWindowsEX(EWX_REBOOT, 0);
end;
-- ※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.105.16.10]
|
|