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


_Security__OpenThreadToken

Opens the access token associated with a thread

#include <Security.au3>
_Security__OpenThreadToken($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

Примечания

OpenThreadToken will fail if not impersonating.

См. также

_Security__OpenThreadTokenEx, _Security__OpenProcessToken

См. также

Искать OpenThreadToken в библиотеке MSDN

Пример

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

Local $hToken = _Security__OpenThreadToken($TOKEN_ADJUST_PRIVILEGES)
If $hToken Then
    ConsoleWrite("$hToken is " & $hToken & @CRLF)
    ; $hToken it this thread's token with $TOKEN_ADJUST_PRIVILEGES access

    ; ... The rest of the token work here...

    _WinAPI_CloseHandle($hToken)
Else
    ConsoleWrite(_WinAPI_GetLastErrorMessage())
    ; Read remarks for _Security__OpenThreadToken
EndIf