8 private byte _revision;
27 for (
int i = 0; i <
Count; i++)
51 if (value.BinaryLength % 4 != 0)
64 private static void VerifyHeader(
byte[] binaryForm,
int offset, out
byte revision, out
int count, out
int length)
66 if (binaryForm ==
null)
74 if (binaryForm.Length - offset >= 8)
76 revision = binaryForm[offset + 0];
77 length = binaryForm[offset + 2] + (binaryForm[offset + 3] << 8);
78 count = binaryForm[offset + 4] + (binaryForm[offset + 5] << 8);
79 if (length <= binaryForm.Length - offset)
84 throw new ArgumentOutOfRangeException(
"binaryForm", Environment.GetResourceString(
"ArgumentOutOfRange_ArrayTooSmall"));
87 private void MarshalHeader(
byte[] binaryForm,
int offset)
89 if (binaryForm ==
null)
91 throw new ArgumentNullException(
"binaryForm");
95 throw new ArgumentOutOfRangeException(
"offset", Environment.GetResourceString(
"ArgumentOutOfRange_NeedNonNegNum"));
99 throw new InvalidOperationException(Environment.GetResourceString(
"AccessControl_AclTooLong"));
103 throw new ArgumentOutOfRangeException(
"binaryForm", Environment.GetResourceString(
"ArgumentOutOfRange_ArrayTooSmall"));
106 binaryForm[offset + 1] = 0;
109 binaryForm[offset + 4] = (byte)
Count;
110 binaryForm[offset + 5] = (byte)(
Count >> 8);
111 binaryForm[offset + 6] = 0;
112 binaryForm[offset + 7] = 0;
115 internal void SetBinaryForm(
byte[] binaryForm,
int offset)
117 VerifyHeader(binaryForm, offset, out _revision, out
int count, out
int length);
127 GenericAce genericAce = GenericAce.CreateFromBinaryForm(binaryForm, offset);
128 int binaryLength = genericAce.BinaryLength;
129 if (num + binaryLength > GenericAcl.MaxBinaryLength)
131 throw new ArgumentException(Environment.GetResourceString(
"ArgumentException_InvalidAclBinaryForm"),
"binaryForm");
133 _aces.
Add(genericAce);
134 if (binaryLength % 4 != 0)
136 throw new SystemException();
139 offset = ((_revision != GenericAcl.AclRevisionDS) ? (offset + binaryLength) : (offset + (binaryForm[offset + 2] + (binaryForm[offset + 3] << 8))));
149 throw new ArgumentException(Environment.GetResourceString(
"ArgumentException_InvalidAclBinaryForm"),
"binaryForm");
155 public RawAcl(
byte revision,
int capacity)
157 _revision = revision;
164 public RawAcl(
byte[] binaryForm,
int offset)
166 SetBinaryForm(binaryForm, offset);
176 MarshalHeader(binaryForm, offset);
186 if (binaryLength % 4 != 0)
190 offset += binaryLength;
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
override void GetBinaryForm(byte[] binaryForm, int offset)
Marshals the contents of the T:System.Security.AccessControl.RawAcl object into the specified byte ar...
static readonly int MaxBinaryLength
The maximum allowed binary length of a T:System.Security.AccessControl.GenericAcl object.
override int BinaryLength
Gets the length, in bytes, of the binary representation of the current T:System.Security....
virtual void Insert(int index, object value)
Inserts an element into the T:System.Collections.ArrayList at the specified index.
Serves as the base class for system exceptions namespace.
virtual void RemoveAt(int index)
Removes the element at the specified index of the T:System.Collections.ArrayList.
RawAcl(byte revision, int capacity)
Initializes a new instance of the T:System.Security.AccessControl.RawAcl class with the specified rev...
virtual int Count
Gets the number of elements actually contained in the T:System.Collections.ArrayList.
The exception that is thrown when the value of an argument is outside the allowable range of values a...
Represents an Access Control Entry (ACE), and is the base class for all other ACE classes.
The exception that is thrown when an arithmetic, casting, or conversion operation in a checked contex...
Represents an Access Control List (ACL).
Provides information about, and means to manipulate, the current environment and platform....
void InsertAce(int index, GenericAce ace)
Inserts the specified Access Control Entry (ACE) at the specified index.
RawAcl(byte[] binaryForm, int offset)
Initializes a new instance of the T:System.Security.AccessControl.RawAcl class from the specified bin...
override int Count
Gets the number of access control entries (ACEs) in the current T:System.Security....
virtual int Add(object value)
Adds an object to the end of the T:System.Collections.ArrayList.
override byte Revision
Gets the revision level of the T:System.Security.AccessControl.RawAcl.
abstract void GetBinaryForm(byte[] binaryForm, int offset)
Marshals the contents of the T:System.Security.AccessControl.GenericAce object into the specified byt...
Represents an access control list (ACL) and is the base class for the T:System.Security....
void RemoveAce(int index)
Removes the Access Control Entry (ACE) at the specified location.
abstract int BinaryLength
Gets the length, in bytes, of the binary representation of the current T:System.Security....
Implements the T:System.Collections.IList interface using an array whose size is dynamically increase...