chsvlib
chsv helper source code

◆ GetTokenGroup()

AutoSID Chusov::Win32::Security::GetTokenGroup ( HANDLE  hToken,
DWORD  iGroupIndex 
)

Returns a security identifier of the group, specified by an index in the specified token.

Parameters
[in]hTokenis a handle to a token containing the returned group.
[in]iGroupIndexis an index of the group within a vector, pointed to by the Groups field of the TOKEN_GROUPS object, returned by the GetTokenInformation function.
Returns
Returns a smart pointer to a buffer, containing a security identifier (aka SID) of the requested group.

The token must be opened with TOKEN_QUERY access right. Tokens returned by the GetCurrentImpersonationToken have one.

Exceptions
std::bad_allocThe function was unable to allocate the required amount of memory.
Chusov::Exceptions::OutOfRangeExceptionThe specified token index is out of valid range.
Chusov::Exceptions::ChsvCodeExceptionSystem-level error occurred.