chsvlib
chsv helper source code

◆ GetTokenGroupName()

std::basic_string<wchar_t, traits_t, alloc_t> Chusov::Win32::Security::GetTokenGroupName ( HANDLE  hToken,
DWORD  iGroupIndex 
)

Returns a name of a group at a specified index within records of groups the specified token belongs to.

Template Parameters
traits_tis a type implementing character traits class of the returned wide string. The default value of the template parameter is std::char_traits<wchar_t>.
alloc_tis a type of an allocator used by the returned string object. The default template argument is the default allocator instantiated for the wide character type - std::allocator<wchar_t>.
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 an std::basic_string object holding a wide string describing a name of the group as well as its domain in a form of "\\domain_name\group_name".
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.