Esempio n. 1
0
        public static ACL ParseACL(byte[] data, int maxLength, int offset)
        {
            Debug.Assert(data.Length - offset >= maxLength);
            Debug.Assert(0 <= offset && offset <= data.Length);
            Debug.Assert(maxLength >= 8);

            ACL res = new ACL();

            res.ACLRevision = data[offset];
            res.ACLSize     = BitConverter.ToUInt16(data, offset + 2);
            res.ACECount    = BitConverter.ToUInt16(data, offset + 4);

            res.ACEs = new ACE[res.ACECount];

            int pointer = offset + 8;

            for (int i = 0; i < res.ACECount; i++)
            {
                ACE ace = ACE.ParseACE(data, res.ACLSize, pointer);
                res.ACEs[i] = ace;

                pointer += ace.Size;
            }

            return(res);
        }
Esempio n. 2
0
        public static ACE ParseACE(byte[] data, int maxLength, int offset)
        {
            Debug.Assert(data.Length - offset >= maxLength);
            Debug.Assert(0 <= offset && offset <= data.Length);
            Debug.Assert(maxLength >= 8);

            ACE res = new ACE();

            res.Type       = (ACEType)data[offset];
            res.Flags      = (ACEFlags)data[offset + 1];
            res.Size       = BitConverter.ToUInt16(data, offset + 2);
            res.AccessMask = (FileSystemRights)BitConverter.ToInt32(data, offset + 4);

            res.SID = new SecurityIdentifier(data, offset + 8);

            return(res);
        }