ustring MakeSDDL(const ustring &name, const ustring &group, mode_t mode, bool protect) { ustring Result; if (!name.empty()) Result = Result + L"O:" + Sid(name.c_str()).as_str(); if (!group.empty()) Result = Result + L"G:" + Sid(group.c_str()).as_str(); Result += L"D:"; if (protect) Result += L"P"; Result += Mode2Sddl(name, group, mode); return Result; }
ustring ExpAccess::get_name() const { TRUSTEE_FORM tf = ::GetTrusteeFormW((PTRUSTEEW)&Trustee); if (tf == TRUSTEE_IS_NAME) return ustring(::GetTrusteeNameW((PTRUSTEEW)&Trustee)); else if (tf != TRUSTEE_IS_SID) CheckApiError(ERROR_INVALID_PARAMETER); return Sid((PSID)Trustee.ptstrName).get_name(); }
void WinUsers::add(const ustring& name, const ustring& pass) { User::add(name, pass); push_back(UserInfo(UserBuf(name).data())); if (!m_group.empty()) Group::add_member(m_group, Sid(name.c_str())); }
Sid ExpAccess::get_sid() const { if (::GetTrusteeFormW((PTRUSTEEW)&Trustee) != TRUSTEE_IS_SID) CheckApiError(ERROR_INVALID_PARAMETER); return Sid((PSID)Trustee.ptstrName); }