↑  ←  Описание функции


_Security__OpenThreadTokenEx

Opens the access token associated with a thread, impersonating the client's security context if required

#include <Security.au3>
_Security__OpenThreadTokenEx($iAccess [, $hThread = 0 [, $fOpenAsSelf = False]])

Параметры

$iAccess Access mask that specifies the requested types of access to the access token. These requested
    access types are reconciled against the token's discretionary access control list (DACL) to determine which
    accesses are granted or denied.
$hThread [необязательный] Handle to the thread whose access token is opened
$fOpenAsSelf [необязательный] Indicates whether the access check is to be made against the security context of the thread
    calling the OpenThreadToken function or against the security context of the process for the calling thread.
    If this parameter is False, the access check is performed using the security context for the calling thread.
    If the thread is impersonating a client, this security context can be that of a client process. If this
    parameter is True, the access check is made using the security context of the process for the calling thread.

Возвращаемое значение

Успех:Handle to the newly opened access token
Ошибка:Возвращает 0

См. также

_Security__OpenThreadToken, _Security__ImpersonateSelf

Пример

#include <SecurityConstants.au3>
#include <Security.au3>
#include <WinAPI.au3>

Local $hToken = _Security__OpenThreadTokenEx($TOKEN_ADJUST_PRIVILEGES)
If $hToken Then
    ; $hToken is this thread's token with $TOKEN_ADJUST_PRIVILEGES access
    MsgBox(262144, "OpenThreadTokenEx", "$hToken is " & $hToken)

    _WinAPI_CloseHandle($hToken)
Else
    ConsoleWrite("! _Security__OpenThreadTokenEx failed with error description: " & _WinAPI_GetLastErrorMessage())
EndIf