chsvlib
chsv helper source code

◆ GetTokenInformation() [1/2]

AutoTokenInformation<TokenInformationClass> Chusov::Win32::Security::GetTokenInformation ( HANDLE  hToken)

Returns a managed pointer to the specified token information. .

Template Parameters
TokenInformationClassis an integral identifier of value of the standard Windows enumeration [TOKEN_INFORMATION_CLASS]. To specify a dynamically acquired information class identifier use another overload of the GetTokenInformation function which returns a generic managed pointer of void* type that should be cast to the appropriate type.
Parameters
[in]hTokenis a handle to a token which information is retrieved by the function.
Returns
Returns smart pointer to the properly typed class object describing the requested token information.
Remarks
Currently, only TokenUser and TokenGroups values of the template parameter are supported.

Example:

TOKEN_USER& token_usr = Chusov::Win32::Security::GetTokenInformation<TokenUser>(hToken).get();
AutoToken GetCurrentImpersonationToken()
Returns a handle to an impersonation token of the calling thread. If the thread does not have one,...
Definition: chsvwinutilex.h:607
See also
token_information_type_id;
std::unique_ptr<void, Chusov::Memory::raw_delete_t<void>> GetTokenInformation(_In_ HANDLE hToken, TOKEN_INFORMATION_CLASS TokenInformationClass).