示例#1
0
        internal MetaDataRow ReadRow(BinaryReader reader, byte[] signature)
        {
            MetaDataRow row = new MetaDataRow();

            row._parts    = new ValueType[signature.Length];
            row.NETHeader = tablesHeap._netheader;

            row._offset = (uint)(reader.BaseStream.Position + tablesHeap.StreamOffset);

            for (int i = 0; i < signature.Length; i++)
            {
                if (signature[i] == sizeof(uint))
                {
                    row._parts[i] = reader.ReadUInt32();
                }
                else if (signature[i] == sizeof(ushort))
                {
                    row._parts[i] = reader.ReadUInt16();
                }
                else if (signature[i] == sizeof(byte))
                {
                    row._parts[i] = reader.ReadByte();
                }
            }

            return(row);
        }
示例#2
0
 internal MetaDataMember CreateMember(Type type, MetaDataRow row, MetaDataTableType table, int index)
 {
     MetaDataMember member = (MetaDataMember)Activator.CreateInstance(type, row);
     member._table = table;
     member._netheader = tablesHeap._netheader;
     member._metadatatoken = (uint)(((int)table) << 24 | index);
     return member;
 }
示例#3
0
        internal MetaDataMember CreateMember(Type type, MetaDataRow row, MetaDataTableType table, int index)
        {
            MetaDataMember member = (MetaDataMember)Activator.CreateInstance(type, row);

            member._table         = table;
            member._netheader     = tablesHeap._netheader;
            member._metadatatoken = (uint)(((int)table) << 24 | index);
            return(member);
        }
示例#4
0
 public SecurityDeclaration(MetaDataRow row)
     : base(row)
 {
 }
示例#5
0
 public AssemblyDefinition(MetaDataRow row)
     : base(row)
 {
 }
示例#6
0
 public StandAloneSignature(MetaDataRow row)
     : base(row)
 {
 }
示例#7
0
文件: EnCLog.cs 项目: Rex-Hays/GNIDA2
 public EnCLog(MetaDataRow row)
     : base(row)
 {
 }
示例#8
0
 public ModuleReference(MetaDataRow row)
     : base(row)
 {
 }
示例#9
0
 public EventMap(MetaDataRow row)
     : base(row)
 {
 }
示例#10
0
 public GenericParameter(MetaDataRow row)
     : base(row)
 {
 }
示例#11
0
 public ModuleDefinition(MetaDataRow row)
     : base(row)
 {
 }
示例#12
0
 public MemberReference(MetaDataRow row)
     : base(row)
 {
 }
示例#13
0
        private bool GetRowAndType(BinaryReader reader, MetaDataTable table, out MetaDataRow row, out Type type)
        {
            type = null;
            row  = default(MetaDataRow);

            switch (table.Type)
            {
            case MetaDataTableType.Module:
                row = ReadRow(reader, GetModuleSignature()); type = typeof(ModuleDefinition); break;

            case MetaDataTableType.TypeRef:
                row = ReadRow(reader, GetTypeRefSignature()); type = typeof(TypeReference); break;

            case MetaDataTableType.TypeDef:
                row = ReadRow(reader, GetTypeDefSignature()); type = typeof(TypeDefinition); break;

            case MetaDataTableType.FieldPtr:
                row = ReadRow(reader, GetFieldPtrSignature()); type = typeof(FieldPtr); break;

            case MetaDataTableType.Field:
                row = ReadRow(reader, GetFieldDefSignature()); type = typeof(FieldDefinition); break;

            case MetaDataTableType.MethodPtr:
                row = ReadRow(reader, GetMethodPtrSignature()); type = typeof(MethodPtr); break;

            case MetaDataTableType.Method:
                row = ReadRow(reader, GetMethodDefSignature()); type = typeof(MethodDefinition); break;

            case MetaDataTableType.ParamPtr:
                row = ReadRow(reader, GetParamPtrSignature()); type = typeof(ParamPtr); break;

            case MetaDataTableType.Param:
                row = ReadRow(reader, GetParamDefSignature()); type = typeof(ParameterDefinition); break;

            case MetaDataTableType.InterfaceImpl:
                row = ReadRow(reader, GetInterfaceImplSignature()); type = typeof(InterfaceImplementation); break;

            case MetaDataTableType.MemberRef:
                row = ReadRow(reader, GetMemberRefSignature());
                tablesHeap._netheader.BlobHeap._mainStream.Seek(Convert.ToUInt32(row._parts[2]), SeekOrigin.Begin);
                tablesHeap._netheader.BlobHeap._binReader.ReadByte();
                byte sigtype = tablesHeap._netheader.BlobHeap._binReader.ReadByte();

                if (sigtype == 0x6)
                {
                    type = typeof(FieldReference);
                }
                else
                {
                    type = typeof(MethodReference);
                }

                break;

            case MetaDataTableType.Constant:
                row = ReadRow(reader, GetConstantSignature()); type = typeof(Constant); break;

            case MetaDataTableType.CustomAttribute:
                row = ReadRow(reader, GetCustomAttributeSignature()); type = typeof(CustomAttribute); break;

            case MetaDataTableType.FieldMarshal:
                row = ReadRow(reader, GetFieldMarshalSignature()); type = typeof(FieldMarshal); break;

            case MetaDataTableType.DeclSecurity:
                row = ReadRow(reader, GetSecurityDeclSignature()); type = typeof(SecurityDeclaration); break;

            case MetaDataTableType.ClassLayout:
                row = ReadRow(reader, GetClassLayoutSignature()); type = typeof(ClassLayout); break;

            case MetaDataTableType.FieldLayout:
                row = ReadRow(reader, GetFieldLayoutSignature()); type = typeof(FieldLayout); break;

            case MetaDataTableType.StandAloneSig:
                row = ReadRow(reader, GetStandAloneSigSignature()); type = typeof(StandAloneSignature); break;

            case MetaDataTableType.EventMap:
                row = ReadRow(reader, GetEventMapSignature()); type = typeof(EventMap); break;

            case MetaDataTableType.Event:
                row = ReadRow(reader, GetEventDefSignature()); type = typeof(EventDefinition); break;

            case MetaDataTableType.PropertyMap:
                row = ReadRow(reader, GetPropertyMapSignature()); type = typeof(PropertyMap); break;

            case MetaDataTableType.PropertyPtr:
                row = ReadRow(reader, GetPropertyPtrSignature()); type = typeof(PropertyPtr); break;

            case MetaDataTableType.Property:
                row = ReadRow(reader, GetPropertyDefSignature()); type = typeof(PropertyDefinition); break;

            case MetaDataTableType.MethodSemantics:
                row = ReadRow(reader, GetMethodSemanticsSignature()); type = typeof(MethodSemantics); break;

            case MetaDataTableType.MethodImpl:
                row = ReadRow(reader, GetMethodImplSignature()); type = typeof(MethodImplementation); break;

            case MetaDataTableType.ModuleRef:
                row = ReadRow(reader, GetModuleRefSignature()); type = typeof(ModuleReference); break;

            case MetaDataTableType.TypeSpec:
                row = ReadRow(reader, GetTypeSpecSignature()); type = typeof(TypeSpecification); break;

            case MetaDataTableType.MethodSpec:
                row = ReadRow(reader, GetMethodSpecSignature()); type = typeof(MethodSpecification); break;

            case MetaDataTableType.ImplMap:
                row = ReadRow(reader, GetPInvokeImplSignature()); type = typeof(PInvokeImplementation); break;

            case MetaDataTableType.FieldRVA:
                row = ReadRow(reader, GetFieldRVASignature()); type = typeof(FieldRVA); break;

            case MetaDataTableType.Assembly:
                row = ReadRow(reader, GetAssemblyDefSignature()); type = typeof(AssemblyDefinition); break;

            case MetaDataTableType.AssemblyProcessor:
                row = ReadRow(reader, GetAssemblyProcSignature()); type = typeof(AssemblyProcessor); break;

            case MetaDataTableType.AssemblyOS:
                row = ReadRow(reader, GetAssemblyOSSignature()); type = typeof(AssemblyOS); break;

            case MetaDataTableType.AssemblyRef:
                row = ReadRow(reader, GetAssemblyRefSignature()); type = typeof(AssemblyReference); break;

            case MetaDataTableType.AssemblyRefProcessor:
                row = ReadRow(reader, GetAssemblyRefProcSignature()); type = typeof(AssemblyRefProcessor); break;

            case MetaDataTableType.AssemblyRefOS:
                row = ReadRow(reader, GetAssemblyRefOSSignature()); type = typeof(AssemblyRefOS); break;

            case MetaDataTableType.File:
                row = ReadRow(reader, GetFileReferenceSignature()); type = typeof(File); break;

            case MetaDataTableType.ExportedType:
                row = ReadRow(reader, GetExportedTypeSignature()); type = typeof(ExportedType); break;

            case MetaDataTableType.ManifestResource:
                row = ReadRow(reader, GetManifestResSignature()); type = typeof(ManifestResource); break;

            case MetaDataTableType.NestedClass:
                row = ReadRow(reader, GetNestedClassSignature()); type = typeof(NestedClass); break;

            case MetaDataTableType.EncLog:
                row = ReadRow(reader, GetEnCLogSignature()); type = typeof(EnCLog); break;

            case MetaDataTableType.EncMap:
                row = ReadRow(reader, GetEnCMapSignature()); type = typeof(EnCMap); break;

            case MetaDataTableType.GenericParam:
                row = ReadRow(reader, GetGenericParamSignature()); type = typeof(GenericParameter); break;

            case MetaDataTableType.GenericParamConstraint:
                row = ReadRow(reader, GetGenericParamConstraintSignature()); type = typeof(GenericParamConstraint); break;
            }

            return(type != null);
        }
示例#14
0
 public AssemblyReference(MetaDataRow row)
     : base(row)
 {
 }
示例#15
0
 public FieldRVA(MetaDataRow row)
     : base(row)
 {
 }
示例#16
0
 public CustomAttribute(MetaDataRow row)
     : base(row)
 {
 }
示例#17
0
 public FileReference(MetaDataRow row)
     : base(row)
 {
 }
示例#18
0
 public MethodReference(MetaDataRow row)
     : base(row)
 {
 }
示例#19
0
        internal MetaDataRow ReadRow(BinaryReader reader, byte[] signature)
        {
            MetaDataRow row = new MetaDataRow();
            row._parts = new ValueType[signature.Length];
            row.NETHeader = tablesHeap._netheader;

            row._offset = (uint)(reader.BaseStream.Position + tablesHeap.StreamOffset);

            for (int i = 0; i < signature.Length; i++)
            {
                if (signature[i] == sizeof(uint))
                    row._parts[i] = reader.ReadUInt32();
                else if (signature[i] == sizeof(ushort))
                    row._parts[i] = reader.ReadUInt16();
                else if (signature[i] == sizeof(byte))
                    row._parts[i] = reader.ReadByte();
            }

            return row;
        }
示例#20
0
 public InterfaceImplementation(MetaDataRow row)
     : base(row)
 {
 }
示例#21
0
 public PropertyPtr(MetaDataRow row)
     : base(row)
 {
 }
示例#22
0
 public MethodImplementation(MetaDataRow row)
     : base(row)
 {
 }
示例#23
0
 public void Dispose()
 {
     _metadatarow = default(MetaDataRow);
     ClearCache();
 }
示例#24
0
 public ModuleReference(MetaDataRow row)
     : base(row)
 {
 }
示例#25
0
 public FieldDefinition(MetaDataRow row)
     : base(row)
 {
 }
示例#26
0
 public AssemblyOS(MetaDataRow row)
     : base(row)
 {
 }
示例#27
0
 public NestedClass(MetaDataRow row)
     : base(row)
 {
 }
示例#28
0
 public AssemblyProcessor(MetaDataRow row)
     : base(row)
 {
 }
示例#29
0
 public TypeDefinition(MetaDataRow row)
     : base(row)
 {
 }
示例#30
0
 public TypeSpecification(MetaDataRow row)
     : this(row.NETHeader.BlobHeap.ReadTypeSignature(Convert.ToUInt32(row._parts[0]), null))
 {
     _metadatarow = row;
 }
示例#31
0
 public ParameterDefinition(MetaDataRow row)
     : base(row)
 {
 }
示例#32
0
 public ParameterDefinition(MetaDataRow row)
     : base(row)
 {
 }
示例#33
0
 public FileReference(MetaDataRow row)
     : base(row)
 {
 }
示例#34
0
 public PropertyMap(MetaDataRow row)
     : base(row)
 {
 }
示例#35
0
 public ManifestResource(MetaDataRow row)
     : base(row)
 {
 }
示例#36
0
 public FieldPtr(MetaDataRow row)
     : base(row)
 {
 }
示例#37
0
 public FieldMarshal(MetaDataRow row)
     : base(row)
 {
 }
示例#38
0
 public SecurityDeclaration(MetaDataRow row)
     : base(row)
 {
 }
示例#39
0
        private bool GetRowAndType(BinaryReader reader, MetaDataTable table, out MetaDataRow row, out Type type)
        {
            type = null;
            row = default(MetaDataRow);

            switch (table.Type)
            {
                case MetaDataTableType.Module:
                    row = ReadRow(reader, GetModuleSignature()); type = typeof(ModuleDefinition); break;
                case MetaDataTableType.TypeRef:
                    row = ReadRow(reader, GetTypeRefSignature()); type = typeof(TypeReference); break;
                case MetaDataTableType.TypeDef:
                    row = ReadRow(reader, GetTypeDefSignature()); type = typeof(TypeDefinition); break;
                case MetaDataTableType.FieldPtr:
                    row = ReadRow(reader, GetFieldPtrSignature()); type = typeof(FieldPtr); break;
                case MetaDataTableType.Field:
                    row = ReadRow(reader, GetFieldDefSignature()); type = typeof(FieldDefinition); break;
                case MetaDataTableType.MethodPtr:
                    row = ReadRow(reader, GetMethodPtrSignature()); type = typeof(MethodPtr); break;
                case MetaDataTableType.Method:
                    row = ReadRow(reader, GetMethodDefSignature()); type = typeof(MethodDefinition); break;
                case MetaDataTableType.ParamPtr:
                    row = ReadRow(reader, GetParamPtrSignature()); type = typeof(ParamPtr); break;
                case MetaDataTableType.Param:
                    row = ReadRow(reader, GetParamDefSignature()); type = typeof(ParameterDefinition); break;
                case MetaDataTableType.InterfaceImpl:
                    row = ReadRow(reader, GetInterfaceImplSignature()); type = typeof(InterfaceImplementation); break;
                case MetaDataTableType.MemberRef:
                    row = ReadRow(reader, GetMemberRefSignature());
                    tablesHeap._netheader.BlobHeap._mainStream.Seek(Convert.ToUInt32(row._parts[2]), SeekOrigin.Begin);
                    tablesHeap._netheader.BlobHeap._binReader.ReadByte();
                    byte sigtype = tablesHeap._netheader.BlobHeap._binReader.ReadByte();

                    if (sigtype == 0x6)
                        type = typeof(FieldReference);
                    else
                        type = typeof(MethodReference);

                    break;
                case MetaDataTableType.Constant:
                    row = ReadRow(reader, GetConstantSignature()); type = typeof(Constant); break;
                case MetaDataTableType.CustomAttribute:
                    row = ReadRow(reader, GetCustomAttributeSignature()); type = typeof(CustomAttribute); break;
                case MetaDataTableType.FieldMarshal:
                    row = ReadRow(reader, GetFieldMarshalSignature()); type = typeof(FieldMarshal); break;
                case MetaDataTableType.DeclSecurity:
                    row = ReadRow(reader, GetSecurityDeclSignature()); type = typeof(SecurityDeclaration); break;
                case MetaDataTableType.ClassLayout:
                    row = ReadRow(reader, GetClassLayoutSignature()); type = typeof(ClassLayout); break;
                case MetaDataTableType.FieldLayout:
                    row = ReadRow(reader, GetFieldLayoutSignature()); type = typeof(FieldLayout); break;
                case MetaDataTableType.StandAloneSig:
                    row = ReadRow(reader, GetStandAloneSigSignature()); type = typeof(StandAloneSignature); break;
                case MetaDataTableType.EventMap:
                    row = ReadRow(reader, GetEventMapSignature()); type = typeof(EventMap); break;
                case MetaDataTableType.Event:
                    row = ReadRow(reader, GetEventDefSignature()); type = typeof(EventDefinition); break;
                case MetaDataTableType.PropertyMap:
                    row = ReadRow(reader, GetPropertyMapSignature()); type = typeof(PropertyMap); break;
                case MetaDataTableType.PropertyPtr:
                    row = ReadRow(reader, GetPropertyPtrSignature()); type = typeof(PropertyPtr); break;
                case MetaDataTableType.Property:
                    row = ReadRow(reader, GetPropertyDefSignature()); type = typeof(PropertyDefinition); break;
                case MetaDataTableType.MethodSemantics:
                    row = ReadRow(reader, GetMethodSemanticsSignature()); type = typeof(MethodSemantics); break;
                case MetaDataTableType.MethodImpl:
                    row = ReadRow(reader, GetMethodImplSignature()); type = typeof(MethodImplementation); break;
                case MetaDataTableType.ModuleRef:
                    row = ReadRow(reader, GetModuleRefSignature()); type = typeof(ModuleReference); break;
                case MetaDataTableType.TypeSpec:
                    row = ReadRow(reader, GetTypeSpecSignature()); type = typeof(TypeSpecification); break;
                case MetaDataTableType.MethodSpec:
                    row = ReadRow(reader, GetMethodSpecSignature()); type = typeof(MethodSpecification); break;
                case MetaDataTableType.ImplMap:
                    row = ReadRow(reader, GetPInvokeImplSignature()); type = typeof(PInvokeImplementation); break;
                case MetaDataTableType.FieldRVA:
                    row = ReadRow(reader, GetFieldRVASignature()); type = typeof(FieldRVA); break;
                case MetaDataTableType.Assembly:
                    row = ReadRow(reader, GetAssemblyDefSignature()); type = typeof(AssemblyDefinition); break;
                case MetaDataTableType.AssemblyProcessor:
                    row = ReadRow(reader, GetAssemblyProcSignature()); type = typeof(AssemblyProcessor); break;
                case MetaDataTableType.AssemblyOS:
                    row = ReadRow(reader, GetAssemblyOSSignature()); type = typeof(AssemblyOS); break;
                case MetaDataTableType.AssemblyRef:
                    row = ReadRow(reader, GetAssemblyRefSignature()); type = typeof(AssemblyReference); break;
                case MetaDataTableType.AssemblyRefProcessor:
                    row = ReadRow(reader, GetAssemblyRefProcSignature()); type = typeof(AssemblyRefProcessor); break;
                case MetaDataTableType.AssemblyRefOS:
                    row = ReadRow(reader, GetAssemblyRefOSSignature()); type = typeof(AssemblyRefOS); break;
                case MetaDataTableType.File:
                    row = ReadRow(reader, GetFileReferenceSignature()); type = typeof(File); break;
                case MetaDataTableType.ExportedType:
                    row = ReadRow(reader, GetExportedTypeSignature()); type = typeof(ExportedType); break;
                case MetaDataTableType.ManifestResource:
                    row = ReadRow(reader, GetManifestResSignature()); type = typeof(ManifestResource); break;
                case MetaDataTableType.NestedClass:
                    row = ReadRow(reader, GetNestedClassSignature()); type = typeof(NestedClass); break;
                case MetaDataTableType.EncLog:
                    row = ReadRow(reader, GetEnCLogSignature()); type = typeof(EnCLog); break;
                case MetaDataTableType.EncMap:
                    row = ReadRow(reader, GetEnCMapSignature()); type = typeof(EnCMap); break;
                case MetaDataTableType.GenericParam:
                    row = ReadRow(reader, GetGenericParamSignature()); type = typeof(GenericParameter); break;
                case MetaDataTableType.GenericParamConstraint:
                    row = ReadRow(reader, GetGenericParamConstraintSignature()); type = typeof(GenericParamConstraint); break;

            }

            return type != null;
        }
示例#40
0
 public PInvokeImplementation(MetaDataRow row)
     : base(row)
 {
 }
示例#41
0
 public PropertyDefinition(MetaDataRow row)
     : base(row)
 {
 }
示例#42
0
 public AssemblyReference(MetaDataRow row)
     : base(row)
 {
 }
示例#43
0
 public ClassLayout(MetaDataRow row)
     : base(row)
 {
 }
示例#44
0
 public PropertyMap(MetaDataRow row)
     : base(row)
 {
 }
示例#45
0
 public FieldRVA(MetaDataRow row)
     : base(row)
 {
 }
示例#46
0
 public Constant(MetaDataRow row)
     : base(row)
 {
 }
示例#47
0
 public MetaDataMember(MetaDataRow row)
 {
     UpdateRowOnRebuild = true;
     _metadatarow       = row;
 }
示例#48
0
 public TypeReference(MetaDataRow row)
     : base(row)
 {
 }
示例#49
0
 public MethodDefinition(MetaDataRow row)
     : base(row)
 {
 }
示例#50
0
 public AssemblyDefinition(MetaDataRow row)
     : base(row)
 {
 }
示例#51
0
 public MemberReference(MetaDataRow row)
     : base(row)
 {
 }
示例#52
0
 public MethodSemantics(MetaDataRow row)
     : base(row)
 {
 }
示例#53
0
 public PropertyPtr(MetaDataRow row)
     : base(row)
 {
 }
示例#54
0
 public MethodSemantics(MetaDataRow row)
     : base(row)
 {
 }
示例#55
0
 public InterfaceImplementation(MetaDataRow row)
     : base(row)
 {
 }
示例#56
0
 public FieldPtr(MetaDataRow row)
     : base(row)
 {
 }
示例#57
0
 public EventDefinition(MetaDataRow row)
     : base(row)
 {
 }
示例#58
0
 public Constant(MetaDataRow row)
     : base(row)
 {
 }
示例#59
0
 public GenericParamConstraint(MetaDataRow row)
     : base(row)
 {
 }
示例#60
0
 public StandAloneSignature(MetaDataRow row)
     : base(row)
 {
 }