public static ImageCor20HeaderTreeNode Create(HexDocument doc, IPEImage peImage)
 {
     var dnDir = peImage.ImageNTHeaders.OptionalHeader.DataDirectories[14];
     if (dnDir.VirtualAddress != 0 && dnDir.Size >= 0x48)
         return new ImageCor20HeaderTreeNode(doc, (ulong)peImage.ToFileOffset(dnDir.VirtualAddress));
     return null;
 }
Esempio n. 2
0
		protected HexField(HexDocument doc, string parentName, string name, ulong start, int size) {
			this.doc = doc;
			this.parentName = parentName;
			this.name = name;
			this.startOffset = start;
			this.endOffset = start + (ulong)size - 1;
		}
Esempio n. 3
0
		public static void AddAndExecute(HexDocument doc, ulong offset, byte[] data, string descr = null) {
			if (doc == null)
				throw new ArgumentNullException();
			if (data == null || data.Length == 0)
				return;
			UndoCommandManager.Instance.Add(new WriteHexUndoCommand(doc, offset, data, descr));
		}
Esempio n. 4
0
		WriteHexUndoCommand(HexDocument doc, ulong offset, byte[] data, string descr) {
			this.doc = doc;
			this.offset = offset;
			this.newData = (byte[])data.Clone();
			this.origData = this.doc.ReadBytes(offset, data.Length);
			this.descr = descr;
		}
Esempio n. 5
0
 WriteHexUndoCommand(string filename, ulong offset, byte[] data, string descr)
 {
     this.doc = HexDocumentManager.Instance.GetOrCreate(filename);
     this.offset = offset;
     this.newData = (byte[])data.Clone();
     this.origData = this.doc.Read(offset, data.Length);
     this.descr = descr;
 }
Esempio n. 6
0
		public TablesStreamTreeNode(HexDocument doc, TablesStream tblStream, IMetaData md)
			: base((ulong)tblStream.StartOffset, (ulong)tblStream.MDTables[0].StartOffset - 1) {
			this.tablesStreamVM = new TablesStreamVM(this, doc, tblStream);

			foreach (var mdTable in tblStream.MDTables) {
				if (mdTable.Rows != 0)
					this.Children.Add(new MetaDataTableTreeNode(doc, mdTable, md));
			}
		}
Esempio n. 7
0
		public MetaDataTableTreeNode(HexDocument doc, MDTable mdTable, IMetaData md)
			: base((ulong)mdTable.StartOffset, (ulong)mdTable.EndOffset - 1) {
			LazyLoading = true;
			this.doc = doc;
			this.tableInfo = mdTable.TableInfo;
			this.tablesStreamVM = MetaDataTableVM.Create(this, doc, StartOffset, mdTable);
			this.tablesStreamVM.FindMetaDataTable = FindMetaDataTable;
			this.tablesStreamVM.InitializeHeapOffsets((ulong)md.StringsStream.StartOffset, (ulong)md.StringsStream.EndOffset - 1);
		}
Esempio n. 8
0
		public StorageStreamTreeNode(HexDocument doc, StreamHeader sh, int streamNumber, DotNetStream knownStream, IMetaData md)
			: base((ulong)sh.StartOffset, (ulong)sh.EndOffset - 1) {
			this.streamNumber = streamNumber;
			this.storageStreamType = GetStorageStreamType(knownStream);
			this.storageStreamVM = new StorageStreamVM(this, doc, StartOffset, (int)(EndOffset - StartOffset + 1 - 8));

			var tblStream = knownStream as TablesStream;
			if (tblStream != null)
				this.Children.Add(new TablesStreamTreeNode(doc, tblStream, md));
		}
Esempio n. 9
0
        public ImageSectionHeaderVM(HexDocument doc, ulong startOffset)
        {
            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,
            };
        }
Esempio n. 10
0
        public TablesStreamVM(HexDocument doc, TablesStream tblStream)
        {
            ulong startOffset = (ulong)tblStream.StartOffset;
            this.m_ulReservedVM = new UInt32HexField(doc, Name, "m_ulReserved", startOffset + 0);
            this.m_majorVM = new ByteHexField(doc, Name, "m_major", startOffset + 4, true);
            this.m_minorVM = new ByteHexField(doc, Name, "m_minor", startOffset + 5, true);
            this.m_heapsVM = new ByteFlagsHexField(doc, Name, "m_heaps", startOffset + 6);
            this.m_heapsVM.Add(new BooleanHexBitField("BigStrings", 0));
            this.m_heapsVM.Add(new BooleanHexBitField("BigGUID", 1));
            this.m_heapsVM.Add(new BooleanHexBitField("BigBlob", 2));
            this.m_heapsVM.Add(new BooleanHexBitField("Padding", 3));
            this.m_heapsVM.Add(new BooleanHexBitField("Reserved", 4));
            this.m_heapsVM.Add(new BooleanHexBitField("DeltaOnly", 5));
            this.m_heapsVM.Add(new BooleanHexBitField("ExtraData", 6));
            this.m_heapsVM.Add(new BooleanHexBitField("HasDelete", 7));
            this.m_ridVM = new ByteHexField(doc, Name, "m_rid", startOffset + 7);
            this.m_maskvalidVM = new UInt64FlagsHexField(doc, Name, "m_maskvalid", startOffset + 8);
            AddTableFlags(this.m_maskvalidVM);
            this.m_sortedVM = new UInt64FlagsHexField(doc, Name, "m_sorted", startOffset + 0x10);
            AddTableFlags(this.m_sortedVM);

            var list = new List<HexField> {
                m_ulReservedVM,
                m_majorVM,
                m_minorVM,
                m_heapsVM,
                m_ridVM,
                m_maskvalidVM,
                m_sortedVM,
            };

            this.rowsVM = new UInt32HexField[64];
            ulong valid = tblStream.ValidMask;
            ulong offs = startOffset + 0x18;
            for (int i = 0; i < this.rowsVM.Length; i++) {
                this.rowsVM[i] = new UInt32HexField(doc, Name, string.Format("rows[{0:X2}]", i), offs);
                if ((valid & 1) != 0) {
                    list.Add(this.rowsVM[i]);
                    offs += 4;
                }
                else
                    this.rowsVM[i].IsVisible = false;

                valid >>= 1;
            }

            this.m_ulExtraVM = new UInt32HexField(doc, Name, "m_ulExtra", offs);
            this.m_ulExtraVM.IsVisible = tblStream.HasExtraData;
            if (tblStream.HasExtraData)
                list.Add(this.m_ulExtraVM);

            Debug.Assert(offs == (ulong)tblStream.MDTables[0].StartOffset);

            this.hexFields = list.ToArray();
        }
Esempio n. 11
0
		public HexBoxUndoCommand(HexBox hexBox, HexBoxPosition origCaretPos, ulong offset, byte[] origData, string descr) {
			this.doc = hexBox.Document;
			this.hexBoxWeakRef = new WeakReference(hexBox);
			this.origCaretPos = origCaretPos;
			this.newCaretPos = hexBox.CaretPosition;
			this.offset = offset;
			this.origData = origData;
			this.newData = doc.ReadBytes(offset, origData.Length);
			this.descr = descr;
			this.canExecute = false;
		}
Esempio n. 12
0
        public StorageStreamVM(HexDocument doc, ulong startOffset, int stringLen)
        {
            this.iOffsetVM = new UInt32HexField(doc, Name, "iOffset", startOffset + 0);
            this.iSizeVM = new UInt32HexField(doc, Name, "iSize", startOffset + 4);
            this.rcNameVM = new StringHexField(doc, Name, "rcName", startOffset + 8, Encoding.ASCII, stringLen);

            this.hexFields = new HexField[] {
                iOffsetVM,
                iSizeVM,
                rcNameVM,
            };
        }
Esempio n. 13
0
		public StorageHeaderVM(object owner, HexDocument doc, ulong startOffset)
			: base(owner) {
			this.fFlagsVM = new ByteFlagsHexField(doc, Name, "fFlags", startOffset + 0);
			this.fFlagsVM.Add(new BooleanHexBitField("ExtraData", 0));
			this.padVM = new ByteHexField(doc, Name, "pad", startOffset + 1);
			this.iStreamsVM = new UInt16HexField(doc, Name, "iStreams", startOffset + 2);

			this.hexFields = new HexField[] {
				fFlagsVM,
				padVM,
				iStreamsVM,
			};
		}
Esempio n. 14
0
        public ImageOptionalHeader32VM(HexDocument doc, ulong startOffset, ulong endOffset)
            : base(doc, startOffset, endOffset, 0x20, 0x58)
        {
            this.baseOfDataVM = new UInt32HexField(doc, Name, "BaseOfData", startOffset + 0x18);
            this.imageBaseVM = new UInt32HexField(doc, Name, "ImageBase", startOffset + 0x1C);

            this.sizeOfStackReserveVM = new UInt32HexField(doc, Name, "SizeOfStackReserve", startOffset + 0x48);
            this.sizeOfStackCommitVM = new UInt32HexField(doc, Name, "SizeOfStackCommit", startOffset + 0x4C);
            this.sizeOfHeapReserveVM = new UInt32HexField(doc, Name, "SizeOfHeapReserve", startOffset + 0x50);
            this.sizeOfHeapCommitVM = new UInt32HexField(doc, Name, "SizeOfHeapCommit", startOffset + 0x54);

            var list = new List<HexField> {
                MagicVM,
                MajorLinkerVersionVM,
                MinorLinkerVersionVM,
                SizeOfCodeVM,
                SizeOfInitializedDataVM,
                SizeOfUninitializedDataVM,
                AddressOfEntryPointVM,
                BaseOfCodeVM,
                BaseOfDataVM,
                ImageBaseVM,
                SectionAlignmentVM,
                FileAlignmentVM,
                MajorOperatingSystemVersionVM,
                MinorOperatingSystemVersionVM,
                MajorImageVersionVM,
                MinorImageVersionVM,
                MajorSubsystemVersionVM,
                MinorSubsystemVersionVM,
                Win32VersionValueVM,
                SizeOfImageVM,
                SizeOfHeadersVM,
                CheckSumVM,
                SubsystemVM,
                DllCharacteristicsVM,
                SizeOfStackReserveVM,
                SizeOfStackCommitVM,
                SizeOfHeapReserveVM,
                SizeOfHeapCommitVM,
                LoaderFlagsVM,
                NumberOfRvaAndSizesVM,
            };

            AddDataDirs(list, endOffset);
        }
Esempio n. 15
0
		public StorageSignatureVM(object owner, HexDocument doc, ulong startOffset, int stringLen)
			: base(owner) {
			this.lSignatureVM = new UInt32HexField(doc, Name, "lSignature", startOffset + 0);
			this.iMajorVerVM = new UInt16HexField(doc, Name, "iMajorVer", startOffset + 4, true);
			this.iMinorVerVM = new UInt16HexField(doc, Name, "iMinorVer", startOffset + 6, true);
			this.iExtraDataVM = new UInt32HexField(doc, Name, "iExtraData", startOffset + 8);
			this.iVersionStringVM = new UInt32HexField(doc, Name, "iVersionString", startOffset + 0x0C);
			this.versionStringVM = new StringHexField(doc, Name, "VersionString", startOffset + 0x10, Encoding.UTF8, stringLen);

			this.hexFields = new HexField[] {
				lSignatureVM,
				iMajorVerVM,
				iMinorVerVM,
				iExtraDataVM,
				iVersionStringVM,
				versionStringVM,
			};
		}
Esempio n. 16
0
        public ImageCor20HeaderVM(HexDocument doc, ulong startOffset)
        {
            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("IL Only", 0));
            this.flagsVM.Add(new BooleanHexBitField("32-Bit Required", 1));
            this.flagsVM.Add(new BooleanHexBitField("IL Library", 2));
            this.flagsVM.Add(new BooleanHexBitField("Strong Name Signed", 3));
            this.flagsVM.Add(new BooleanHexBitField("Native EntryPoint", 4));
            this.flagsVM.Add(new BooleanHexBitField("Track Debug Data", 16));
            this.flagsVM.Add(new BooleanHexBitField("32-Bit Preferred", 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,
            };
        }
Esempio n. 17
0
        public ImageFileHeaderVM(object owner, HexDocument doc, ulong startOffset)
            : base(owner)
        {
            this.machineVM = new UInt16FlagsHexField(doc, Name, "Machine", startOffset + 0);
            this.machineVM.Add(new IntegerHexBitField("Machine", 0, 16, MachineInfos));
            this.numberOfSectionsVM = new UInt16HexField(doc, Name, "NumberOfSections", startOffset + 2);
            this.timeDateStampVM = new UInt32HexField(doc, Name, "TimeDateStamp", startOffset + 4);
            this.pointerToSymbolTableVM = new UInt32HexField(doc, Name, "PointerToSymbolTable", startOffset + 8);
            this.numberOfSymbolsVM = new UInt32HexField(doc, Name, "NumberOfSymbols", startOffset + 0x0C);
            this.sizeOfOptionalHeaderVM = new UInt16HexField(doc, Name, "SizeOfOptionalHeader", startOffset + 0x10);
            this.characteristicsVM = new UInt16FlagsHexField(doc, Name, "Characteristics", startOffset + 0x12);
            this.characteristicsVM.Add(new BooleanHexBitField("Relocs Stripped", 0));
            this.characteristicsVM.Add(new BooleanHexBitField("Executable Image", 1));
            this.characteristicsVM.Add(new BooleanHexBitField("Line Nums Stripped", 2));
            this.characteristicsVM.Add(new BooleanHexBitField("Local Syms Stripped", 3));
            this.characteristicsVM.Add(new BooleanHexBitField("Aggressive WS Trim", 4));
            this.characteristicsVM.Add(new BooleanHexBitField("Large Address Aware", 5));
            this.characteristicsVM.Add(new BooleanHexBitField("Reserved 0040h", 6));
            this.characteristicsVM.Add(new BooleanHexBitField("Bytes Reversed Lo", 7));
            this.characteristicsVM.Add(new BooleanHexBitField("32-Bit Machine", 8));
            this.characteristicsVM.Add(new BooleanHexBitField("Debug Stripped", 9));
            this.characteristicsVM.Add(new BooleanHexBitField("Removable Run From Swap", 10));
            this.characteristicsVM.Add(new BooleanHexBitField("Net Run From Swap", 11));
            this.characteristicsVM.Add(new BooleanHexBitField("System", 12));
            this.characteristicsVM.Add(new BooleanHexBitField("Dll", 13));
            this.characteristicsVM.Add(new BooleanHexBitField("Up System Only", 14));
            this.characteristicsVM.Add(new BooleanHexBitField("Bytes Reversed Hi", 15));

            this.hexFields = new HexField[] {
                machineVM,
                numberOfSectionsVM,
                timeDateStampVM,
                pointerToSymbolTableVM,
                numberOfSymbolsVM,
                sizeOfOptionalHeaderVM,
                characteristicsVM,
            };
        }
Esempio n. 18
0
 public ImageDosHeaderTreeNode(HexDocument doc, ImageDosHeader dosHeader)
     : base((ulong)dosHeader.StartOffset, (ulong)dosHeader.EndOffset - 1)
 {
     this.imageDosHeaderVM = new ImageDosHeaderVM(doc, StartOffset);
 }
Esempio n. 19
0
		public StorageHeaderTreeNode(HexDocument doc, MetaDataHeader mdHeader)
			: base((ulong)mdHeader.StorageHeaderOffset, (ulong)mdHeader.StorageHeaderOffset + 4 - 1) {
			this.storageHeaderVM = new StorageHeaderVM(this, doc, StartOffset);
		}
Esempio n. 20
0
 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;
 }
Esempio n. 21
0
 internal static UInt16FlagsHexField CreateGenericParamAttributesField(ColumnInfo colInfo, HexDocument doc, string name, ulong startOffset)
 {
     var field = new UInt16FlagsHexField(doc, name, colInfo.Name, startOffset + (uint)colInfo.Offset);
     field.Add(new IntegerHexBitField("Variance", 0, 2, VarianceInfos));
     field.Add(new BooleanHexBitField("Reference", 2));
     field.Add(new BooleanHexBitField("Struct", 3));
     field.Add(new BooleanHexBitField("Default ctor", 4));
     return field;
 }
Esempio n. 22
0
 public Int16FlagsHexField(HexDocument doc, string parentName, string name, ulong start)
     : base(doc, parentName, name, start, 2)
 {
     this.data = new Int16VM(doc.ReadInt16(start), a => UpdateValue(), false);
 }
Esempio n. 23
0
		uint ReadFieldValue(HexDocument doc, ColumnInfo col) {
			ulong start = StartOffset + (ulong)col.Offset;
			if (col.Size == 2)
				return doc.ReadUInt16(start);
			else if (col.Size == 4)
				return doc.ReadUInt32(start);
			throw new InvalidOperationException();
		}
Esempio n. 24
0
 public ByteHexField(HexDocument doc, string parentName, string name, ulong start, bool useDecimal = false)
     : base(doc, parentName, name, start, 1)
 {
     this.data = new ByteVM((byte)doc.ReadByte(start), a => UpdateValue(), useDecimal);
 }
Esempio n. 25
0
 public DataDirVM(HexDocument doc, string parentName, string name, ulong start)
 {
     this.name = name;
     this.rvaVM = new UInt32HexField(doc, parentName, string.Format("{0} RVA", name), start);
     this.sizeVM = new UInt32HexField(doc, parentName, string.Format("{0} Size", name), start + 4);
 }
Esempio n. 26
0
 public Int16HexField(HexDocument doc, string parentName, string name, ulong start, bool useDecimal = false)
     : base(doc, parentName, name, start, 2)
 {
     this.data = new Int16VM(doc.ReadInt16(start), a => UpdateValue(), useDecimal);
 }
Esempio n. 27
0
 public ImageCor20HeaderTreeNode(HexDocument doc, ulong startOffset)
     : base(startOffset, startOffset + 0x48 - 1)
 {
     this.imageCor20HeaderVM = new ImageCor20HeaderVM(doc, StartOffset);
 }
Esempio n. 28
0
 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;
 }
Esempio n. 29
0
		public ImageDosHeaderVM(object owner, HexDocument doc, ulong startOffset)
			: base(owner) {
			this.magicVM = new UInt16HexField(doc, Name, "e_magic", startOffset + 0);
			this.cblpVM = new UInt16HexField(doc, Name, "e_cblp", startOffset + 2);
			this.cpVM = new UInt16HexField(doc, Name, "e_cp", startOffset + 4);
			this.crlcVM = new UInt16HexField(doc, Name, "e_crlc", startOffset + 6);
			this.cparhdrVM = new UInt16HexField(doc, Name, "e_cparhdr", startOffset + 8);
			this.minallocVM = new UInt16HexField(doc, Name, "e_minalloc", startOffset + 0x0A);
			this.maxallocVM = new UInt16HexField(doc, Name, "e_maxalloc", startOffset + 0x0C);
			this.ssVM = new UInt16HexField(doc, Name, "e_ss", startOffset + 0x0E);
			this.spVM = new UInt16HexField(doc, Name, "e_sp", startOffset + 0x10);
			this.csumVM = new UInt16HexField(doc, Name, "e_csum", startOffset + 0x12);
			this.ipVM = new UInt16HexField(doc, Name, "e_ip", startOffset + 0x14);
			this.csVM = new UInt16HexField(doc, Name, "e_cs", startOffset + 0x16);
			this.lfarlcVM = new UInt16HexField(doc, Name, "e_lfarlc", startOffset + 0x18);
			this.ovnoVM = new UInt16HexField(doc, Name, "e_ovno", startOffset + 0x1A);
			this.res_0VM = new UInt16HexField(doc, Name, "e_res[0]", startOffset + 0x1C);
			this.res_1VM = new UInt16HexField(doc, Name, "e_res[1]", startOffset + 0x1E);
			this.res_2VM = new UInt16HexField(doc, Name, "e_res[2]", startOffset + 0x20);
			this.res_3VM = new UInt16HexField(doc, Name, "e_res[3]", startOffset + 0x22);
			this.oemidVM = new UInt16HexField(doc, Name, "e_oemid", startOffset + 0x24);
			this.oeminfoVM = new UInt16HexField(doc, Name, "e_oeminfo", startOffset + 0x26);
			this.res2_0VM = new UInt16HexField(doc, Name, "e_res2[0]", startOffset + 0x28);
			this.res2_1VM = new UInt16HexField(doc, Name, "e_res2[1]", startOffset + 0x2A);
			this.res2_2VM = new UInt16HexField(doc, Name, "e_res2[2]", startOffset + 0x2C);
			this.res2_3VM = new UInt16HexField(doc, Name, "e_res2[3]", startOffset + 0x2E);
			this.res2_4VM = new UInt16HexField(doc, Name, "e_res2[4]", startOffset + 0x30);
			this.res2_5VM = new UInt16HexField(doc, Name, "e_res2[5]", startOffset + 0x32);
			this.res2_6VM = new UInt16HexField(doc, Name, "e_res2[6]", startOffset + 0x34);
			this.res2_7VM = new UInt16HexField(doc, Name, "e_res2[7]", startOffset + 0x36);
			this.res2_8VM = new UInt16HexField(doc, Name, "e_res2[8]", startOffset + 0x38);
			this.res2_9VM = new UInt16HexField(doc, Name, "e_res2[9]", startOffset + 0x3A);
			this.lfanewVM = new Int32HexField(doc, Name, "e_lfanew", startOffset + 0x3C);

			this.hexFields = new HexField[] {
				magicVM,
				cblpVM,
				cpVM,
				crlcVM,
				cparhdrVM,
				minallocVM,
				maxallocVM,
				ssVM,
				spVM,
				csumVM,
				ipVM,
				csVM,
				lfarlcVM,
				ovnoVM,
				res_0VM,
				res_1VM,
				res_2VM,
				res_3VM,
				oemidVM,
				oeminfoVM,
				res2_0VM,
				res2_1VM,
				res2_2VM,
				res2_3VM,
				res2_4VM,
				res2_5VM,
				res2_6VM,
				res2_7VM,
				res2_8VM,
				res2_9VM,
				lfanewVM,
			};
		}
Esempio n. 30
0
 protected FlagsHexField(HexDocument doc, string parentName, string name, ulong start, int size)
     : base(doc, parentName, name, start, size)
 {
     this.bitFields = new Dictionary<int, HexBitField>();
 }