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


_Security__OpenProcessToken

Returns the access token associated with a process

#include <Security.au3>
_Security__OpenProcessToken($hProcess, $iAccess)

Параметры

$hProcess A handle to the process whose access token is opened. The process must have been given the
    $PROCESS_QUERY_INFORMATION access permission.
$iAccess Specifies an access mask that specifies the requested types of access to the access token.

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

Успех:An handle that identifies the newly opened access token when the function returns.
Ошибка:Возвращает 0

Примечания

Close the access token handle returned by calling _WinAPI_CloseHandle.

См. также

_Security__OpenThreadToken

См. также

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

Пример

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

Local $hToken = _Security__OpenProcessToken(_WinAPI_GetCurrentProcess(), $TOKEN_QUERY)
If $hToken Then
    ; $hToken is this process' token with $TOKEN_QUERY access

    ;... Do whatever with this token now and here...
    MsgBox(262144, "OpenProcessToken", "$hToken = " & $hToken)

    ; Close handle when done
    _WinAPI_CloseHandle($hToken)
EndIf