CreateFromBinaryForm() public static method

public static CreateFromBinaryForm ( byte binaryForm, int offset ) : System.Security.AccessControl.GenericAce
binaryForm byte
offset int
return System.Security.AccessControl.GenericAce
Ejemplo n.º 1
0
        internal void SetBinaryForm(byte[] binaryForm, int offset)
        {
            int count;
            int length;

            RawAcl.VerifyHeader(binaryForm, offset, out this._revision, out count, out length);
            int num1 = length + offset;

            offset    += 8;
            this._aces = new ArrayList(count);
            int num2 = 8;

            for (int index = 0; index < count; ++index)
            {
                GenericAce fromBinaryForm = GenericAce.CreateFromBinaryForm(binaryForm, offset);
                int        binaryLength   = fromBinaryForm.BinaryLength;
                if (num2 + binaryLength > GenericAcl.MaxBinaryLength)
                {
                    throw new ArgumentException(Environment.GetResourceString("ArgumentException_InvalidAclBinaryForm"), "binaryForm");
                }
                this._aces.Add((object)fromBinaryForm);
                if (binaryLength % 4 != 0)
                {
                    throw new SystemException();
                }
                num2 += binaryLength;
                if ((int)this._revision == (int)GenericAcl.AclRevisionDS)
                {
                    offset += (int)binaryForm[offset + 2] + ((int)binaryForm[offset + 3] << 8);
                }
                else
                {
                    offset += binaryLength;
                }
                if (offset > num1)
                {
                    throw new ArgumentException(Environment.GetResourceString("ArgumentException_InvalidAclBinaryForm"), "binaryForm");
                }
            }
        }
Ejemplo n.º 2
0
        // Token: 0x06001E9B RID: 7835 RVA: 0x0006AEC8 File Offset: 0x000690C8
        internal void SetBinaryForm(byte[] binaryForm, int offset)
        {
            int num;
            int num2;

            RawAcl.VerifyHeader(binaryForm, offset, out this._revision, out num, out num2);
            num2      += offset;
            offset    += 8;
            this._aces = new ArrayList(num);
            int num3 = 8;

            for (int i = 0; i < num; i++)
            {
                GenericAce genericAce   = GenericAce.CreateFromBinaryForm(binaryForm, offset);
                int        binaryLength = genericAce.BinaryLength;
                if (num3 + binaryLength > GenericAcl.MaxBinaryLength)
                {
                    throw new ArgumentException(Environment.GetResourceString("ArgumentException_InvalidAclBinaryForm"), "binaryForm");
                }
                this._aces.Add(genericAce);
                if (binaryLength % 4 != 0)
                {
                    throw new SystemException();
                }
                num3 += binaryLength;
                if (this._revision == GenericAcl.AclRevisionDS)
                {
                    offset += (int)binaryForm[offset + 2] + ((int)binaryForm[offset + 3] << 8);
                }
                else
                {
                    offset += binaryLength;
                }
                if (offset > num2)
                {
                    throw new ArgumentException(Environment.GetResourceString("ArgumentException_InvalidAclBinaryForm"), "binaryForm");
                }
            }
        }
Ejemplo n.º 3
0
        public RawAcl(byte [] binaryForm, int offset)
        {
            if (binaryForm == null)
            {
                throw new ArgumentNullException("binaryForm");
            }

            if (offset < 0 || offset > binaryForm.Length - 8)
            {
                throw new ArgumentOutOfRangeException("offset", offset, "Offset out of range");
            }

            revision = binaryForm[offset];
            if (revision != AclRevision && revision != AclRevisionDS)
            {
                throw new ArgumentException("Invalid ACL - unknown revision", "binaryForm");
            }

            int binaryLength = ReadUShort(binaryForm, offset + 2);

            if (offset > binaryForm.Length - binaryLength)
            {
                throw new ArgumentException("Invalid ACL - truncated", "binaryForm");
            }

            int pos     = offset + 8;
            int numAces = ReadUShort(binaryForm, offset + 4);

            list = new List <GenericAce>(numAces);
            for (int i = 0; i < numAces; ++i)
            {
                GenericAce newAce = GenericAce.CreateFromBinaryForm(binaryForm, pos);
                list.Add(newAce);
                pos += newAce.BinaryLength;
            }
        }
Ejemplo n.º 4
0
 public GenericAce Copy()
 {
     byte[] buffer = new byte[BinaryLength];
     GetBinaryForm(buffer, 0);
     return(GenericAce.CreateFromBinaryForm(buffer, 0));
 }
 /// <summary>Creates a deep copy of this Access Control Entry (ACE).</summary>
 /// <returns>The <see cref="T:System.Security.AccessControl.GenericAce" /> object that this method creates.</returns>
 // Token: 0x06001E50 RID: 7760 RVA: 0x00069EFC File Offset: 0x000680FC
 public GenericAce Copy()
 {
     byte[] binaryForm = new byte[this.BinaryLength];
     this.GetBinaryForm(binaryForm, 0);
     return(GenericAce.CreateFromBinaryForm(binaryForm, 0));
 }
Ejemplo n.º 6
0
 static GenericAce CopyAce(GenericAce ace)
 {
     byte[] binaryForm = new byte[ace.BinaryLength];
     ace.GetBinaryForm(binaryForm, 0);
     return(GenericAce.CreateFromBinaryForm(binaryForm, 0));
 }