/// <summary> /// Enumerate users in a domain. /// </summary> /// <param name="user_account_control">User account control flags.</param> /// <param name="throw_on_error">True to throw on error.</param> /// <returns>The list of users.</returns> public NtResult <IReadOnlyList <SamRidEnumeration> > EnumerateUsers(UserAccountControlFlags user_account_control, bool throw_on_error) { SecurityEnumDelegate <SafeSamHandle, SafeSamMemoryBuffer> enum_func = (SafeSamHandle handle, ref int context, out SafeSamMemoryBuffer buffer, int max_count, out int entries_read) => SecurityNativeMethods.SamEnumerateUsersInDomain(handle, ref context, user_account_control, out buffer, max_count, out entries_read); return(SamUtils.SamEnumerateObjects(Handle, enum_func, (SAM_RID_ENUMERATION s) => new SamRidEnumeration(s), throw_on_error)); }
public override IEnumerable <NtType> CreateTypes() { return(new NtType[] { new NtType(SamUtils.SAM_SERVER_NT_TYPE_NAME, SamUtils.GetSamServerGenericMapping(), typeof(SamServerAccessRights), typeof(SamServerAccessRights), MandatoryLabelPolicy.NoWriteUp), new NtType(SamUtils.SAM_DOMAIN_NT_TYPE_NAME, SamUtils.GetSamDomainGenericMapping(), typeof(SamDomainAccessRights), typeof(SamDomainAccessRights), MandatoryLabelPolicy.NoWriteUp) }); }
/// <summary> /// Enumerate domains in the SAM. /// </summary> /// <param name="throw_on_error">True to throw on error.</param> /// <returns>The list of domains.</returns> public NtResult <IReadOnlyList <SamRidEnumeration> > EnumerateDomains(bool throw_on_error) { return(SamUtils.SamEnumerateObjects(Handle, SecurityNativeMethods.SamEnumerateDomainsInSamServer, (SAM_RID_ENUMERATION s) => new SamRidEnumeration(s), throw_on_error)); }