antic_ant:<br> 那个问题和我这个问题没有关系吧,,NT和2000下关机和重启也和那个没关系<br>function TWinSystem.SetPrivilege(<br> sPrivilegeName : string;<br> bEnabled : boolean )<br> : boolean;<br>var<br> TPPrev,<br> TP : TTokenPrivileges;<br> Token : THandle;<br> dwRetLen : DWord;<br>begin<br> Result := False;<br><br> OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY,Token );<br><br> TP.PrivilegeCount := 1;<br> if( LookupPrivilegeValue(<br> Nil,<br> PChar( sPrivilegeName ),<br> TP.Privileges[ 0 ].LUID ) )then<br> begin<br> if( bEnabled )then<br> begin<br> TP.Privileges[ 0 ].Attributes :=<br> SE_PRIVILEGE_ENABLED;<br> end else<br> begin<br> TP.Privileges[ 0 ].Attributes :=<br> 0;<br> end;<br><br> dwRetLen := 0;<br> Result := AdjustTokenPrivileges(<br> Token,<br> False,<br> TP,<br> SizeOf( TPPrev ),<br> TPPrev,<br> dwRetLen );<br> end;<br> CloseHandle( Token );<br>end;<br>然后SetPrivilege( 'SeShutdownPrivilege', True )就可以了呀。