windows nt/2000/xp 中如何执行ExitwindowsEx?<br><br>iVersionInfo: TOSVersionInfo;<br> iToken : THandle;<br> iPriveleg : TTokenPrivileges;<br> iaresult : DWORD;<br><br>begin<br> if Poweroff.Enabled = TRUE then flag := EWX_POWEROFF<br> else flag := EWX_REBOOT;<br><br> FillChar (iPriveleg, SizeOf (iPriveleg), #0);<br> iVersionInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);<br> GetVersionEx(iVersionInfo);<br> if iVersionInfo.dwPlatformId <> VER_PLATFORM_WIN32_NT then<br> ExitWindowsEx(flag + EWX_FORCE, 0)<br> else<br> if OpenProcessToken (GetCurrentProcess,<br> TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, iToken) then<br> if LookupPrivilegeValue (NIL,'SeShutdownPrivilege',<br> iPriveleg.Privileges[0].Luid) then<br> begin<br> iPriveleg.PrivilegeCount := 1;<br> iPriveleg.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;<br> if AdjustTokenPrivileges (iToken,False,iPriveleg,<br> Sizeof(iPriveleg),iPriveleg,iaresult) then <br> ExitWindowsEx(flag + EWX_FORCE, 0);<br> end;<br>end;<br>