AdvApi32GetTokenInformation Method
Retrieves a specified type of information about an access token.
The calling process must have appropriate access rights to obtain the information.
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 GetTokenInformation(
IntPtr tokenHandle,
TokenInformationClass tokenInformationClass,
IntPtr tokenInformation,
int tokenInformationLength,
ref int refReturnLength
)
<DllImportAttribute("AdvApi32.dll", SetLastError := true>]
Public Shared Function GetTokenInformation (
tokenHandle As IntPtr,
tokenInformationClass As TokenInformationClass,
tokenInformation As IntPtr,
tokenInformationLength As Integer,
ByRef refReturnLength As Integer
) As Boolean
Dim tokenHandle As IntPtr
Dim tokenInformationClass As TokenInformationClass
Dim tokenInformation As IntPtr
Dim tokenInformationLength As Integer
Dim refReturnLength As Integer
Dim returnValue As Boolean
returnValue = AdvApi32.GetTokenInformation(tokenHandle,
tokenInformationClass, tokenInformation,
tokenInformationLength, refReturnLength)
public:
[DllImportAttribute(L"AdvApi32.dll", SetLastError = true)]
static bool GetTokenInformation(
IntPtr tokenHandle,
TokenInformationClass tokenInformationClass,
IntPtr tokenInformation,
int tokenInformationLength,
int% refReturnLength
)
[<DllImportAttribute("AdvApi32.dll", SetLastError = true)>]
static member GetTokenInformation :
tokenHandle : IntPtr *
tokenInformationClass : TokenInformationClass *
tokenInformation : IntPtr *
tokenInformationLength : int *
refReturnLength : int byref -> bool
No code example is currently available or this language may not be supported.
- 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.
Boolean
If the function succeeds, the return value is
.
If the function fails, the return value is
.
To get extended error information, call
GetLastWin32Error.