函数参考


_WinAPI_DuplicateTokenEx

Creates a new primary or impersonation access token that duplicates an existing token.

#Include <WinAPIEx.au3>
_WinAPI_DuplicateTokenEx ( $hToken, $iAccess, $iLevel [, $iType [, $tSecurity]] )

参数

$hToken A handle to an access token opened with $TOKEN_DUPLICATE access.
$iAccess The requested access rights for the new token. To request the same access rights as the existing
token, specify zero. To request all access rights that are valid for the caller, specify the
$TOKEN_ALL_ACCESS access.
$iLevel The security impersonation levels.

$SecurityAnonymous
$SecurityIdentification
$SecurityImpersonation
$SecurityDelegation
$iType [可选参数] The token type.

$TokenPrimary
$TokenImpersonation
$tSecurity [可选参数] $tagSECURITY_ATTRIBUTES structure that specifies a security descriptor for the new token and
determines whether child processes can inherit the token. If this parameter is 0, the token gets
a default security descriptor and the handle cannot be inherited. If the security descriptor
contains a system access control list, the token gets $ACCESS_SYSTEM_SECURITY access right,
even if it was not requested.

返回值

成功: 返回 1.
失败: 返回 0 并设置 @error 标志为非 0 值.

注意/说明

When you have finished using the new token, call the _WinAPI_CloseHandle() function to close the token handle.

相关

详情参考

在MSDN中搜索