AdvApi32OpenProcessToken(IntPtr, TokenAccess, IntPtr) Method
Opens the access token associated with a process.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("AdvApi32.dll", SetLastError = true)]
public static bool OpenProcessToken(
IntPtr processHandle,
TokenAccess desiredAccess,
ref IntPtr refTokenHandle
)
<DllImportAttribute("AdvApi32.dll", SetLastError := true>]
Public Shared Function OpenProcessToken (
processHandle As IntPtr,
desiredAccess As TokenAccess,
ByRef refTokenHandle As IntPtr
) As Boolean
Dim processHandle As IntPtr
Dim desiredAccess As TokenAccess
Dim refTokenHandle As IntPtr
Dim returnValue As Boolean
returnValue = AdvApi32.OpenProcessToken(processHandle,
desiredAccess, refTokenHandle)
public:
[DllImportAttribute(L"AdvApi32.dll", SetLastError = true)]
static bool OpenProcessToken(
IntPtr processHandle,
TokenAccess desiredAccess,
IntPtr% refTokenHandle
)
[<DllImportAttribute("AdvApi32.dll", SetLastError = true)>]
static member OpenProcessToken :
processHandle : IntPtr *
desiredAccess : TokenAccess *
refTokenHandle : IntPtr byref -> bool
No code example is currently available or this language may not be supported.
- processHandle IntPtr
-
An IntPtr handle to the process whose access token is opened.
The process must have the PROCESS_QUERY_INFORMATION access permission.
- desiredAccess TokenAccess
-
Specifies an access mask that specifies the requested types of access to the access token.
These requested access types are compared with the discretionary access control list (DACL)
of the token to determine which accesses are granted or denied.
- refTokenHandle IntPtr
-
Am IntPtr handle that identifies the newly opened access token when the function returns.
Boolean
If the function succeeds, the return value is
.
If the function fails, the return value is
.
To get extended error information, call
GetLastWin32Error.