/// <summary> /// The constructor /// </summary> /// <param name="binary">The input binary</param> /// <param name="offset">The offset in the binary</param> public _ObjectAce(byte[] binary, int offset) : base(binary, offset) { int length = BitConverter.ToUInt16(binary, offset + 2); if (offset > binary.Length - length) { throw new ArgumentException(nameof(offset)); } _AccessMask = BitConverter.ToInt32(binary, offset + DtypUtility.ACE_HEADER_LENGTH); ObjectFlags = (_ObjectAceFlags)BitConverter.ToInt32(binary, offset + DtypUtility.SHORT_FIXED_ACE_LENGTH); int pointer = DtypUtility.ACE_HEADER_LENGTH + DtypUtility.SHORT_FIXED_ACE_LENGTH; if (ObjectFlags.HasFlag(_ObjectAceFlags.ObjectAceTypePresent)) { ObjectType = DtypUtility.ReadGuid(binary, offset + pointer); pointer += 16; } if (ObjectFlags.HasFlag(_ObjectAceFlags.InheritedObjectAceTypePresent)) { InheritedObjectType = DtypUtility.ReadGuid(binary, offset + pointer); pointer += 16; } _SecurityIdentifier = new _SID(binary, offset + pointer); pointer += _SecurityIdentifier.Size; int appDataLength = length - pointer; if (appDataLength > 0) { this.applicationData = new byte[appDataLength]; Array.Copy(binary, offset + pointer, this.applicationData, 0, appDataLength); } }