函数参考


_WinAPI_AdjustTokenPrivileges

启用或禁用指定的访问令牌权限.

#Include <WinAPIEx.au3>
_WinAPI_AdjustTokenPrivileges ( $hToken, $aPrivileges, $iAttributes, ByRef $aAdjust )

参数

$hToken Handle to the access token that contains the privileges to be modified. The handle must have
$TOKEN_ADJUST_PRIVILEGES and $TOKEN_QUERY accesses to the token.
$aPrivileges The variable that specifies a privileges. If this parameter is (-1), the function disables of the token's
privileges and ignores the $iAttributes parameter. $aPrivileges can be one of the following types.

The privilege constant ($SE_*).
1D array of $SE_* constants.
2D array of $SE_* constants and their attributes (see below).

[0][0] - Privilege
[0][1] - Attributes
[n][0] - Privilege
[n][1] - Attributes
$iAttributes The privilege attributes. If $aPrivileges parameter is 1D array, $iAttributes applied to the entire
array. If $aPrivileges parameter is (-1) or 2D array, the function ignores this parameter and will
use the attributes that specified in this array. This parameter can be 0 (disables privilege)
or any combination of the following values.

$SE_PRIVILEGE_ENABLED
$SE_PRIVILEGE_ENABLED_BY_DEFAULT
$SE_PRIVILEGE_REMOVED
$SE_PRIVILEGE_USED_FOR_ACCESS
$aAdjust 2D array of the previous state of any privileges that the function modifies. That is, if a privilege has
been modified by this function, the privilege and its previous state are contained in this array.

返回值

Success 1 and sets the @extended flag to the following values.
0 The function adjusted all specified privileges.
1 The token does not have one or more of the privileges specified in the $aPrivileges parameter.
失败: 返回 0 并设置 @error 标志为非 0 值.

注意/说明

函数不能添加新的权限访问令牌.它只能启用或禁用该令牌的现有权限.

相关

详情参考

在MSDN中搜索