win32security.GetTokenInformation

object = GetTokenInformation(TokenHandle, TokenInformationClass )

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

Parameters

TokenHandle : PyHANDLE

Handle to an access token.

TokenInformationClass : int

Specifies a value from the TOKEN_INFORMATION_CLASS enumerated type identifying the type of information the function retrieves.

Return Value

The following types are supported

TokenInformationClass Return type
TokenSessionIdint - Terminal Services session id
TokenSandBoxInertBoolean
TokenTypeValue from TOKEN_TYPE enum (TokenPrimary,TokenImpersonation)
TokenImpersonationLevelValue from SECURITY_IMPERSONATION_LEVEL enum
TokenVirtualizationEnabledBoolean
TokenVirtualizationAllowedBoolean
TokenHasRestrictionsBoolean
TokenElevationTypeint - TokenElevation* value indicating what type of token is linked to
TokenUIAccessBoolean
TokenUser(PySID,int)
TokenOwnerPySID
TokenGroups((PySID,int),) returns a list of tuples containing (group Sid, attribute flags)
TokenRestrictedSids((PySID,int),)
TokenPrivileges((int,int),) returns PyTOKEN_PRIVILEGES (tuple of LUID and attribute flags for each privilege) attributes are combination of SE_PRIVILEGE_ENABLED,SE_PRIVILEGE_ENABLED_BY_DEFAULT,SE_PRIVILEGE_USED_FOR_ACCESS
TokenPrimaryGroupPySID
TokenSource(string,LUID)
TokenDefaultDaclPyACL
TokenStatisticsdict Returns a dictionary representing a TOKEN_STATISTICS structure
TokenOriginLUID identifying the logon session
TokenLinkedTokenPyHANDLE - Returns handle to the access token to which token is linked
TokenLogonSidPySID
TokenElevationBoolean
TokenIntegrityLevel(PySID, int)
TokenMandatoryPolicyint (TOKEN_MANDATORY_POLICY_* flag)