procedure AdjustToken; //获取2000下的关机权限<br>var<br> hdlProcessHandle: Cardinal;<br> hdlTokenHandle: Cardinal;<br> tmpLuid: Int64;<br> tkp: TOKEN_PRIVILEGES;<br> tkpNewButIgnored: TOKEN_PRIVILEGES;<br> lBufferNeeded: Cardinal;<br> Privilege: array[0..0] of _LUID_AND_ATTRIBUTES;<br>begin<br> hdlProcessHandle := GetCurrentProcess;<br> OpenProcessToken(hdlProcessHandle,<br> (TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY), hdlTokenHandle);<br> LookupPrivilegeValue('', 'SeShutdownPrivilege', tmpLuid);<br> Privilege[0].Luid := tmpLuid;<br> Privilege[0].Attributes := SE_PRIVILEGE_ENABLED;<br> tkp.PrivilegeCount := 1;<br> tkp.Privileges[0] := Privilege[0];<br> AdjustTokenPrivileges(hdlTokenHandle, False, tkp, Sizeof(tkpNewButIgnored),<br> tkpNewButIgnored, lBufferNeeded);<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br>AdjustToken;<br>ExitWindowsEx(EWX_POWEROFF, 0)<br>end;<br><br>试一下这个行不?