Exemple #1
0
 public Acl(Acl existingAcl, int newSize)
     : this(newSize)
 {
     this.AddRange(0, existingAcl);
 }
Exemple #2
0
 private void SwapDacl(Acl dacl)
 {
     BaseObject.SwapRef <Acl>(ref _dacl, dacl);
 }
Exemple #3
0
 private void SwapSacl(Acl sacl)
 {
     BaseObject.SwapRef <Acl>(ref _sacl, sacl);
 }
Exemple #4
0
        private void Read()
        {
            NtStatus status;
            bool     present, defaulted;
            IntPtr   dacl, group, owner, sacl;

            // Read the DACL.
            if ((status = Win32.RtlGetDaclSecurityDescriptor(
                     this,
                     out present,
                     out dacl,
                     out defaulted
                     )) >= NtStatus.Error)
            {
                Win32.Throw(status);
            }

            if (present && dacl != IntPtr.Zero)
            {
                this.SwapDacl(new Acl(Acl.FromPointer(dacl)));
            }
            else
            {
                this.SwapDacl(null);
            }

            // Read the SACL.
            if ((status = Win32.RtlGetSaclSecurityDescriptor(
                     this,
                     out present,
                     out sacl,
                     out defaulted
                     )) >= NtStatus.Error)
            {
                Win32.Throw(status);
            }

            if (present && sacl != IntPtr.Zero)
            {
                this.SwapSacl(new Acl(Acl.FromPointer(sacl)));
            }
            else
            {
                this.SwapSacl(null);
            }

            // Read the group.
            if ((status = Win32.RtlGetGroupSecurityDescriptor(
                     this,
                     out group,
                     out defaulted
                     )) >= NtStatus.Error)
            {
                Win32.Throw(status);
            }

            if (group != IntPtr.Zero)
            {
                this.SwapGroup(new Sid(group));
            }
            else
            {
                this.SwapGroup(null);
            }

            // Read the owner.
            if ((status = Win32.RtlGetOwnerSecurityDescriptor(
                     this,
                     out owner,
                     out defaulted
                     )) >= NtStatus.Error)
            {
                Win32.Throw(status);
            }

            if (owner != IntPtr.Zero)
            {
                this.SwapOwner(new Sid(owner));
            }
            else
            {
                this.SwapOwner(null);
            }
        }