예제 #1
0
 /// <summary>Gets the InheritedObjectType for an ACE, if defined.</summary>
 /// <param name="pAce">A pointer to an ACE.</param>
 /// <returns>The InheritedObjectType value, if this is an object ACE, otherwise <see langword="null"/>.</returns>
 /// <exception cref="ArgumentNullException">pAce</exception>
 public static Guid?GetInheritedObjectType(this PACE pAce)
 {
     if (pAce.IsNull)
     {
         throw new ArgumentNullException(nameof(pAce));
     }
     return(!pAce.IsObjectAce() ? null : pAce.DangerousGetHandle().ToStructure <ACCESS_ALLOWED_OBJECT_ACE>().InheritedObjectType);
 }
예제 #2
0
 /// <summary>Gets the Flags for an ACE, if defined.</summary>
 /// <param name="pAce">A pointer to an ACE.</param>
 /// <returns>The Flags value, if this is an object ACE, otherwise <see langword="null"/>.</returns>
 /// <exception cref="ArgumentNullException">pAce</exception>
 public static AdvApi32.ObjectAceFlags?GetFlags(this PACE pAce)
 {
     if (pAce.IsNull)
     {
         throw new ArgumentNullException(nameof(pAce));
     }
     return(!pAce.IsObjectAce() ? null : pAce.DangerousGetHandle().ToStructure <ACCESS_ALLOWED_OBJECT_ACE>().Flags);
 }
예제 #3
0
        /// <summary>Gets the SID for an ACE.</summary>
        /// <param name="pAce">A pointer to an ACE.</param>
        /// <returns>The SID value.</returns>
        /// <exception cref="ArgumentNullException">pAce</exception>
        public static SafePSID GetSid(this PACE pAce)
        {
            if (pAce.IsNull)
            {
                throw new ArgumentNullException(nameof(pAce));
            }
            var offset = Marshal.SizeOf(typeof(ACE_HEADER)) + sizeof(uint);

            if (pAce.IsObjectAce())
            {
                offset += sizeof(uint) + Marshal.SizeOf(typeof(Guid)) * 2;
            }
            return(SafePSID.CreateFromPtr(pAce.DangerousGetHandle().Offset(offset)));
        }
예제 #4
0
 /// <summary>Gets the header for an ACE.</summary>
 /// <param name="pAce">A pointer to an ACE.</param>
 /// <returns>The <see cref="ACE_HEADER"/> value.</returns>
 /// <exception cref="ArgumentNullException">pAce</exception>
 public static ACE_HEADER GetHeader(this PACE pAce) => !pAce.IsNull ? pAce.DangerousGetHandle().ToStructure <ACE_HEADER>() : throw new ArgumentNullException(nameof(pAce));
예제 #5
0
 /// <summary>Gets the mask for an ACE.</summary>
 /// <param name="pAce">A pointer to an ACE.</param>
 /// <returns>The ACCESS_MASK value.</returns>
 /// <exception cref="ArgumentNullException">pAce</exception>
 public static uint GetMask(this PACE pAce) => !pAce.IsNull ? pAce.DangerousGetHandle().ToStructure <ACCESS_ALLOWED_ACE>().Mask : throw new ArgumentNullException(nameof(pAce));