AdvApi32OpenProcessToken(IntPtr, TokenAccess, IntPtr) Method

Opens the access token associated with a process.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: 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
)

Parameters

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.

Return Value

Boolean
If the function succeeds, the return value is .

If the function fails, the return value is .

To get extended error information, call GetLastWin32Error.

Remarks

See Also