public ImageSectionHeaderVM(object owner, HexDocument doc, ulong startOffset) : base(owner) { this.nameVM = new StringHexField(doc, Name, "Name", startOffset + 0, Encoding.UTF8, 8); this.virtualSizeVM = new UInt32HexField(doc, Name, "VirtualSize", startOffset + 8); this.virtualAddressVM = new UInt32HexField(doc, Name, "VirtualAddress", startOffset + 0x0C); this.sizeOfRawDataVM = new UInt32HexField(doc, Name, "SizeOfRawData", startOffset + 0x10); this.pointerToRawDataVM = new UInt32HexField(doc, Name, "PointerToRawData", startOffset + 0x14); this.pointerToRelocationsVM = new UInt32HexField(doc, Name, "PointerToRelocations", startOffset + 0x18); this.pointerToLinenumbersVM = new UInt32HexField(doc, Name, "PointerToLinenumbers", startOffset + 0x1C); this.numberOfRelocationsVM = new UInt16HexField(doc, Name, "NumberOfRelocations", startOffset + 0x20); this.numberOfLinenumbersVM = new UInt16HexField(doc, Name, "NumberOfLinenumbers", startOffset + 0x22); this.characteristicsVM = new UInt32FlagsHexField(doc, Name, "Characteristics", startOffset + 0x24); this.characteristicsVM.Add(new BooleanHexBitField("TYPE_DSECT", 0)); this.characteristicsVM.Add(new BooleanHexBitField("TYPE_NOLOAD", 1)); this.characteristicsVM.Add(new BooleanHexBitField("TYPE_GROUP", 2)); this.characteristicsVM.Add(new BooleanHexBitField("TYPE_NO_PAD", 3)); this.characteristicsVM.Add(new BooleanHexBitField("TYPE_COPY", 4)); this.characteristicsVM.Add(new BooleanHexBitField("CNT_CODE", 5)); this.characteristicsVM.Add(new BooleanHexBitField("CNT_INITIALIZED_DATA", 6)); this.characteristicsVM.Add(new BooleanHexBitField("CNT_UNINITIALIZED_DATA", 7)); this.characteristicsVM.Add(new BooleanHexBitField("LNK_OTHER", 8)); this.characteristicsVM.Add(new BooleanHexBitField("LNK_INFO", 9)); this.characteristicsVM.Add(new BooleanHexBitField("TYPE_OVER", 10)); this.characteristicsVM.Add(new BooleanHexBitField("LNK_REMOVE", 11)); this.characteristicsVM.Add(new BooleanHexBitField("LNK_COMDAT", 12)); this.characteristicsVM.Add(new BooleanHexBitField("RESERVED", 13)); this.characteristicsVM.Add(new BooleanHexBitField("NO_DEFER_SPEC_EXC", 14)); this.characteristicsVM.Add(new BooleanHexBitField("GPREL", 15)); this.characteristicsVM.Add(new BooleanHexBitField("MEM_SYSHEAP", 16)); this.characteristicsVM.Add(new BooleanHexBitField("MEM_PURGEABLE", 17)); this.characteristicsVM.Add(new BooleanHexBitField("MEM_LOCKED", 18)); this.characteristicsVM.Add(new BooleanHexBitField("MEM_PRELOAD", 19)); this.characteristicsVM.Add(new IntegerHexBitField("Alignment", 20, 4, AlignInfos)); this.characteristicsVM.Add(new BooleanHexBitField("LNK_NRELOC_OVFL", 24)); this.characteristicsVM.Add(new BooleanHexBitField("MEM_DISCARDABLE", 25)); this.characteristicsVM.Add(new BooleanHexBitField("MEM_NOT_CACHED", 26)); this.characteristicsVM.Add(new BooleanHexBitField("MEM_NOT_PAGED", 27)); this.characteristicsVM.Add(new BooleanHexBitField("MEM_SHARED", 28)); this.characteristicsVM.Add(new BooleanHexBitField("MEM_EXECUTE", 29)); this.characteristicsVM.Add(new BooleanHexBitField("MEM_READ", 30)); this.characteristicsVM.Add(new BooleanHexBitField("MEM_WRITE", 31)); this.hexFields = new HexField[] { this.nameVM, this.virtualSizeVM, this.virtualAddressVM, this.sizeOfRawDataVM, this.pointerToRawDataVM, this.pointerToRelocationsVM, this.pointerToLinenumbersVM, this.numberOfRelocationsVM, this.numberOfLinenumbersVM, this.characteristicsVM, }; }
public ImageSectionHeaderVM(object owner, HexBuffer buffer, HexPosition startOffset) : base(owner) { 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, }; }
public ImageCor20HeaderVM(object owner, HexDocument doc, ulong startOffset) : base(owner) { this.cbVM = new UInt32HexField(doc, Name, "cb", startOffset + 0); this.majorRuntimeVersionVM = new UInt16HexField(doc, Name, "MajorRuntimeVersion", startOffset + 4, true); this.minorRuntimeVersionVM = new UInt16HexField(doc, Name, "MinorRuntimeVersion", startOffset + 6, true); this.metaDataVM = new DataDirVM(doc, Name, "MetaData", startOffset + 8); this.flagsVM = new UInt32FlagsHexField(doc, Name, "Flags", startOffset + 0x10); this.flagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_IL_Only, 0)); this.flagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_32BitReqd, 1)); this.flagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_ILLibrary, 2)); this.flagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_StrongNameSigned, 3)); this.flagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_NativeEntryPoint, 4)); this.flagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_TrackDebugData, 16)); this.flagsVM.Add(new BooleanHexBitField(dnSpy_AsmEditor_Resources.HexNode_Cor20Header_Flags_32BitPref, 17)); this.entryPointTokenRVAVM = new UInt32HexField(doc, Name, "EntryPoint Token/RVA", startOffset + 0x14); this.resourcesVM = new DataDirVM(doc, Name, "Resources", startOffset + 0x18); this.strongNameSignatureVM = new DataDirVM(doc, Name, "StrongNameSignature", startOffset + 0x20); this.codeManagerTableVM = new DataDirVM(doc, Name, "CodeManagerTable", startOffset + 0x28); this.vtableFixupsVM = new DataDirVM(doc, Name, "VTableFixups", startOffset + 0x30); this.exportAddressTableJumpsVM = new DataDirVM(doc, Name, "ExportAddressTableJumps", startOffset + 0x38); this.managedNativeHeaderVM = new DataDirVM(doc, Name, "ManagedNativeHeader", startOffset + 0x40); this.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, }; }
public ImageCor20HeaderVM(object owner, HexBuffer buffer, HexPosition startOffset) : base(owner) { 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, }; }
internal static UInt32FlagsHexField CreateTypeAttributesField(ColumnInfo colInfo, HexDocument doc, string name, ulong startOffset) { var field = new UInt32FlagsHexField(doc, 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; }
protected override HexField CreateField(ColumnInfo colInfo) { if (colInfo.Index == 1) { var field = new UInt32FlagsHexField(mdVM.Document, Name, colInfo.Name, StartOffset + (uint)colInfo.Offset); field.Add(new IntegerHexBitField("Visibility", 0, 3, VisibilityInfos)); return field; } return base.CreateField(colInfo); }
protected override HexField CreateField(ColumnInfo colInfo) { if (colInfo.Index == 0) { var field = new UInt32FlagsHexField(mdVM.Document, Name, colInfo.Name, StartOffset + (uint)colInfo.Offset); field.Add(new BooleanHexBitField("ContainsNoMetaData", 0)); return field; } return base.CreateField(colInfo); }
internal static UInt32FlagsHexField CreateAssemblyAttributesField(ColumnInfo colInfo, HexDocument doc, string name, ulong startOffset) { var field = new UInt32FlagsHexField(doc, 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; }
protected override HexField CreateField(ColumnInfo colInfo) { if (colInfo.Index == 0) { var field = new UInt32FlagsHexField(mdVM.Document, Name, colInfo.Name, StartOffset + (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.Document, Name, colInfo.Name, StartOffset + (uint)colInfo.Offset, true); else if (colInfo.Index == 5) return CreateAssemblyAttributesField(colInfo, mdVM.Document, Name, StartOffset); return base.CreateField(colInfo); }