12 internal ushort _indexInAcl;
14 internal const int HeaderLength = 4;
54 return inheritanceFlags;
60 public PropagationFlags PropagationFlags
73 return propagationFlags;
98 public abstract int BinaryLength
103 internal void MarshalHeader(
byte[] binaryForm,
int offset)
105 int binaryLength = BinaryLength;
106 if (binaryForm ==
null)
114 if (binaryForm.Length - offset < BinaryLength)
118 if (binaryLength > 65535)
120 throw new SystemException();
122 binaryForm[offset + 0] = (byte)AceType;
123 binaryForm[offset + 1] = (byte)AceFlags;
124 binaryForm[offset + 2] = (byte)binaryLength;
125 binaryForm[offset + 3] = (byte)(binaryLength >> 8);
128 internal GenericAce(AceType type, AceFlags flags)
134 internal static AceFlags AceFlagsFromAuditFlags(AuditFlags auditFlags)
139 aceFlags |=
AceFlags.SuccessfulAccess;
147 throw new ArgumentException(Environment.GetResourceString(
"Arg_EnumAtLeastOneFlag"),
"auditFlags");
152 internal static AceFlags AceFlagsFromInheritanceFlags(InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags)
157 aceFlags |=
AceFlags.ContainerInherit;
167 aceFlags |=
AceFlags.NoPropagateInherit;
177 internal static void VerifyHeader(
byte[] binaryForm,
int offset)
179 if (binaryForm ==
null)
181 throw new ArgumentNullException(
"binaryForm");
185 throw new ArgumentOutOfRangeException(
"offset", Environment.GetResourceString(
"ArgumentOutOfRange_NeedNonNegNum"));
187 if (binaryForm.Length - offset < 4)
189 throw new ArgumentOutOfRangeException(
"binaryForm", Environment.GetResourceString(
"ArgumentOutOfRange_ArrayTooSmall"));
191 if ((binaryForm[offset + 3] << 8) + binaryForm[offset + 2] > binaryForm.Length - offset)
193 throw new ArgumentOutOfRangeException(
"binaryForm", Environment.GetResourceString(
"ArgumentOutOfRange_ArrayTooSmall"));
203 VerifyHeader(binaryForm, offset);
206 if (aceType ==
AceType.AccessAllowed || aceType ==
AceType.AccessDenied || aceType ==
AceType.SystemAudit || aceType ==
AceType.SystemAlarm || aceType ==
AceType.AccessAllowedCallback || aceType ==
AceType.AccessDeniedCallback || aceType ==
AceType.SystemAuditCallback || aceType ==
AceType.SystemAlarmCallback)
211 genericAce =
new CommonAce(flags, qualifier, accessMask, sid, isCallback, opaque);
215 else if (aceType ==
AceType.AccessAllowedObject || aceType ==
AceType.AccessDeniedObject || aceType ==
AceType.SystemAuditObject || aceType ==
AceType.SystemAlarmObject || aceType ==
AceType.AccessAllowedCallbackObject || aceType ==
AceType.AccessDeniedCallbackObject || aceType ==
AceType.SystemAuditCallbackObject || aceType ==
AceType.SystemAlarmCallbackObject)
220 genericAce =
new ObjectAce(aceFlags, qualifier2, accessMask2, sid2, objectFlags, objectAceType, inheritedObjectAceType, isCallback2, opaque2);
224 else if (aceType ==
AceType.AccessAllowedCompound)
229 genericAce =
new CompoundAce(flags2, accessMask3, compoundAceType, sid3);
237 int num = binaryForm[offset + 2] + (binaryForm[offset + 3] << 8);
243 array =
new byte[num2];
244 for (
int i = 0; i < num2; i++)
246 array[i] = binaryForm[offset + num - num2 + i];
249 genericAce =
new CustomAce(aceType, flags3, array);
257 if ((genericAce is
ObjectAce || binaryForm[offset + 2] + (binaryForm[offset + 3] << 8) == genericAce.
BinaryLength) && (!(genericAce is
ObjectAce) || binaryForm[offset + 2] + (binaryForm[offset + 3] << 8) == genericAce.
BinaryLength || binaryForm[offset + 2] + (binaryForm[offset + 3] << 8) - 32 == genericAce.
BinaryLength))
269 public abstract void GetBinaryForm(
byte[] binaryForm,
int offset);
275 byte[] binaryForm =
new byte[BinaryLength];
276 GetBinaryForm(binaryForm, 0);
277 return CreateFromBinaryForm(binaryForm, 0);
284 public sealed
override bool Equals(
object o)
291 if (genericAce ==
null)
299 int binaryLength = BinaryLength;
301 if (binaryLength != binaryLength2)
305 byte[] array =
new byte[binaryLength];
306 byte[] array2 =
new byte[binaryLength2];
307 GetBinaryForm(array, 0);
309 for (
int i = 0; i < array.Length; i++)
311 if (array[i] != array2[i])
323 int binaryLength = BinaryLength;
324 byte[] array =
new byte[binaryLength];
325 GetBinaryForm(array, 0);
327 for (
int i = 0; i < binaryLength; i += 4)
329 int num2 = array[i] + (array[i + 1] << 8) + (array[i + 2] << 16) + (array[i + 3] << 24);
342 if ((
object)left ==
null && (
object)right ==
null)
346 if ((
object)left ==
null || (
object)right ==
null)
350 return left.
Equals(right);
360 return !(left == right);
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
PropagationFlags
Specifies how Access Control Entries (ACEs) are propagated to child objects. These flags are signific...
AceType AceType
Gets the type of this Access Control Entry (ACE).
Represents a compound Access Control Entry (ACE).
The exception that is thrown when the value of an argument is outside the allowable range of values a...
static GenericAce CreateFromBinaryForm(byte[] binaryForm, int offset)
Creates a T:System.Security.AccessControl.GenericAce object from the specified binary data.
AceType
Defines the available access control entry (ACE) types.
Represents an Access Control Entry (ACE), and is the base class for all other ACE classes.
sealed override int GetHashCode()
Serves as a hash function for the T:System.Security.AccessControl.GenericAce class....
AceFlags AceFlags
Gets or sets the T:System.Security.AccessControl.AceFlags associated with this T:System....
Provides information about, and means to manipulate, the current environment and platform....
Represents a globally unique identifier (GUID).To browse the .NET Framework source code for this type...
static bool operator !=(GenericAce left, GenericAce right)
Determines whether the specified T:System.Security.AccessControl.GenericAce objects are considered un...
GenericAce Copy()
Creates a deep copy of this Access Control Entry (ACE).
sealed override bool Equals(object o)
Determines whether the specified T:System.Security.AccessControl.GenericAce object is equal to the cu...
Controls access to Directory Services objects. This class represents an Access Control Entry (ACE) as...
Represents an access control entry (ACE).
AceFlags
Specifies the inheritance and auditing behavior of an access control entry (ACE).
The exception that is thrown when one of the arguments provided to a method is not valid.
abstract void GetBinaryForm(byte[] binaryForm, int offset)
Marshals the contents of the T:System.Security.AccessControl.GenericAce object into the specified byt...
AceQualifier
Specifies the function of an access control entry (ACE).
Represents a security identifier (SID) and provides marshaling and comparison operations for SIDs.
bool IsInherited
Gets a Boolean value that specifies whether this Access Control Entry (ACE) is inherited or is set ex...
CompoundAceType
Specifies the type of a T:System.Security.AccessControl.CompoundAce object.
InheritanceFlags
Inheritance flags specify the semantics of inheritance for access control entries (ACEs).
Represents an Access Control Entry (ACE) that is not defined by one of the members of the T:System....
ObjectAceFlags
Specifies the presence of object types for Access Control Entries (ACEs).
abstract int BinaryLength
Gets the length, in bytes, of the binary representation of the current T:System.Security....
AuditFlags
Specifies the conditions for auditing attempts to access a securable object.