コード例 #1
0
        void ReadSecurityDeclarations()
        {
            if (!m_tHeap.HasTable(DeclSecurityTable.RId))
            {
                return;
            }

            DeclSecurityTable dsTable = m_tableReader.GetDeclSecurityTable();

            for (int i = 0; i < dsTable.Rows.Count; i++)
            {
                DeclSecurityRow     dsRow = dsTable [i];
                SecurityDeclaration dec   = BuildSecurityDeclaration(dsRow);

                IHasSecurity owner = null;
                switch (dsRow.Parent.TokenType)
                {
                case TokenType.Assembly:
                    owner = this.Module.Assembly;
                    break;

                case TokenType.TypeDef:
                    owner = GetTypeDefAt(dsRow.Parent.RID);
                    break;

                case TokenType.Method:
                    owner = GetMethodDefAt(dsRow.Parent.RID);
                    break;
                }

                owner.SecurityDeclarations.Add(dec);
            }
        }
コード例 #2
0
            public int Compare(object x, object y)
            {
                DeclSecurityRow a = x as DeclSecurityRow;
                DeclSecurityRow b = y as DeclSecurityRow;

                return(Comparer.Default.Compare(
                           Utilities.CompressMetadataToken(CodedIndex.HasDeclSecurity, a.Parent),
                           Utilities.CompressMetadataToken(CodedIndex.HasDeclSecurity, b.Parent)));
            }
コード例 #3
0
ファイル: Tables.cs プロジェクト: retahc/old-code
 public override void FromRawData(byte [] buff, int offs, int numRows)
 {
     for (int i = numRows; --i >= 0;)
     {
         Row row = new DeclSecurityRow(this);
         row.FromRawData(buff, offs);
         Add(row);
         offs += DeclSecurityRow.LogicalSize;
     }
 }
コード例 #4
0
ファイル: TableHeap.cs プロジェクト: djlw78/Mosa
        /// <summary>
        /// Reads the specified token.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <param name="result">The result.</param>
        public void Read(TokenTypes token, out DeclSecurityRow result)
        {
            if ((token & TokenTypes.TableMask) != TokenTypes.DeclSecurity)
            {
                throw new ArgumentException("Invalid token type for DeclSecurityRow.", "token");
            }

            using (BinaryReader reader = CreateReaderForToken(token))
            {
                result = new DeclSecurityRow((System.Security.Permissions.SecurityAction)reader.ReadUInt16(), ReadIndexValue(reader, IndexType.HasDeclSecurity), ReadIndexValue(reader, IndexType.BlobHeap));
            }
        }
コード例 #5
0
 public virtual void VisitDeclSecurityRow(DeclSecurityRow row)
 {
 }
コード例 #6
0
 protected SecurityDeclaration BuildSecurityDeclaration(DeclSecurityRow dsRow)
 {
     return(BuildSecurityDeclaration(dsRow.Action, m_root.Streams.BlobHeap.Read(dsRow.PermissionSet)));
 }
コード例 #7
0
ファイル: MetadataRoot.cs プロジェクト: djlw78/Mosa
        void IMetadataProvider.Read(TokenTypes token, out DeclSecurityRow result)
        {
            TableHeap theap = (TableHeap)_streams[(int)HeapType.Tables];

            theap.Read(token, out result);
        }
コード例 #8
0
 public virtual void VisitDeclSecurityRow(DeclSecurityRow row)
 {
 }