Esempio n. 1
0
        private void LoadData(CLIFile pFile)
        {
            int typeDefIndex = 0;

            if (pFile.TypeDefTable.Length >= 0xFFFF)
            {
                typeDefIndex = pFile.ReadInt32() - 1;
            }
            else
            {
                typeDefIndex = pFile.ReadUInt16() - 1;
            }
            if (typeDefIndex >= 0)
            {
                NestedClass = pFile.TypeDefTable[typeDefIndex];
            }
            typeDefIndex = 0;
            if (pFile.TypeDefTable.Length >= 0xFFFF)
            {
                typeDefIndex = pFile.ReadInt32() - 1;
            }
            else
            {
                typeDefIndex = pFile.ReadUInt16() - 1;
            }
            if (typeDefIndex >= 0)
            {
                EnclosingClass = pFile.TypeDefTable[typeDefIndex];
            }
        }
Esempio n. 2
0
        private void LoadData(CLIFile pFile)
        {
            int typeDefIndex = 0;

            if (pFile.TypeDefTable.Length >= 0xFFFF)
            {
                typeDefIndex = pFile.ReadInt32() - 1;
            }
            else
            {
                typeDefIndex = pFile.ReadUInt16() - 1;
            }
            if (typeDefIndex >= 0)
            {
                Parent = pFile.TypeDefTable[typeDefIndex];
            }
            if (pFile.EventTable.Length >= 0xFFFF)
            {
                EventListIndex = pFile.ReadInt32() - 1;
            }
            else
            {
                EventListIndex = pFile.ReadUInt16() - 1;
            }
        }
Esempio n. 3
0
		private void LoadData(CLIFile pFile)
		{
			int typeDefIndex = 0;
			if (pFile.TypeDefTable.Length >= 0xFFFF) typeDefIndex = pFile.ReadInt32() - 1;
			else typeDefIndex = pFile.ReadUInt16() - 1;
			if (typeDefIndex >= 0) Parent = pFile.TypeDefTable[typeDefIndex];
			if (pFile.PropertyTable.Length >= 0xFFFF) PropertyListIndex = pFile.ReadInt32() - 1;
			else PropertyListIndex = pFile.ReadUInt16() - 1;
		}
Esempio n. 4
0
		private void LoadData(CLIFile pFile)
		{
			Flags = (TypeAttributes)pFile.ReadUInt32();
			TypeName = pFile.ReadStringHeap(pFile.ReadHeapIndex(HeapOffsetSizes.Strings32Bit));
			TypeNamespace = pFile.ReadStringHeap(pFile.ReadHeapIndex(HeapOffsetSizes.Strings32Bit));
			Extends.LoadData(pFile);
			if (pFile.FieldTable.Length >= 0xFFFF) FieldListIndex = pFile.ReadInt32() - 1;
			else FieldListIndex = pFile.ReadUInt16() - 1;
			if (pFile.MethodDefTable.Length >= 0xFFFF) MethodListIndex = pFile.ReadInt32() - 1;
			else MethodListIndex = pFile.ReadUInt16() - 1;
		}
Esempio n. 5
0
		private void LoadData(CLIFile pFile)
		{
			int typeDefIndex = 0;
			if (pFile.TypeDefTable.Length >= 0xFFFF) typeDefIndex = pFile.ReadInt32() - 1;
			else typeDefIndex = pFile.ReadUInt16() - 1;
			if (typeDefIndex >= 0) NestedClass = pFile.TypeDefTable[typeDefIndex];
			typeDefIndex = 0;
			if (pFile.TypeDefTable.Length >= 0xFFFF) typeDefIndex = pFile.ReadInt32() - 1;
			else typeDefIndex = pFile.ReadUInt16() - 1;
			if (typeDefIndex >= 0) EnclosingClass = pFile.TypeDefTable[typeDefIndex];
		}
Esempio n. 6
0
        public void LoadData(CLIFile pFile)
        {
            int token = 0;

            if (pFile.ModuleTable.Length > ResolutionScopeTypeMax16BitRows ||
                pFile.ModuleRefTable.Length > ResolutionScopeTypeMax16BitRows ||
                pFile.AssemblyRefTable.Length > ResolutionScopeTypeMax16BitRows ||
                pFile.TypeRefTable.Length > ResolutionScopeTypeMax16BitRows)
            {
                token = pFile.ReadInt32();
            }
            else
            {
                token = pFile.ReadUInt16();
            }
            Type  = (ResolutionScopeType)(token & ResolutionScopeTypeMask);
            token = (token >> ResolutionScopeTypeBits) - 1;
            if (token >= 0)
            {
                switch (Type)
                {
                case ResolutionScopeType.Module: Module = pFile.ModuleTable[token]; break;

                case ResolutionScopeType.ModuleRef: ModuleRef = pFile.ModuleRefTable[token]; break;

                case ResolutionScopeType.AssemblyRef: AssemblyRef = pFile.AssemblyRefTable[token]; break;

                case ResolutionScopeType.TypeRef: TypeRef = pFile.TypeRefTable[token]; break;

                default: throw new BadImageFormatException("ResolutionScope Type");
                }
            }
        }
Esempio n. 7
0
        public void LoadData(CLIFile pFile)
        {
            int token = 0;

            if (pFile.MethodDefTable.Length > MethodDefOrRefTypeMax16BitRows ||
                pFile.MemberRefTable.Length > MethodDefOrRefTypeMax16BitRows)
            {
                token = pFile.ReadInt32();
            }
            else
            {
                token = pFile.ReadUInt16();
            }
            Type  = (MethodDefOrRefType)(token & MethodDefOrRefTypeMask);
            token = (token >> MethodDefOrRefTypeBits) - 1;
            if (token >= 0)
            {
                switch (Type)
                {
                case MethodDefOrRefType.MethodDef: MethodDef = pFile.MethodDefTable[token]; break;

                case MethodDefOrRefType.MemberRef: MemberRef = pFile.MemberRefTable[token]; break;

                default: throw new BadImageFormatException("MethodDefOrRef Type");
                }
            }
        }
Esempio n. 8
0
        public void LoadData(CLIFile pFile)
        {
            int token = 0;

            if (pFile.FieldTable.Length > HasFieldMarshalTypeMax16BitRows ||
                pFile.ParamTable.Length > HasFieldMarshalTypeMax16BitRows)
            {
                token = pFile.ReadInt32();
            }
            else
            {
                token = pFile.ReadUInt16();
            }
            Type  = (HasFieldMarshalType)(token & HasFieldMarshalTypeMask);
            token = (token >> HasFieldMarshalTypeBits) - 1;
            if (token >= 0)
            {
                switch (Type)
                {
                case HasFieldMarshalType.Field: Field = pFile.FieldTable[token]; break;

                case HasFieldMarshalType.Param: Param = pFile.ParamTable[token]; break;

                default: throw new BadImageFormatException("HasFieldMarshal Type");
                }
            }
        }
Esempio n. 9
0
        public void LoadData(CLIFile pFile)
        {
            int token = 0;

            if (pFile.FileTable.Length > ImplementationTypeMax16BitRows ||
                pFile.AssemblyRefTable.Length > ImplementationTypeMax16BitRows ||
                pFile.ExportedTypeTable.Length > ImplementationTypeMax16BitRows)
            {
                token = pFile.ReadInt32();
            }
            else
            {
                token = pFile.ReadUInt16();
            }
            Type  = (ImplementationType)(token & ImplementationTypeMask);
            token = (token >> ImplementationTypeBits) - 1;
            if (token >= 0)
            {
                switch (Type)
                {
                case ImplementationType.File: File = pFile.FileTable[token]; break;

                case ImplementationType.AssemblyRef: AssemblyRef = pFile.AssemblyRefTable[token]; break;

                case ImplementationType.ExportedType: ExportedType = pFile.ExportedTypeTable[token]; break;

                default: throw new BadImageFormatException("Implementation Type");
                }
            }
        }
Esempio n. 10
0
        public void LoadData(CLIFile pFile)
        {
            int token = 0;

            if (pFile.TypeDefTable.Length > TypeDefRefOrSpecTypeMax16BitRows ||
                pFile.TypeRefTable.Length > TypeDefRefOrSpecTypeMax16BitRows ||
                pFile.TypeSpecTable.Length > TypeDefRefOrSpecTypeMax16BitRows)
            {
                token = pFile.ReadInt32();
            }
            else
            {
                token = pFile.ReadUInt16();
            }
            Type  = (TypeDefRefOrSpecType)(token & TypeDefRefOrSpecTypeMask);
            token = (token >> TypeDefRefOrSpecTypeBits) - 1;
            if (token >= 0)
            {
                switch (Type)
                {
                case TypeDefRefOrSpecType.TypeDef: TypeDef = pFile.TypeDefTable[token]; break;

                case TypeDefRefOrSpecType.TypeRef: TypeRef = pFile.TypeRefTable[token]; break;

                case TypeDefRefOrSpecType.TypeSpec: TypeSpec = pFile.TypeSpecTable[token]; break;

                default: throw new BadImageFormatException("TypeDefRefOrSpec Type");
                }
            }
        }
Esempio n. 11
0
        public void LoadData(CLIFile pFile)
        {
            int token = 0;

            if (pFile.TypeDefTable.Length > HasDeclSecurityTypeMax16BitRows ||
                pFile.MethodDefTable.Length > HasDeclSecurityTypeMax16BitRows ||
                pFile.AssemblyTable.Length > HasDeclSecurityTypeMax16BitRows)
            {
                token = pFile.ReadInt32();
            }
            else
            {
                token = pFile.ReadUInt16();
            }
            Type  = (HasDeclSecurityType)(token & HasDeclSecurityTypeMask);
            token = (token >> HasDeclSecurityTypeBits) - 1;
            if (token >= 0)
            {
                switch (Type)
                {
                case HasDeclSecurityType.TypeDef: TypeDef = pFile.TypeDefTable[token]; break;

                case HasDeclSecurityType.MethodDef: MethodDef = pFile.MethodDefTable[token]; break;

                case HasDeclSecurityType.Assembly: Assembly = pFile.AssemblyTable[token]; break;

                default: throw new BadImageFormatException("HasDeclSecurity Type");
                }
            }
        }
Esempio n. 12
0
        public void LoadData(CLIFile pFile)
        {
            int token = 0;

            if (pFile.EventTable.Length > HasSemanticsTypeMax16BitRows ||
                pFile.PropertyTable.Length > HasSemanticsTypeMax16BitRows)
            {
                token = pFile.ReadInt32();
            }
            else
            {
                token = pFile.ReadUInt16();
            }
            Type  = (HasSemanticsType)(token & HasSemanticsTypeMask);
            token = (token >> HasSemanticsTypeBits) - 1;
            if (token >= 0)
            {
                switch (Type)
                {
                case HasSemanticsType.Event: Event = pFile.EventTable[token]; break;

                case HasSemanticsType.Property: Property = pFile.PropertyTable[token]; break;

                default: throw new BadImageFormatException("HasSemantics Type");
                }
            }
        }
Esempio n. 13
0
 private void LoadData(CLIFile pFile)
 {
     Processor = pFile.ReadUInt32();
     int assemblyRefIndex = 0;
     if (pFile.AssemblyRefTable.Length >= 0xFFFF) assemblyRefIndex = pFile.ReadInt32() - 1;
     else assemblyRefIndex = pFile.ReadUInt16() - 1;
     if (assemblyRefIndex >= 0) AssemblyRef = pFile.AssemblyRefTable[assemblyRefIndex];
 }
Esempio n. 14
0
		private void LoadData(CLIFile pFile)
		{
			int typeDefIndex = 0;
			if (pFile.TypeDefTable.Length >= 0xFFFF) typeDefIndex = pFile.ReadInt32() - 1;
			else typeDefIndex = pFile.ReadUInt16() - 1;
			if (typeDefIndex >= 0) Class = pFile.TypeDefTable[typeDefIndex];
			Interface.LoadData(pFile);
		}
 private void LoadData(CLIFile pFile)
 {
     int genericParamIndex = 0;
     if (pFile.GenericParamTable.Length >= 0xFFFF) genericParamIndex = pFile.ReadInt32() - 1;
     else genericParamIndex = pFile.ReadUInt16() - 1;
     if (genericParamIndex >= 0) Owner = pFile.GenericParamTable[genericParamIndex];
     Constraint.LoadData(pFile);
 }
Esempio n. 16
0
		private void LoadData(CLIFile pFile)
		{
			Offset = pFile.ReadUInt32();
			int fieldIndex = 0;
			if (pFile.FieldTable.Length >= 0xFFFF) fieldIndex = pFile.ReadInt32() - 1;
			else fieldIndex = pFile.ReadUInt16() - 1;
			if (fieldIndex >= 0) Field = pFile.FieldTable[fieldIndex];
		}
Esempio n. 17
0
		private void LoadData(CLIFile pFile)
		{
			PackingSize = pFile.ReadUInt16();
			ClassSize = pFile.ReadUInt32();
			int typeDefIndex = 0;
			if (pFile.TypeDefTable.Length >= 0xFFFF) typeDefIndex = pFile.ReadInt32() - 1;
			else typeDefIndex = pFile.ReadUInt16() - 1;
			if (typeDefIndex >= 0) Parent = pFile.TypeDefTable[typeDefIndex];
		}
Esempio n. 18
0
 private void LoadData(CLIFile pFile)
 {
     Semantics = pFile.ReadUInt16();
     int methodDefIndex = 0;
     if (pFile.MethodDefTable.Length >= 0xFFFF) methodDefIndex = pFile.ReadInt32() - 1;
     else methodDefIndex = pFile.ReadUInt16() - 1;
     if (methodDefIndex >= 0) Method = pFile.MethodDefTable[methodDefIndex];
     Association.LoadData(pFile);
 }
Esempio n. 19
0
		public static void Initialize(CLIFile pFile)
		{
			if ((pFile.CLIMetadataTables.PresentTables & (1ul << MetadataTables.PropertyMap)) != 0)
			{
				pFile.PropertyMapTable = new PropertyMapData[pFile.ReadInt32()];
				for (int index = 0; index < pFile.PropertyMapTable.Length; ++index) pFile.PropertyMapTable[index] = new PropertyMapData() { CLIFile = pFile, TableIndex = index };
			}
			else pFile.PropertyMapTable = new PropertyMapData[0];
		}
Esempio n. 20
0
 public static void Initialize(CLIFile pFile)
 {
     if ((pFile.CLIMetadataTablesHeader.PresentTables & (1ul << CLIMetadataTables.ManifestResource)) != 0)
     {
         pFile.ManifestResourceTable = new ManifestResourceData[pFile.ReadInt32()];
         for (int index = 0; index < pFile.ManifestResourceTable.Length; ++index) pFile.ManifestResourceTable[index] = new ManifestResourceData() { CLIFile = pFile, TableIndex = index };
     }
     else pFile.ManifestResourceTable = new ManifestResourceData[0];
 }
Esempio n. 21
0
 public static void Initialize(CLIFile pFile)
 {
     if ((pFile.CLIMetadataTablesHeader.PresentTables & (1ul << CLIMetadataTables.File)) != 0)
     {
         pFile.FileTable = new FileData[pFile.ReadInt32()];
         for (int index = 0; index < pFile.FileTable.Length; ++index) pFile.FileTable[index] = new FileData() { CLIFile = pFile, TableIndex = index };
     }
     else pFile.FileTable = new FileData[0];
 }
Esempio n. 22
0
 public static void Initialize(CLIFile pFile)
 {
     if ((pFile.CLIMetadataTablesHeader.PresentTables & (1ul << CLIMetadataTables.AssemblyProcessor)) != 0)
     {
         pFile.AssemblyProcessorTable = new AssemblyProcessorData[pFile.ReadInt32()];
         for (int index = 0; index < pFile.AssemblyProcessorTable.Length; ++index) pFile.AssemblyProcessorTable[index] = new AssemblyProcessorData() { CLIFile = pFile, TableIndex = index };
     }
     else pFile.AssemblyProcessorTable = new AssemblyProcessorData[0];
 }
Esempio n. 23
0
 public static void Initialize(CLIFile pFile)
 {
     if ((pFile.CLIMetadataTablesHeader.PresentTables & (1ul << CLIMetadataTables.GenericParam)) != 0)
     {
         pFile.GenericParamTable = new GenericParamData[pFile.ReadInt32()];
         for (int index = 0; index < pFile.GenericParamTable.Length; ++index) pFile.GenericParamTable[index] = new GenericParamData() { CLIFile = pFile, TableIndex = index };
     }
     else pFile.GenericParamTable = new GenericParamData[0];
 }
Esempio n. 24
0
 private void LoadData(CLIFile pFile)
 {
     int typeDefIndex = 0;
     if (pFile.TypeDefTable.Length >= 0xFFFF) typeDefIndex = pFile.ReadInt32() - 1;
     else typeDefIndex = pFile.ReadUInt16() - 1;
     if (typeDefIndex >= 0) Class = pFile.TypeDefTable[typeDefIndex];
     MethodBody.LoadData(pFile);
     MethodDeclaration.LoadData(pFile);
 }
Esempio n. 25
0
		private void LoadData(CLIFile pFile)
		{
			MappingFlags = (PInvokeAttributes)pFile.ReadUInt16();
			MemberForwarded.LoadData(pFile);
			ImportName = pFile.ReadStringHeap(pFile.ReadHeapIndex(HeapOffsetSizes.Strings32Bit));
			int moduleRefIndex = 0;
			if (pFile.ModuleRefTable.Length >= 0xFFFF) moduleRefIndex = pFile.ReadInt32() - 1;
			else moduleRefIndex = pFile.ReadUInt16() - 1;
			if (moduleRefIndex >= 0) ImportScope = pFile.ModuleRefTable[moduleRefIndex];
		}
Esempio n. 26
0
 private void LoadData(CLIFile pFile)
 {
     OSPlatformId = pFile.ReadUInt32();
     OSMajorVersion = pFile.ReadUInt32();
     OSMinorVersion = pFile.ReadUInt32();
     int assemblyRefIndex = 0;
     if (pFile.AssemblyRefTable.Length >= 0xFFFF) assemblyRefIndex = pFile.ReadInt32() - 1;
     else assemblyRefIndex = pFile.ReadUInt16() - 1;
     if (assemblyRefIndex >= 0) AssemblyRef = pFile.AssemblyRefTable[assemblyRefIndex];
 }
Esempio n. 27
0
		private void LoadData(CLIFile pFile)
		{
			InitialValueOffset = pFile.ReadUInt32();
			CLIFile.SectionHeader sectionHeader = pFile.GetSection(InitialValueOffset);
			InitialValueOffset = sectionHeader.PointerToRawData + (InitialValueOffset - sectionHeader.VirtualAddress);
			int fieldIndex = 0;
			if (pFile.FieldTable.Length >= 0xFFFF) fieldIndex = pFile.ReadInt32() - 1;
			else fieldIndex = pFile.ReadUInt16() - 1;
			if (fieldIndex >= 0) Field = pFile.FieldTable[fieldIndex];
		}
Esempio n. 28
0
 private void LoadData(CLIFile pFile)
 {
     Flags = pFile.ReadUInt32();
     int typeDefIndex = 0;
     if (pFile.TypeDefTable.Length >= 0xFFFF) typeDefIndex = pFile.ReadInt32() - 1;
     else typeDefIndex = pFile.ReadUInt16() - 1;
     if (typeDefIndex >= 0) TypeDef = pFile.TypeDefTable[typeDefIndex];
     TypeName = pFile.ReadStringHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Strings32Bit));
     TypeNamespace = pFile.ReadStringHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Strings32Bit));
     Implementation.LoadData(pFile);
 }
Esempio n. 29
0
 private void LoadData(CLIFile pFile)
 {
     Flags         = (TypeAttributes)pFile.ReadUInt32();
     TypeName      = pFile.ReadStringHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Strings32Bit));
     TypeNamespace = pFile.ReadStringHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Strings32Bit));
     Extends.LoadData(pFile);
     if (pFile.FieldTable.Length >= 0xFFFF)
     {
         FieldListIndex = pFile.ReadInt32() - 1;
     }
     else
     {
         FieldListIndex = pFile.ReadUInt16() - 1;
     }
     if (pFile.MethodDefTable.Length >= 0xFFFF)
     {
         MethodListIndex = pFile.ReadInt32() - 1;
     }
     else
     {
         MethodListIndex = pFile.ReadUInt16() - 1;
     }
 }
Esempio n. 30
0
        private void LoadData(CLIFile pFile)
        {
            RVA = pFile.ReadUInt32();
            ImplFlags = (MethodImplAttributes)pFile.ReadUInt16();
            Flags = (MethodAttributes)pFile.ReadUInt16();
            Name = pFile.ReadStringHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Strings32Bit));
            Signature = pFile.ReadBlobHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Blob32Bit));
            if (pFile.ParamTable.Length >= 0xFFFF) ParamListIndex = pFile.ReadInt32() - 1;
            else ParamListIndex = pFile.ReadUInt16() - 1;

            if (RVA != 0)
            {
                Body = new MethodDefBodyData();
                Body.LoadData(this);
            }
        }
Esempio n. 31
0
        private void LoadData(CLIFile pFile)
        {
            Offset = pFile.ReadUInt32();
            int fieldIndex = 0;

            if (pFile.FieldTable.Length >= 0xFFFF)
            {
                fieldIndex = pFile.ReadInt32() - 1;
            }
            else
            {
                fieldIndex = pFile.ReadUInt16() - 1;
            }
            if (fieldIndex >= 0)
            {
                Field = pFile.FieldTable[fieldIndex];
            }
        }
Esempio n. 32
0
        private void LoadData(CLIFile pFile)
        {
            Processor = pFile.ReadUInt32();
            int assemblyRefIndex = 0;

            if (pFile.AssemblyRefTable.Length >= 0xFFFF)
            {
                assemblyRefIndex = pFile.ReadInt32() - 1;
            }
            else
            {
                assemblyRefIndex = pFile.ReadUInt16() - 1;
            }
            if (assemblyRefIndex >= 0)
            {
                AssemblyRef = pFile.AssemblyRefTable[assemblyRefIndex];
            }
        }
Esempio n. 33
0
        private void LoadData(CLIFile pFile)
        {
            int genericParamIndex = 0;

            if (pFile.GenericParamTable.Length >= 0xFFFF)
            {
                genericParamIndex = pFile.ReadInt32() - 1;
            }
            else
            {
                genericParamIndex = pFile.ReadUInt16() - 1;
            }
            if (genericParamIndex >= 0)
            {
                Owner = pFile.GenericParamTable[genericParamIndex];
            }
            Constraint.LoadData(pFile);
        }
Esempio n. 34
0
        private void LoadData(CLIFile pFile)
        {
            int typeDefIndex = 0;

            if (pFile.TypeDefTable.Length >= 0xFFFF)
            {
                typeDefIndex = pFile.ReadInt32() - 1;
            }
            else
            {
                typeDefIndex = pFile.ReadUInt16() - 1;
            }
            if (typeDefIndex >= 0)
            {
                Class = pFile.TypeDefTable[typeDefIndex];
            }
            Interface.LoadData(pFile);
        }
Esempio n. 35
0
        private void LoadData(CLIFile pFile)
        {
            PackingSize = pFile.ReadUInt16();
            ClassSize   = pFile.ReadUInt32();
            int typeDefIndex = 0;

            if (pFile.TypeDefTable.Length >= 0xFFFF)
            {
                typeDefIndex = pFile.ReadInt32() - 1;
            }
            else
            {
                typeDefIndex = pFile.ReadUInt16() - 1;
            }
            if (typeDefIndex >= 0)
            {
                Parent = pFile.TypeDefTable[typeDefIndex];
            }
        }
Esempio n. 36
0
        private void LoadData(CLIFile pFile)
        {
            Semantics = pFile.ReadUInt16();
            int methodDefIndex = 0;

            if (pFile.MethodDefTable.Length >= 0xFFFF)
            {
                methodDefIndex = pFile.ReadInt32() - 1;
            }
            else
            {
                methodDefIndex = pFile.ReadUInt16() - 1;
            }
            if (methodDefIndex >= 0)
            {
                Method = pFile.MethodDefTable[methodDefIndex];
            }
            Association.LoadData(pFile);
        }
Esempio n. 37
0
 public static void Initialize(CLIFile pFile)
 {
     if ((pFile.CLIMetadataTablesHeader.PresentTables & (1ul << CLIMetadataTables.AssemblyProcessor)) != 0)
     {
         pFile.AssemblyProcessorTable = new AssemblyProcessorData[pFile.ReadInt32()];
         for (int index = 0; index < pFile.AssemblyProcessorTable.Length; ++index)
         {
             pFile.AssemblyProcessorTable[index] = new AssemblyProcessorData()
             {
                 CLIFile = pFile, TableIndex = index
             }
         }
         ;
     }
     else
     {
         pFile.AssemblyProcessorTable = new AssemblyProcessorData[0];
     }
 }
Esempio n. 38
0
 public static void Initialize(CLIFile pFile)
 {
     if ((pFile.CLIMetadataTablesHeader.PresentTables & (1ul << CLIMetadataTables.GenericParamConstraint)) != 0)
     {
         pFile.GenericParamConstraintTable = new GenericParamConstraintData[pFile.ReadInt32()];
         for (int index = 0; index < pFile.GenericParamConstraintTable.Length; ++index)
         {
             pFile.GenericParamConstraintTable[index] = new GenericParamConstraintData()
             {
                 CLIFile = pFile, TableIndex = index
             }
         }
         ;
     }
     else
     {
         pFile.GenericParamConstraintTable = new GenericParamConstraintData[0];
     }
 }
Esempio n. 39
0
        private void LoadData(CLIFile pFile)
        {
            int typeDefIndex = 0;

            if (pFile.TypeDefTable.Length >= 0xFFFF)
            {
                typeDefIndex = pFile.ReadInt32() - 1;
            }
            else
            {
                typeDefIndex = pFile.ReadUInt16() - 1;
            }
            if (typeDefIndex >= 0)
            {
                Class = pFile.TypeDefTable[typeDefIndex];
            }
            MethodBody.LoadData(pFile);
            MethodDeclaration.LoadData(pFile);
        }
Esempio n. 40
0
        private void LoadData(CLIFile pFile)
        {
            OSPlatformId   = pFile.ReadUInt32();
            OSMajorVersion = pFile.ReadUInt32();
            OSMinorVersion = pFile.ReadUInt32();
            int assemblyRefIndex = 0;

            if (pFile.AssemblyRefTable.Length >= 0xFFFF)
            {
                assemblyRefIndex = pFile.ReadInt32() - 1;
            }
            else
            {
                assemblyRefIndex = pFile.ReadUInt16() - 1;
            }
            if (assemblyRefIndex >= 0)
            {
                AssemblyRef = pFile.AssemblyRefTable[assemblyRefIndex];
            }
        }
Esempio n. 41
0
        private void LoadData(CLIFile pFile)
        {
            MappingFlags = pFile.ReadUInt16();
            MemberForwarded.LoadData(pFile);
            ImportName = pFile.ReadStringHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Strings32Bit));
            int moduleRefIndex = 0;

            if (pFile.ModuleRefTable.Length >= 0xFFFF)
            {
                moduleRefIndex = pFile.ReadInt32() - 1;
            }
            else
            {
                moduleRefIndex = pFile.ReadUInt16() - 1;
            }
            if (moduleRefIndex >= 0)
            {
                ImportScope = pFile.ModuleRefTable[moduleRefIndex];
            }
        }
Esempio n. 42
0
        private void LoadData(CLIFile pFile)
        {
            Flags = pFile.ReadUInt32();
            int typeDefIndex = 0;

            if (pFile.TypeDefTable.Length >= 0xFFFF)
            {
                typeDefIndex = pFile.ReadInt32() - 1;
            }
            else
            {
                typeDefIndex = pFile.ReadUInt16() - 1;
            }
            if (typeDefIndex >= 0)
            {
                TypeDef = pFile.TypeDefTable[typeDefIndex];
            }
            TypeName      = pFile.ReadStringHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Strings32Bit));
            TypeNamespace = pFile.ReadStringHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Strings32Bit));
            Implementation.LoadData(pFile);
        }
Esempio n. 43
0
        private void LoadData(CLIFile pFile)
        {
            InitialValueOffset = pFile.ReadUInt32();
            SectionHeader sectionHeader = pFile.GetSection(InitialValueOffset);

            InitialValueOffset = sectionHeader.PointerToRawData + (InitialValueOffset - sectionHeader.VirtualAddress);
            int fieldIndex = 0;

            if (pFile.FieldTable.Length >= 0xFFFF)
            {
                fieldIndex = pFile.ReadInt32() - 1;
            }
            else
            {
                fieldIndex = pFile.ReadUInt16() - 1;
            }
            if (fieldIndex >= 0)
            {
                Field = pFile.FieldTable[fieldIndex];
            }
        }
Esempio n. 44
0
        private void LoadData(CLIFile pFile)
        {
            RVA       = pFile.ReadUInt32();
            ImplFlags = (MethodImplAttributes)pFile.ReadUInt16();
            Flags     = (MethodAttributes)pFile.ReadUInt16();
            Name      = pFile.ReadStringHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Strings32Bit));
            Signature = pFile.ReadBlobHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Blob32Bit));
            if (pFile.ParamTable.Length >= 0xFFFF)
            {
                ParamListIndex = pFile.ReadInt32() - 1;
            }
            else
            {
                ParamListIndex = pFile.ReadUInt16() - 1;
            }

            if (RVA != 0)
            {
                Body = new MethodDefBodyData();
                Body.LoadData(this);
            }
        }
Esempio n. 45
0
        public void LoadData(CLIFile pFile)
        {
            int token = 0;

            if (pFile.MethodDefTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.FieldTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.TypeRefTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.TypeDefTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.ParamTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.InterfaceImplTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.MemberRefTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.ModuleTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.DeclSecurityTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.PropertyTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.EventTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.StandAloneSigTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.ModuleRefTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.TypeSpecTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.AssemblyTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.AssemblyRefTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.FileTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.ExportedTypeTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.ManifestResourceTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.GenericParamTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.GenericParamConstraintTable.Length > HasCustomAttributeTypeMax16BitRows ||
                pFile.MethodSpecTable.Length > HasCustomAttributeTypeMax16BitRows)
            {
                token = pFile.ReadInt32();
            }
            else
            {
                token = pFile.ReadUInt16();
            }
            Type  = (HasCustomAttributeType)(token & HasCustomAttributeTypeMask);
            token = (token >> HasCustomAttributeTypeBits) - 1;
            if (token >= 0)
            {
                switch (Type)
                {
                case HasCustomAttributeType.MethodDef: MethodDef = pFile.MethodDefTable[token]; break;

                case HasCustomAttributeType.Field: Field = pFile.FieldTable[token]; break;

                case HasCustomAttributeType.TypeRef: TypeRef = pFile.TypeRefTable[token]; break;

                case HasCustomAttributeType.TypeDef: TypeDef = pFile.TypeDefTable[token]; break;

                case HasCustomAttributeType.Param: Param = pFile.ParamTable[token]; break;

                case HasCustomAttributeType.InterfaceImpl: InterfaceImpl = pFile.InterfaceImplTable[token]; break;

                case HasCustomAttributeType.MemberRef: MemberRef = pFile.MemberRefTable[token]; break;

                case HasCustomAttributeType.Module: Module = pFile.ModuleTable[token]; break;

                case HasCustomAttributeType.DeclSecurity: DeclSecurity = pFile.DeclSecurityTable[token]; break;

                case HasCustomAttributeType.Property: Property = pFile.PropertyTable[token]; break;

                case HasCustomAttributeType.Event: Event = pFile.EventTable[token]; break;

                case HasCustomAttributeType.StandAloneSig: StandAloneSig = pFile.StandAloneSigTable[token]; break;

                case HasCustomAttributeType.ModuleRef: ModuleRef = pFile.ModuleRefTable[token]; break;

                case HasCustomAttributeType.TypeSpec: TypeSpec = pFile.TypeSpecTable[token]; break;

                case HasCustomAttributeType.Assembly: Assembly = pFile.AssemblyTable[token]; break;

                case HasCustomAttributeType.AssemblyRef: AssemblyRef = pFile.AssemblyRefTable[token]; break;

                case HasCustomAttributeType.File: File = pFile.FileTable[token]; break;

                case HasCustomAttributeType.ExportedType: ExportedType = pFile.ExportedTypeTable[token]; break;

                case HasCustomAttributeType.ManifestResource: ManifestResource = pFile.ManifestResourceTable[token]; break;

                case HasCustomAttributeType.GenericParam: GenericParam = pFile.GenericParamTable[token]; break;

                case HasCustomAttributeType.GenericParamConstraint: GenericParamConstraint = pFile.GenericParamConstraintTable[token]; break;

                case HasCustomAttributeType.MethodSpec: MethodSpec = pFile.MethodSpecTable[token]; break;

                default: throw new BadImageFormatException("HasCustomAttribute Type");
                }
            }
        }