D�finit diff�rents types d'informations pour un jeton d'acc�s sp�cifi�
#include <Security.au3>
_Security__SetTokenInformation ( $hToken, $iTokenInformation, $vTokenInformation, $iTokenInformationLength )
$hToken | Handle du jeton d'acc�s pour lequel l'information doit �tre d�finie |
$iTokenInformation | Type d'informations � d�finir dans le jeton d'acc�s |
$vTokenInformation | Une (un pointeur sur une) structure qui contient les informations � d�finir dans le jeton d'acc�s |
$iTokenInformationLength | La longueur, en octets, du tampon point� par $vTokenInformation |
Succ�s: | Retourne True. |
�chec: | Retourne False. |
_Security__GetTokenInformation
Consultez SetTokenInformation dans la librairie MSDN.
#RequireAdmin ; A un sens pour cet exemple #include <MsgBoxConstants.au3> #include <Security.au3> #include <SecurityConstants.au3> #include <WinAPIHObj.au3> Example_SeTokInfo() Func Example_SeTokInfo() Local $hProcess = _WinAPI_GetCurrentProcess() If @error Then Return ; Teste des erreurs possibles Local $hToken = _Security__OpenProcessToken($hProcess, $TOKEN_ALL_ACCESS) ; Si le jeton est obtenu... If $hToken Then ; D�finit un niveau d'int�grit� moyen pour ce jeton. Local $tSID = _Security__StringSidToSid($SID_MEDIUM_MANDATORY_LEVEL) ; D�finir la structure TOKEN_MANDATORY_LABEL Local Const $tTOKEN_MANDATORY_LABEL = DllStructCreate("ptr Sid; Attributs DWORD") ; La remplit avec les donn�es DllStructSetData($tTOKEN_MANDATORY_LABEL, "Sid", DllStructGetPtr($tSID, 1)) DllStructSetData($tTOKEN_MANDATORY_LABEL, "Attributes", $SE_GROUP_INTEGRITY) If _Security__SetTokenInformation($hToken, $TOKENINTEGRITYLEVEL, $tTOKEN_MANDATORY_LABEL, DllStructGetSize($tTOKEN_MANDATORY_LABEL)) Then ; Par d�faut IL est $SID_HIGH_MANDATORY_LEVEL, cependant... MsgBox($MB_SYSTEMMODAL, "SetTokenInformation", "$hToken = " & $hToken & @CRLF & "Ce jeton a Medium Integrity Level qui n'est pas par d�faut") ; ; ... Placez du code ici... ; EndIf ; Ferme le handle du jeton lorsqu'il n'est plus n�cessaire _WinAPI_CloseHandle($hToken) EndIf EndFunc ;==>Example_SeTokInfo