std::vector<AutoSID> Chusov::Win32::Security::GetTokenGroups | ( | HANDLE | hToken | ) |
Returns a vector of managed pointers to security identifiers of groups which a principal described by the specified access token belongs to.
[in] | hToken | is a handle of the token describing a principal, which groups are returned by the function. |
SID values themselves use the same buffer to be contained. The data is written right after the last element of the returned array.
hToken must be opened with TOKEN_QUERY access right. Tokens returned by the GetCurrentImpersonationToken have one.
To avoid allocations the caller can use the Windows [GetTokenInformation] function together with the GetTokenGroupCount function to write the security identifiers onto pre allocated memory.
std::bad_alloc | The function was unable to allocate the required amount of memory. |
Chusov::Exceptions::ChsvCodeException | System-level error occurred. |