本文整理汇总了C#中dnSpy.HexEditor.HexDocument类的典型用法代码示例。如果您正苦于以下问题:C# HexDocument类的具体用法?C# HexDocument怎么用?C# HexDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HexDocument类属于dnSpy.HexEditor命名空间,在下文中一共展示了HexDocument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
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;
}
示例2: HexField
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;
}
示例3: AddAndExecute
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));
}
示例4: WriteHexUndoCommand
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;
}
示例5: WriteHexUndoCommand
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;
}
示例6: TablesStreamTreeNode
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));
}
}
示例7: MetaDataTableTreeNode
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);
}
示例8: StorageStreamTreeNode
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));
}
示例9: ImageSectionHeaderVM
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,
};
}
示例10: TablesStreamVM
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();
}
示例11: StorageStreamVM
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,
};
}
示例12: StorageHeaderVM
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,
};
}
示例13: ImageOptionalHeader32VM
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);
}
示例14: StorageSignatureVM
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,
};
}
示例15: ImageCor20HeaderVM
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,
};
}