std::unique_ptr<void, Chusov::Memory::raw_delete_t<void> > Chusov::Win32::Security::GetTokenInformation | ( | HANDLE | hToken, |
TOKEN_INFORMATION_CLASS | TokenInformationClass | ||
) |
Allocates and fills a buffer with requested token information.
[in] | hToken | is a Windows handle of the token, which information is retrieved. |
[in] | TokenInformationClass | is a value of the Windows TOKEN_INFORMATION_CLASS enumeration, specifying what information is to be retrieved. |
The function is a simple wrap over the Windows GetTokenInformation function. It encapsulates a retrieving of a necessary buffer size, an allocation of the buffer, and reading the requested information.
If TokenInformationClass specifies TokenSource, the hToken must be opened with TOKEN_QUERY_SOURCE
access right. For all other TokenInformationClass values, the handle must have TOKEN_QUERY
access. Token handles, retrieved by calls to the GetCurrentImpersonationToken function, have both of these access rights.
std::bad_alloc | The function was unable to allocate the required amount of memory. |
Chusov::Exceptions::ChsvCodeException | System-level error occurred. |