AdvApi32GetTokenInformation Method

Retrieves a specified type of information about an access token.

The calling process must have appropriate access rights to obtain the information.

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 GetTokenInformation(
	IntPtr tokenHandle,
	TokenInformationClass tokenInformationClass,
	IntPtr tokenInformation,
	int tokenInformationLength,
	ref int refReturnLength
)

Parameters

tokenHandle  IntPtr
A handle to an access token from which information is retrieved.

If tokenInformationClass specifies TokenSource, the handle must have QuerySource access.

For all other TokenInformationClass values, the handle must have Query access.

tokenInformationClass  TokenInformationClass
Specifies a value from the TokenInformationClass enumeration to identify the type of information the function retrieves.

Any callers who check the TokenIsAppContainerTokenIsAppContainer and have it return 0 should also verify that the caller token is not an identify level impersonation token.

If the current token is not an app container but is an identity level token, you should return AccessDenied.

tokenInformation  IntPtr
A pointer to a buffer the function fills with the requested information.

The structure put into this buffer depends upon the type of information specified by the tokenInformationClass parameter.

tokenInformationLength  Int32
Specifies the size, in bytes, of the buffer pointed to by the TokenInformation parameter.

If tokenInformation is IntPtr.Zero, this parameter must be 0.

refReturnLength  Int32
A pointer to a variable that receives the number of bytes needed for the buffer pointed to by the tokenInformation parameter.

If this value is larger than the value specified in the tokenInformationLength parameter, the function fails and stores no data in the buffer.

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