コード例 #1
0
        internal AceAccess(MemoryMarshaler m, bool allowed)
        {
            _allowed = allowed;

            ACCESS_ALLOWED_ACE ace = (ACCESS_ALLOWED_ACE)m.ParseStruct(typeof(ACCESS_ALLOWED_ACE), false);

            m.Advance(OffsetOfSid());
            BaseInit(ace.Header, (AccessType)ace.Mask, new Sid(m.Ptr));
        }
コード例 #2
0
        internal static Ace Create(MemoryMarshaler m)
        {
            IntPtr initialPtr = m.Ptr;                  // Save current ptr

            Debug.Assert(Marshal.SizeOf(typeof(ACE_HEADER)) == 4);
            ACE_HEADER head = (ACE_HEADER)m.ParseStruct(typeof(ACE_HEADER), false);
            Ace        ace;

            switch (head.AceType)
            {
            case AceType.ACCESS_ALLOWED_ACE_TYPE:
                ace = new AceAccessAllowed(m);
                break;

            case AceType.ACCESS_DENIED_ACE_TYPE:
                ace = new AceAccessDenied(m);
                break;

            // Object ACE not yet supported

/*
 *                              case AceType.ACCESS_ALLOWED_OBJECT_ACE_TYPE:
 *                                      ace = new AceAccessAllowedObject(m);
 *                                      break;
 *
 *                              case AceType.ACCESS_DENIED_OBJECT_ACE_TYPE:
 *                                      ace = new AceAccessDeniedObject(m);
 *                                      break;
 */
            default:
                throw new NotSupportedException("Unsupported ACE type: " + head.AceType);
            }

            // Restore initial ptr and move forward the size of the ACE
            m.Ptr = initialPtr;
            m.Advance(head.AceSize);
            return(ace);
        }
コード例 #3
0
ファイル: Ace.cs プロジェクト: nuxleus/flexwikicore
        internal static Ace Create(MemoryMarshaler m)
        {
            IntPtr initialPtr = m.Ptr;	// Save current ptr

            Debug.Assert(Marshal.SizeOf(typeof(ACE_HEADER)) == 4);
            ACE_HEADER head = (ACE_HEADER)m.ParseStruct(typeof(ACE_HEADER), false);
            Ace ace;
            switch(head.AceType)
            {
                case AceType.ACCESS_ALLOWED_ACE_TYPE:
                    ace = new AceAccessAllowed(m);
                    break;

                case AceType.ACCESS_DENIED_ACE_TYPE:
                    ace = new AceAccessDenied(m);
                    break;

                // Object ACE not yet supported
            /*
                case AceType.ACCESS_ALLOWED_OBJECT_ACE_TYPE:
                    ace = new AceAccessAllowedObject(m);
                    break;

                case AceType.ACCESS_DENIED_OBJECT_ACE_TYPE:
                    ace = new AceAccessDeniedObject(m);
                    break;
            */
                default:
                    throw new NotSupportedException("Unsupported ACE type: " + head.AceType);
            }

            // Restore initial ptr and move forward the size of the ACE
            m.Ptr = initialPtr;
            m.Advance(head.AceSize);
            return ace;
        }