chsvlib
chsv helper source code

◆ GetTokenUser()

AutoSID Chusov::Win32::Security::GetTokenUser ( HANDLE  hToken)

Returns a Windows security identifier of a principal, described by the specified token.

Parameters
[in]hTokenis a Windows handle of the token, opened with the TOKEN_QUERY access right.
Returns
The function returns a smart pointer to a buffer containing a Windows security identifier (aka SID) of a principal, described by the token.

hToken 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::ChsvCodeExceptionSystem-level error occurred.
Examples
chsvwinutilex\CreateDACL.cpp.