Exemplo n.º 1
0
        public ImageCor20HeaderVM(HexBuffer buffer, DotNetCor20Data cor20)
            : base(cor20.Span)
        {
            Name = cor20.Name;
            CbVM = new UInt32HexField(cor20.Cb);
            MajorRuntimeVersionVM = new UInt16HexField(cor20.MajorRuntimeVersion, true);
            MinorRuntimeVersionVM = new UInt16HexField(cor20.MinorRuntimeVersion, true);
            MetaDataVM            = new DataDirectoryVM(cor20.MetaData);
            FlagsVM = new UInt32FlagsHexField(cor20.Flags);
            FlagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_IL_Only, 0));
            FlagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_32BitReqd, 1));
            FlagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_ILLibrary, 2));
            FlagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_StrongNameSigned, 3));
            FlagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_NativeEntryPoint, 4));
            FlagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_TrackDebugData, 16));
            FlagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_32BitPref, 17));
            EntryPointTokenRVAVM      = new UInt32HexField(cor20.EntryPointTokenOrRVA);
            ResourcesVM               = new DataDirectoryVM(cor20.Resources);
            StrongNameSignatureVM     = new DataDirectoryVM(cor20.StrongNameSignature);
            CodeManagerTableVM        = new DataDirectoryVM(cor20.CodeManagerTable);
            VTableFixupsVM            = new DataDirectoryVM(cor20.VTableFixups);
            ExportAddressTableJumpsVM = new DataDirectoryVM(cor20.ExportAddressTableJumps);
            ManagedNativeHeaderVM     = new DataDirectoryVM(cor20.ManagedNativeHeader);

            hexFields = new HexField[] {
                CbVM,
                MajorRuntimeVersionVM,
                MinorRuntimeVersionVM,
                MetaDataVM.RVAVM,
                MetaDataVM.SizeVM,
                FlagsVM,
                EntryPointTokenRVAVM,
                ResourcesVM.RVAVM,
                ResourcesVM.SizeVM,
                StrongNameSignatureVM.RVAVM,
                StrongNameSignatureVM.SizeVM,
                CodeManagerTableVM.RVAVM,
                CodeManagerTableVM.SizeVM,
                VTableFixupsVM.RVAVM,
                VTableFixupsVM.SizeVM,
                ExportAddressTableJumpsVM.RVAVM,
                ExportAddressTableJumpsVM.SizeVM,
                ManagedNativeHeaderVM.RVAVM,
                ManagedNativeHeaderVM.SizeVM,
            };
        }
Exemplo n.º 2
0
		public ImageCor20HeaderVM(HexBuffer buffer, HexPosition startOffset) {
			CbVM = new UInt32HexField(buffer, Name, "cb", startOffset + 0);
			MajorRuntimeVersionVM = new UInt16HexField(buffer, Name, "MajorRuntimeVersion", startOffset + 4, true);
			MinorRuntimeVersionVM = new UInt16HexField(buffer, Name, "MinorRuntimeVersion", startOffset + 6, true);
			MetaDataVM = new DataDirVM(buffer, Name, "MetaData", startOffset + 8);
			FlagsVM = new UInt32FlagsHexField(buffer, Name, "Flags", startOffset + 0x10);
			FlagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_IL_Only, 0));
			FlagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_32BitReqd, 1));
			FlagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_ILLibrary, 2));
			FlagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_StrongNameSigned, 3));
			FlagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_NativeEntryPoint, 4));
			FlagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_TrackDebugData, 16));
			FlagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_32BitPref, 17));
			EntryPointTokenRVAVM = new UInt32HexField(buffer, Name, "EntryPoint Token/RVA", startOffset + 0x14);
			ResourcesVM = new DataDirVM(buffer, Name, "Resources", startOffset + 0x18);
			StrongNameSignatureVM = new DataDirVM(buffer, Name, "StrongNameSignature", startOffset + 0x20);
			CodeManagerTableVM = new DataDirVM(buffer, Name, "CodeManagerTable", startOffset + 0x28);
			VTableFixupsVM = new DataDirVM(buffer, Name, "VTableFixups", startOffset + 0x30);
			ExportAddressTableJumpsVM = new DataDirVM(buffer, Name, "ExportAddressTableJumps", startOffset + 0x38);
			ManagedNativeHeaderVM = new DataDirVM(buffer, Name, "ManagedNativeHeader", startOffset + 0x40);

			hexFields = new HexField[] {
				CbVM,
				MajorRuntimeVersionVM,
				MinorRuntimeVersionVM,
				MetaDataVM.RVAVM,
				MetaDataVM.SizeVM,
				FlagsVM,
				EntryPointTokenRVAVM,
				ResourcesVM.RVAVM,
				ResourcesVM.SizeVM,
				StrongNameSignatureVM.RVAVM,
				StrongNameSignatureVM.SizeVM,
				CodeManagerTableVM.RVAVM,
				CodeManagerTableVM.SizeVM,
				VTableFixupsVM.RVAVM,
				VTableFixupsVM.SizeVM,
				ExportAddressTableJumpsVM.RVAVM,
				ExportAddressTableJumpsVM.SizeVM,
				ManagedNativeHeaderVM.RVAVM,
				ManagedNativeHeaderVM.SizeVM,
			};
		}
Exemplo n.º 3
0
        public ImageSectionHeaderVM(HexBuffer buffer, PeSectionData section)
            : base(section.Span)
        {
            Name                   = section.Name;
            NameVM                 = new StringHexField(section.SectionName);
            VirtualSizeVM          = new UInt32HexField(section.VirtualSize);
            VirtualAddressVM       = new UInt32HexField(section.VirtualAddress);
            SizeOfRawDataVM        = new UInt32HexField(section.SizeOfRawData);
            PointerToRawDataVM     = new UInt32HexField(section.PointerToRawData);
            PointerToRelocationsVM = new UInt32HexField(section.PointerToRelocations);
            PointerToLinenumbersVM = new UInt32HexField(section.PointerToLinenumbers);
            NumberOfRelocationsVM  = new UInt16HexField(section.NumberOfRelocations);
            NumberOfLinenumbersVM  = new UInt16HexField(section.NumberOfLinenumbers);
            CharacteristicsVM      = new UInt32FlagsHexField(section.Characteristics);
            CharacteristicsVM.Add(new BooleanHexBitField("TYPE_DSECT", 0));
            CharacteristicsVM.Add(new BooleanHexBitField("TYPE_NOLOAD", 1));
            CharacteristicsVM.Add(new BooleanHexBitField("TYPE_GROUP", 2));
            CharacteristicsVM.Add(new BooleanHexBitField("TYPE_NO_PAD", 3));
            CharacteristicsVM.Add(new BooleanHexBitField("TYPE_COPY", 4));
            CharacteristicsVM.Add(new BooleanHexBitField("CNT_CODE", 5));
            CharacteristicsVM.Add(new BooleanHexBitField("CNT_INITIALIZED_DATA", 6));
            CharacteristicsVM.Add(new BooleanHexBitField("CNT_UNINITIALIZED_DATA", 7));
            CharacteristicsVM.Add(new BooleanHexBitField("LNK_OTHER", 8));
            CharacteristicsVM.Add(new BooleanHexBitField("LNK_INFO", 9));
            CharacteristicsVM.Add(new BooleanHexBitField("TYPE_OVER", 10));
            CharacteristicsVM.Add(new BooleanHexBitField("LNK_REMOVE", 11));
            CharacteristicsVM.Add(new BooleanHexBitField("LNK_COMDAT", 12));
            CharacteristicsVM.Add(new BooleanHexBitField("RESERVED", 13));
            CharacteristicsVM.Add(new BooleanHexBitField("NO_DEFER_SPEC_EXC", 14));
            CharacteristicsVM.Add(new BooleanHexBitField("GPREL", 15));
            CharacteristicsVM.Add(new BooleanHexBitField("MEM_SYSHEAP", 16));
            CharacteristicsVM.Add(new BooleanHexBitField("MEM_PURGEABLE", 17));
            CharacteristicsVM.Add(new BooleanHexBitField("MEM_LOCKED", 18));
            CharacteristicsVM.Add(new BooleanHexBitField("MEM_PRELOAD", 19));
            CharacteristicsVM.Add(new IntegerHexBitField("Alignment", 20, 4, AlignInfos));
            CharacteristicsVM.Add(new BooleanHexBitField("LNK_NRELOC_OVFL", 24));
            CharacteristicsVM.Add(new BooleanHexBitField("MEM_DISCARDABLE", 25));
            CharacteristicsVM.Add(new BooleanHexBitField("MEM_NOT_CACHED", 26));
            CharacteristicsVM.Add(new BooleanHexBitField("MEM_NOT_PAGED", 27));
            CharacteristicsVM.Add(new BooleanHexBitField("MEM_SHARED", 28));
            CharacteristicsVM.Add(new BooleanHexBitField("MEM_EXECUTE", 29));
            CharacteristicsVM.Add(new BooleanHexBitField("MEM_READ", 30));
            CharacteristicsVM.Add(new BooleanHexBitField("MEM_WRITE", 31));

            hexFields = new HexField[] {
                NameVM,
                VirtualSizeVM,
                VirtualAddressVM,
                SizeOfRawDataVM,
                PointerToRawDataVM,
                PointerToRelocationsVM,
                PointerToLinenumbersVM,
                NumberOfRelocationsVM,
                NumberOfLinenumbersVM,
                CharacteristicsVM,
            };
        }
Exemplo n.º 4
0
		public ImageSectionHeaderVM(HexBuffer buffer, HexPosition startOffset) {
			NameVM = new StringHexField(buffer, Name, "Name", startOffset + 0, Encoding.UTF8, 8);
			VirtualSizeVM = new UInt32HexField(buffer, Name, "VirtualSize", startOffset + 8);
			VirtualAddressVM = new UInt32HexField(buffer, Name, "VirtualAddress", startOffset + 0x0C);
			SizeOfRawDataVM = new UInt32HexField(buffer, Name, "SizeOfRawData", startOffset + 0x10);
			PointerToRawDataVM = new UInt32HexField(buffer, Name, "PointerToRawData", startOffset + 0x14);
			PointerToRelocationsVM = new UInt32HexField(buffer, Name, "PointerToRelocations", startOffset + 0x18);
			PointerToLinenumbersVM = new UInt32HexField(buffer, Name, "PointerToLinenumbers", startOffset + 0x1C);
			NumberOfRelocationsVM = new UInt16HexField(buffer, Name, "NumberOfRelocations", startOffset + 0x20);
			NumberOfLinenumbersVM = new UInt16HexField(buffer, Name, "NumberOfLinenumbers", startOffset + 0x22);
			CharacteristicsVM = new UInt32FlagsHexField(buffer, Name, "Characteristics", startOffset + 0x24);
			CharacteristicsVM.Add(new BooleanHexBitField("TYPE_DSECT", 0));
			CharacteristicsVM.Add(new BooleanHexBitField("TYPE_NOLOAD", 1));
			CharacteristicsVM.Add(new BooleanHexBitField("TYPE_GROUP", 2));
			CharacteristicsVM.Add(new BooleanHexBitField("TYPE_NO_PAD", 3));
			CharacteristicsVM.Add(new BooleanHexBitField("TYPE_COPY", 4));
			CharacteristicsVM.Add(new BooleanHexBitField("CNT_CODE", 5));
			CharacteristicsVM.Add(new BooleanHexBitField("CNT_INITIALIZED_DATA", 6));
			CharacteristicsVM.Add(new BooleanHexBitField("CNT_UNINITIALIZED_DATA", 7));
			CharacteristicsVM.Add(new BooleanHexBitField("LNK_OTHER", 8));
			CharacteristicsVM.Add(new BooleanHexBitField("LNK_INFO", 9));
			CharacteristicsVM.Add(new BooleanHexBitField("TYPE_OVER", 10));
			CharacteristicsVM.Add(new BooleanHexBitField("LNK_REMOVE", 11));
			CharacteristicsVM.Add(new BooleanHexBitField("LNK_COMDAT", 12));
			CharacteristicsVM.Add(new BooleanHexBitField("RESERVED", 13));
			CharacteristicsVM.Add(new BooleanHexBitField("NO_DEFER_SPEC_EXC", 14));
			CharacteristicsVM.Add(new BooleanHexBitField("GPREL", 15));
			CharacteristicsVM.Add(new BooleanHexBitField("MEM_SYSHEAP", 16));
			CharacteristicsVM.Add(new BooleanHexBitField("MEM_PURGEABLE", 17));
			CharacteristicsVM.Add(new BooleanHexBitField("MEM_LOCKED", 18));
			CharacteristicsVM.Add(new BooleanHexBitField("MEM_PRELOAD", 19));
			CharacteristicsVM.Add(new IntegerHexBitField("Alignment", 20, 4, AlignInfos));
			CharacteristicsVM.Add(new BooleanHexBitField("LNK_NRELOC_OVFL", 24));
			CharacteristicsVM.Add(new BooleanHexBitField("MEM_DISCARDABLE", 25));
			CharacteristicsVM.Add(new BooleanHexBitField("MEM_NOT_CACHED", 26));
			CharacteristicsVM.Add(new BooleanHexBitField("MEM_NOT_PAGED", 27));
			CharacteristicsVM.Add(new BooleanHexBitField("MEM_SHARED", 28));
			CharacteristicsVM.Add(new BooleanHexBitField("MEM_EXECUTE", 29));
			CharacteristicsVM.Add(new BooleanHexBitField("MEM_READ", 30));
			CharacteristicsVM.Add(new BooleanHexBitField("MEM_WRITE", 31));

			hexFields = new HexField[] {
				NameVM,
				VirtualSizeVM,
				VirtualAddressVM,
				SizeOfRawDataVM,
				PointerToRawDataVM,
				PointerToRelocationsVM,
				PointerToLinenumbersVM,
				NumberOfRelocationsVM,
				NumberOfLinenumbersVM,
				CharacteristicsVM,
			};
		}
Exemplo n.º 5
0
		protected override HexField CreateField(ColumnInfo colInfo) {
			if (colInfo.Index == 0) {
				var field = new UInt32FlagsHexField(mdVM.Buffer, Name, colInfo.Name, Span.Start + (uint)colInfo.Offset);
				field.Add(new BooleanHexBitField("ContainsNoMetaData", 0));
				return field;
			}
			return base.CreateField(colInfo);
		}
Exemplo n.º 6
0
		internal static UInt32FlagsHexField CreateAssemblyAttributesField(ColumnInfo colInfo, HexBuffer buffer, string name, HexPosition startOffset) {
			var field = new UInt32FlagsHexField(buffer, name, colInfo.Name, startOffset + (uint)colInfo.Offset);
			field.Add(new BooleanHexBitField("PublicKey", 0));
			field.Add(new IntegerHexBitField("Processor Arch", 4, 3, PAInfos));
			field.Add(new BooleanHexBitField("Processor Arch Specified", 7));
			field.Add(new BooleanHexBitField("Retargetable", 8));
			field.Add(new IntegerHexBitField("ContentType", 9, 3, ContentTypeInfos));
			field.Add(new BooleanHexBitField("DisableJITcompileOptimizer", 14));
			field.Add(new BooleanHexBitField("EnableJITcompileTracking", 15));
			return field;
		}
Exemplo n.º 7
0
		protected override HexField CreateField(ColumnInfo colInfo) {
			if (colInfo.Index == 0) {
				var field = new UInt32FlagsHexField(mdVM.Buffer, Name, colInfo.Name, Span.Start + (uint)colInfo.Offset);
				field.Add(new IntegerHexBitField("Hash Algorithm", 0, 32, HashAlgoInfos));
				return field;
			}
			else if (1 <= colInfo.Index && colInfo.Index <= 4)
				return new UInt16HexField(mdVM.Buffer, Name, colInfo.Name, Span.Start + (uint)colInfo.Offset, true);
			else if (colInfo.Index == 5)
				return CreateAssemblyAttributesField(colInfo, mdVM.Buffer, Name, Span.Start);
			return base.CreateField(colInfo);
		}
Exemplo n.º 8
0
		internal static UInt32FlagsHexField CreateTypeAttributesField(ColumnInfo colInfo, HexBuffer buffer, string name, HexPosition startOffset) {
			var field = new UInt32FlagsHexField(buffer, name, colInfo.Name, startOffset + (uint)colInfo.Offset);
			field.Add(new IntegerHexBitField("Visibility", 0, 3, VisibilityInfos));
			field.Add(new IntegerHexBitField("Layout", 3, 2, LayoutInfos));
			field.Add(new IntegerHexBitField("Semantics", 5, 1, SemanticsInfos));
			field.Add(new BooleanHexBitField("Abstract", 7));
			field.Add(new BooleanHexBitField("Sealed", 8));
			field.Add(new BooleanHexBitField("SpecialName", 10));
			field.Add(new BooleanHexBitField("RTSpecialName", 11));
			field.Add(new BooleanHexBitField("Import", 12));
			field.Add(new BooleanHexBitField("Serializable", 13));
			field.Add(new BooleanHexBitField("WindowsRuntime", 14));
			field.Add(new IntegerHexBitField("String", 16, 2, StringFormatInfos));
			field.Add(new BooleanHexBitField("HasSecurity", 18));
			field.Add(new BooleanHexBitField("BeforeFieldInit", 20));
			field.Add(new BooleanHexBitField("Forwarder", 21));
			field.Add(new IntegerHexBitField("Custom", 22, 2, CustomFormatInfos));
			return field;
		}
Exemplo n.º 9
0
		protected override HexField CreateField(ColumnInfo colInfo) {
			if (colInfo.Index == 1) {
				var field = new UInt32FlagsHexField(mdVM.Buffer, Name, colInfo.Name, Span.Start + (uint)colInfo.Offset);
				field.Add(new IntegerHexBitField("Visibility", 0, 3, VisibilityInfos));
				return field;
			}
			return base.CreateField(colInfo);
		}