Opens the access token associated with a thread, impersonating the client's security context if required
_Security__OpenThreadTokenEx ( $iAccess [, $hThread = 0 [, $bOpenAsSelf = 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||[optional] Handle to the thread whose access token is opened|
|$bOpenAsSelf||[optional] 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.
|Success:||a handle to the newly opened access token.|
#include <MsgBoxConstants.au3> #include <Security.au3> #include <SecurityConstants.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($MB_SYSTEMMODAL, "OpenThreadTokenEx", "$hToken is " & $hToken) _WinAPI_CloseHandle($hToken) Else ConsoleWrite("! _Security__OpenThreadTokenEx failed with error description: " & _WinAPI_GetLastErrorMessage()) EndIf