本文整理汇总了C#中IImageStream.ReadUInt32方法的典型用法代码示例。如果您正苦于以下问题:C# IImageStream.ReadUInt32方法的具体用法?C# IImageStream.ReadUInt32怎么用?C# IImageStream.ReadUInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IImageStream
的用法示例。
在下文中一共展示了IImageStream.ReadUInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StreamHeader
/// <summary>
/// Constructor
/// </summary>
/// <param name="reader">PE file reader pointing to the start of this section</param>
/// <param name="verify">Verify section</param>
/// <exception cref="BadImageFormatException">Thrown if verification fails</exception>
public StreamHeader(IImageStream reader, bool verify) {
SetStartOffset(reader);
this.offset = reader.ReadUInt32();
this.streamSize = reader.ReadUInt32();
this.name = ReadString(reader, 32, verify);
SetEndoffset(reader);
if (verify && offset + size < offset)
throw new BadImageFormatException("Invalid stream header");
}
示例2: ImageFileHeader
/// <summary>
/// Constructor
/// </summary>
/// <param name="reader">PE file reader pointing to the start of this section</param>
/// <param name="verify">Verify section</param>
/// <exception cref="BadImageFormatException">Thrown if verification fails</exception>
public ImageFileHeader(IImageStream reader, bool verify) {
SetStartOffset(reader);
this.machine = (Machine)reader.ReadUInt16();
this.numberOfSections = reader.ReadUInt16();
this.timeDateStamp = reader.ReadUInt32();
this.pointerToSymbolTable = reader.ReadUInt32();
this.numberOfSymbols = reader.ReadUInt32();
this.sizeOfOptionalHeader = reader.ReadUInt16();
this.characteristics = (Characteristics)reader.ReadUInt16();
SetEndoffset(reader);
if (verify && this.sizeOfOptionalHeader == 0)
throw new BadImageFormatException("Invalid SizeOfOptionalHeader");
}
示例3: Read
public void Read(IImageStream stream, long recEnd) {
stream.Position += 4;
var end = stream.ReadUInt32();
stream.Position += 4;
var len = stream.ReadUInt32();
stream.Position += 8;
Token = stream.ReadUInt32();
Address = PdbAddress.ReadAddress(stream);
stream.Position += 1 + 2;
Name = PdbReader.ReadCString(stream);
stream.Position = recEnd;
Root = new DbiScope("", Address.Offset, len);
Root.Read(new RecursionCounter(), stream, end);
FixOffsets(new RecursionCounter(), Root);
}
示例4: ImageNTHeaders
/// <summary>
/// Constructor
/// </summary>
/// <param name="reader">PE file reader pointing to the start of this section</param>
/// <param name="verify">Verify section</param>
/// <exception cref="BadImageFormatException">Thrown if verification fails</exception>
public ImageNTHeaders(IImageStream reader, bool verify) {
SetStartOffset(reader);
this.signature = reader.ReadUInt32();
if (verify && this.signature != 0x4550)
throw new BadImageFormatException("Invalid NT headers signature");
this.imageFileHeader = new ImageFileHeader(reader, verify);
this.imageOptionalHeader = CreateImageOptionalHeader(reader, verify);
SetEndoffset(reader);
}
示例5: ImageDosHeader
/// <summary>
/// Constructor
/// </summary>
/// <param name="reader">PE file reader</param>
/// <param name="verify">Verify section</param>
/// <exception cref="BadImageFormatException">Thrown if verification fails</exception>
public ImageDosHeader(IImageStream reader, bool verify) {
SetStartOffset(reader);
ushort sig = reader.ReadUInt16();
if (verify && sig != 0x5A4D)
throw new BadImageFormatException("Invalid DOS signature");
reader.Position = (long)startOffset + 0x3C;
this.ntHeadersOffset = reader.ReadUInt32();
SetEndoffset(reader);
}
示例6: Read
public void Read(RecursionCounter counter, IImageStream stream, uint scopeEnd) {
if (!counter.Increment())
throw new PdbException("Scopes too deep");
while (stream.Position < scopeEnd) {
var size = stream.ReadUInt16();
var begin = stream.Position;
var end = begin + size;
var type = (SymbolType)stream.ReadUInt16();
DbiScope child = null;
uint? childEnd = null;
switch (type) {
case SymbolType.S_BLOCK32: {
stream.Position += 4;
childEnd = stream.ReadUInt32();
var len = stream.ReadUInt32();
var addr = PdbAddress.ReadAddress(stream);
var name = PdbReader.ReadCString(stream);
child = new DbiScope(name, addr.Offset, len);
break;
}
case SymbolType.S_UNAMESPACE:
Namespaces.Add(new DbiNamespace(PdbReader.ReadCString(stream)));
break;
case SymbolType.S_MANSLOT: {
var variable = new DbiVariable();
variable.Read(stream);
Variables.Add(variable);
break;
}
}
stream.Position = end;
if (child != null) {
child.Read(counter, stream, childEnd.Value);
Children.Add(child);
child = null;
}
}
counter.Decrement();
if (stream.Position != scopeEnd)
Debugger.Break();
}
示例7: Read
public void Read(IImageStream stream) {
stream.Position += 34;
StreamId = stream.ReadUInt16();
cbSyms = stream.ReadUInt32();
cbOldLines = stream.ReadUInt32();
cbLines = stream.ReadUInt32();
stream.Position += 16;
if ((int)cbSyms < 0)
cbSyms = 0;
if ((int)cbOldLines < 0)
cbOldLines = 0;
if ((int)cbLines < 0)
cbLines = 0;
ModuleName = PdbReader.ReadCString(stream);
ObjectName = PdbReader.ReadCString(stream);
stream.Position = (stream.Position + 3) & (~3);
}
示例8: Read
public void Read(IImageStream stream) {
stream.Position = 0;
Language = new Guid(stream.ReadBytes(0x10));
LanguageVendor = new Guid(stream.ReadBytes(0x10));
DocumentType = new Guid(stream.ReadBytes(0x10));
CheckSumAlgorithmId = new Guid(stream.ReadBytes(0x10));
var len = stream.ReadInt32();
if (stream.ReadUInt32() != 0)
throw new PdbException("Unexpected value");
CheckSum = stream.ReadBytes(len);
}
示例9: ReadFunctions
void ReadFunctions(IImageStream stream) {
if (stream.ReadUInt32() != 4)
throw new PdbException("Invalid signature");
while (stream.Position < stream.Length) {
var size = stream.ReadUInt16();
var begin = stream.Position;
var end = begin + size;
var type = (SymbolType)stream.ReadUInt16();
switch (type) {
case SymbolType.S_GMANPROC:
case SymbolType.S_LMANPROC:
var func = new DbiFunction();
func.Read(stream, end);
Functions.Add(func);
break;
default:
stream.Position = end;
break;
}
}
}
示例10: ReadGlobalSymbols
void ReadGlobalSymbols(IImageStream stream) {
stream.Position = 0;
while (stream.Position < stream.Length) {
var size = stream.ReadUInt16();
var begin = stream.Position;
var end = begin + size;
if ((SymbolType)stream.ReadUInt16() == SymbolType.S_PUB32) {
stream.Position += 4;
var offset = stream.ReadUInt32();
stream.Position += 2;
var name = ReadCString(stream);
if (name == "COM+_Entry_Point")
entryPt = offset;
}
stream.Position = end;
}
}
示例11: ImageDataDirectory
/// <summary>
/// Constructor
/// </summary>
/// <param name="reader">PE file reader pointing to the start of this section</param>
/// <param name="verify">Verify section</param>
/// <exception cref="BadImageFormatException">Thrown if verification fails</exception>
public ImageDataDirectory(IImageStream reader, bool verify) {
SetStartOffset(reader);
this.virtualAddress = (RVA)reader.ReadUInt32();
this.dataSize = reader.ReadUInt32();
SetEndoffset(reader);
}
示例12: ImageOptionalHeader32
/// <summary>
/// Constructor
/// </summary>
/// <param name="reader">PE file reader pointing to the start of this section</param>
/// <param name="totalSize">Total size of this optional header (from the file header)</param>
/// <param name="verify">Verify section</param>
/// <exception cref="BadImageFormatException">Thrown if verification fails</exception>
public ImageOptionalHeader32(IImageStream reader, uint totalSize, bool verify) {
if (totalSize < 0x60)
throw new BadImageFormatException("Invalid optional header size");
if (verify && reader.Position + totalSize > reader.Length)
throw new BadImageFormatException("Invalid optional header size");
SetStartOffset(reader);
this.magic = reader.ReadUInt16();
this.majorLinkerVersion = reader.ReadByte();
this.minorLinkerVersion = reader.ReadByte();
this.sizeOfCode = reader.ReadUInt32();
this.sizeOfInitializedData = reader.ReadUInt32();
this.sizeOfUninitializedData = reader.ReadUInt32();
this.addressOfEntryPoint = (RVA)reader.ReadUInt32();
this.baseOfCode = (RVA)reader.ReadUInt32();
this.baseOfData = (RVA)reader.ReadUInt32();
this.imageBase = reader.ReadUInt32();
this.sectionAlignment = reader.ReadUInt32();
this.fileAlignment = reader.ReadUInt32();
this.majorOperatingSystemVersion = reader.ReadUInt16();
this.minorOperatingSystemVersion = reader.ReadUInt16();
this.majorImageVersion = reader.ReadUInt16();
this.minorImageVersion = reader.ReadUInt16();
this.majorSubsystemVersion = reader.ReadUInt16();
this.minorSubsystemVersion = reader.ReadUInt16();
this.win32VersionValue = reader.ReadUInt32();
this.sizeOfImage = reader.ReadUInt32();
this.sizeOfHeaders = reader.ReadUInt32();
this.checkSum = reader.ReadUInt32();
this.subsystem = (Subsystem)reader.ReadUInt16();
this.dllCharacteristics = (DllCharacteristics)reader.ReadUInt16();
this.sizeOfStackReserve = reader.ReadUInt32();
this.sizeOfStackCommit = reader.ReadUInt32();
this.sizeOfHeapReserve = reader.ReadUInt32();
this.sizeOfHeapCommit = reader.ReadUInt32();
this.loaderFlags = reader.ReadUInt32();
this.numberOfRvaAndSizes = reader.ReadUInt32();
for (int i = 0; i < dataDirectories.Length; i++) {
uint len = (uint)(reader.Position - startOffset);
if (len + 8 <= totalSize)
dataDirectories[i] = new ImageDataDirectory(reader, verify);
else
dataDirectories[i] = new ImageDataDirectory();
}
reader.Position = (long)startOffset + totalSize;
SetEndoffset(reader);
}
示例13: ReadHotHeapDirectory
/// <inheritdoc/>
protected override void ReadHotHeapDirectory(IImageStream reader, long dirBaseOffs, out HeapType heapType, out long hotHeapOffs) {
heapType = (HeapType)reader.ReadUInt32();
// All bits are used
hotHeapOffs = dirBaseOffs - reader.ReadUInt32();
}
示例14: Read
public void Read(IImageStream stream) {
Addr1 = stream.ReadUInt32();
stream.Position += 10;
Flags = stream.ReadUInt16();
Name = PdbReader.ReadCString(stream);
}
示例15: ReadLines
void ReadLines(PdbReader reader, IImageStream stream)
{
var docs = new Dictionary<long, DbiDocument>();
stream.Position = 0;
while (stream.Position < stream.Length) {
var sig = (ModuleStreamType)stream.ReadUInt32();
var size = stream.ReadUInt32();
var begin = stream.Position;
var end = (begin + size + 3) & ~3;
if (sig == ModuleStreamType.FileInfo)
ReadFiles(reader, docs, stream, end);
stream.Position = end;
}
var sortedFuncs = new DbiFunction[Functions.Count];
Functions.CopyTo(sortedFuncs, 0);
Array.Sort(sortedFuncs, (a, b) => a.Address.CompareTo(b.Address));
stream.Position = 0;
while (stream.Position < stream.Length) {
var sig = (ModuleStreamType)stream.ReadUInt32();
var size = stream.ReadUInt32();
var begin = stream.Position;
var end = begin + size;
if (sig == ModuleStreamType.Lines)
ReadLines(sortedFuncs, docs, stream, end);
stream.Position = end;
}
}