返回调用进程的进程句柄
#include <Security.au3>
_Security__OpenProcessToken($hProcess, $iAccess)
$hProcess | 其访问令牌已打开得进程句柄. 进程必须被赋予 $PROCESS_QUERY_INFORMATION 访问权限. |
$iAccess | 指定访问掩码,指定有权使用访问令牌的类型. |
成功: | 返回标识新开访问令牌的句柄. |
失败: | 返回 0 |
在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