public IDictionaryEnumerator GetEnumerator() { if (!(this.entry.AdsObject is System.DirectoryServices.Interop.UnsafeNativeMethods.IAdsPropertyList)) { throw new NotSupportedException(Res.GetString("DSCannotEmunerate")); } DirectoryEntry clone = this.entry.CloneBrowsable(); clone.FillCache(""); System.DirectoryServices.Interop.UnsafeNativeMethods.IAdsPropertyList adsObject = (System.DirectoryServices.Interop.UnsafeNativeMethods.IAdsPropertyList)clone.AdsObject; clone.propertiesAlreadyEnumerated = true; return(new PropertyEnumerator(this.entry, clone)); }
private ActiveDirectorySecurity GetObjectSecurityFromCache() { try { if (!this.JustCreated) { SecurityMasks securityMasks = this.Options.SecurityMasks; this.RefreshCache(new string[] { securityDescriptorProperty }); if (!(this.NativeObject is System.DirectoryServices.Interop.UnsafeNativeMethods.IAdsPropertyList)) { throw new NotSupportedException(Res.GetString("DSPropertyListUnsupported")); } System.DirectoryServices.Interop.UnsafeNativeMethods.IAdsPropertyList nativeObject = (System.DirectoryServices.Interop.UnsafeNativeMethods.IAdsPropertyList) this.NativeObject; System.DirectoryServices.Interop.UnsafeNativeMethods.IAdsPropertyEntry propertyItem = (System.DirectoryServices.Interop.UnsafeNativeMethods.IAdsPropertyEntry)nativeObject.GetPropertyItem(securityDescriptorProperty, 8); GC.KeepAlive(this); object[] values = (object[])propertyItem.Values; if (values.Length < 1) { throw new InvalidOperationException(Res.GetString("DSSDNoValues")); } if (values.Length > 1) { throw new NotSupportedException(Res.GetString("DSMultipleSDNotSupported")); } System.DirectoryServices.Interop.UnsafeNativeMethods.IAdsPropertyValue value2 = (System.DirectoryServices.Interop.UnsafeNativeMethods.IAdsPropertyValue)values[0]; return(new ActiveDirectorySecurity((byte[])value2.OctetString, securityMasks)); } return(null); } catch (COMException exception) { if (exception.ErrorCode != -2147463155) { throw; } return(null); } }