AutoSID Chusov::Win32::Security::GetSidByPrincipalName | ( | LPCWSTR | pszPrincipalName | ) |
Returns a smart AutoSID pointer to a security identifier of a principal, specified by its name.
[in] | pszPrincipalName | is a zero terminated wide string specifying a name of the principal. It can have a form of "<domain_name>\<principal_name>", where the domain name is optional. If the domain name is specified, the SID is looked up in the specified domain only. Otherwise, the principal is sought within the current domain. |
GetSidByPrincipalName
specially treats "BUILTIN" domain names (independently of case). It does not look up for such a domain (which might exist), but instead compares the principal account name taken from pszPrincipalName
with names generated from SIDs of well-known built-in system accounts. If this were not been implemented, in a case of absence of a "BUILTIN" domain the underlying call to LookupAccoundName would fail.Chusov::Exceptions::InvalidParameterException | The specified name has invalid (or unsupported) format. |
std::bad_alloc | The function was unable to allocate the required amount of memory. |
Chusov::Exceptions::ChsvCodeException | System-level error occurred. |