GetTokenInformation  IUK.M6 

The GetTokenInformation function retrieves a specified type of information about an access token. The calling process must have appropriate access rights to obtain the information.

BOOL GetTokenInformation(

    HANDLE TokenHandle,

// handle of access token

    TOKEN_INFORMATION_CLASS TokenInformationClass,

// type of information to retrieve

    LPVOID TokenInformation,

// address of retrieved information

    DWORD TokenInformationLength,

// size of information buffer

    PDWORD ReturnLength

// address of required buffer size

   );

 

 

Parameters

TokenHandle

Identifies an access token from which information is retrieved.

TokenInformationClass

Specifies a variable of the TOKEN_INFORMATION_CLASSZ2C1H2 enumerated type identifying the type of information the function retrieves.

TokenInformation

Points 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, as shown in the following list:

Token Information Class

Structure Returned

TokenUser

TOKEN_USER6E5Y_O7 structure. TOKEN_QUERY access is needed to retrieve this information.

TokenGroups

TOKEN_GROUPSQOKOO8 structure. TOKEN_QUERY access is needed to retrieve this information.

TokenPrivileges

TOKEN_PRIVILEGES199QKB. structure. TOKEN_QUERY access is needed to retrieve this information.

TokenOwner

TOKEN_OWNER1369G97 structure. TOKEN_QUERY access is needed to retrieve this information.

TokenPrimaryGroup

TOKEN_PRIMARY_GROUP21RZUL3 structure. TOKEN_QUERY access is needed to retrieve this information.

TokenDefaultDacl

TOKEN_DEFAULT_DACL2UQC8WE structure. TOKEN_QUERY access is needed to retrieve this information.

TokenSource

TOKEN_SOURCE1L21EDO structure. TOKEN_QUERY_SOURCE access is needed to retrieve this information.

TokenType

TOKEN_TYPE_GET7W enumerated type. TOKEN_QUERY access is needed to retrieve this information.

TokenImpersonationLevel

SECURITY_IMPERSONATION_LEVEL7C9AQ0 enumerated type. TOKEN_QUERY access is needed to retrieve this information about a token. If the access token is not an impersonation token, the function fails.

TokenStatistics

TOKEN_STATISTICS7D_TOE structure. TOKEN_QUERY access is needed to retrieve this information.

 

The formats for the retrieved structures and enumerated types are listed in the following Remarks section.

TokenInformationLength

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

ReturnLength

Points to a variable receiving the actual 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.

If the value of the TokenInformationClass parameter is TokenDefaultDacl and the token has no default access-control list, the function sets the variable pointed to by ReturnLength to zero and stores no data in the buffer.

 

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError11C2VS7.

See Also

AdjustTokenGroups, AdjustTokenPrivileges, OpenProcessToken, OpenThreadToken, SetTokenInformation, SECURITY_IMPERSONATION_LEVEL, TOKEN_DEFAULT_DACL, TOKEN_GROUPS, TOKEN_INFORMATION_CLASS, TOKEN_OWNER, TOKEN_PRIMARY_GROUP, TOKEN_PRIVILEGES, TOKEN_SOURCE, TOKEN_STATISTICS, TOKEN_TYPE, TOKEN_USER