mscorlib(4.0.0.0) API with additions
CustomAce.cs
2 
4 {
6  public sealed class CustomAce : GenericAce
7  {
8  private byte[] _opaque;
9 
11  public static readonly int MaxOpaqueLength = 65531;
12 
15  public int OpaqueLength
16  {
17  get
18  {
19  if (_opaque == null)
20  {
21  return 0;
22  }
23  return _opaque.Length;
24  }
25  }
26 
29  public override int BinaryLength => 4 + OpaqueLength;
30 
36  public CustomAce(AceType type, AceFlags flags, byte[] opaque)
37  : base(type, flags)
38  {
39  if ((int)type <= 16)
40  {
41  throw new ArgumentOutOfRangeException("type", Environment.GetResourceString("ArgumentOutOfRange_InvalidUserDefinedAceType"));
42  }
43  SetOpaque(opaque);
44  }
45 
48  public byte[] GetOpaque()
49  {
50  return _opaque;
51  }
52 
55  public void SetOpaque(byte[] opaque)
56  {
57  if (opaque != null)
58  {
59  if (opaque.Length > MaxOpaqueLength)
60  {
61  throw new ArgumentOutOfRangeException("opaque", string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_ArrayLength"), 0, MaxOpaqueLength));
62  }
63  if (opaque.Length % 4 != 0)
64  {
65  throw new ArgumentOutOfRangeException("opaque", string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_ArrayLengthMultiple"), 4));
66  }
67  }
68  _opaque = opaque;
69  }
70 
76  public override void GetBinaryForm(byte[] binaryForm, int offset)
77  {
78  MarshalHeader(binaryForm, offset);
79  offset += 4;
80  if (OpaqueLength != 0)
81  {
83  {
84  throw new SystemException();
85  }
86  GetOpaque().CopyTo(binaryForm, offset);
87  }
88  }
89  }
90 }
Serves as the base class for system exceptions namespace.
Definition: __Canon.cs:3
The exception that is thrown when the value of an argument is outside the allowable range of values a...
AceType
Defines the available access control entry (ACE) types.
Definition: AceType.cs:4
Represents an Access Control Entry (ACE), and is the base class for all other ACE classes.
Definition: GenericAce.cs:6
int OpaqueLength
Gets the length of the opaque data associated with this T:System.Security.AccessControl....
Definition: CustomAce.cs:16
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
override void GetBinaryForm(byte[] binaryForm, int offset)
Marshals the contents of the T:System.Security.AccessControl.CustomAce object into the specified byte...
Definition: CustomAce.cs:76
AceFlags
Specifies the inheritance and auditing behavior of an access control entry (ACE).
Definition: AceFlags.cs:5
static readonly int MaxOpaqueLength
Returns the maximum allowed length of an opaque data blob for this T:System.Security....
Definition: CustomAce.cs:11
static CultureInfo CurrentCulture
Gets or sets the T:System.Globalization.CultureInfo object that represents the culture used by the cu...
Definition: CultureInfo.cs:120
override int BinaryLength
Gets the length, in bytes, of the binary representation of the current T:System.Security....
Definition: CustomAce.cs:29
CustomAce(AceType type, AceFlags flags, byte[] opaque)
Initializes a new instance of the T:System.Security.AccessControl.CustomAce class.
Definition: CustomAce.cs:36
Provides information about a specific culture (called a locale for unmanaged code development)....
Definition: CultureInfo.cs:16
Represents an Access Control Entry (ACE) that is not defined by one of the members of the T:System....
Definition: CustomAce.cs:6
byte [] GetOpaque()
Returns the opaque data associated with this T:System.Security.AccessControl.CustomAce object.
Definition: CustomAce.cs:48
void SetOpaque(byte[] opaque)
Sets the opaque callback data associated with this T:System.Security.AccessControl....
Definition: CustomAce.cs:55