chsvlib
chsv helper source code

◆ GetSidByPrincipalName() [2/2]

AutoSID Chusov::Win32::Security::GetSidByPrincipalName ( LPCWSTR  pszPrincipalName,
std::nothrow_t   
)
noexcept

Returns a smart AutoSID pointer to a security identifier of a principal, specified by its name. In case of an error this overloading version of the function returns a default-constructed smart pointer and sets a corresponding chsvlib error code rather than throwing an exception.

Parameters
[in]pszPrincipalNameis a zero terminated wide string specifying a name of the principal. It can have a form of "<domain_name>\<principal_name>", although 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.
Returns
Returns a smart unique pointer to an allocated buffer containing the SID.
See also
AutoSID GetSidByPrincipalName(LPCWSTR pszPrincipalName, std::nothrow_t) throw()..