Ejemplo n.º 1
0
        private static int ParseSddlAliasRights(string accessMask)
        {
            int ret = 0;

            int pos = 0;

            while (pos < accessMask.Length - 1)
            {
                string          flag  = accessMask.Substring(pos, 2);
                SddlAccessRight right = SddlAccessRight.LookupByName(flag);
                if (right == null)
                {
                    throw new ArgumentException("Invalid SDDL string.", "accessMask");
                }

                ret |= right.Value;
                pos += 2;
            }

            if (pos != accessMask.Length)
            {
                throw new ArgumentException("Invalid SDDL string.", "accessMask");
            }

            return(ret);
        }