本文整理汇总了C#中IImageStream.ReadBytes方法的典型用法代码示例。如果您正苦于以下问题:C# IImageStream.ReadBytes方法的具体用法?C# IImageStream.ReadBytes怎么用?C# IImageStream.ReadBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IImageStream
的用法示例。
在下文中一共展示了IImageStream.ReadBytes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: Populate
void Populate(IImageStream reader) {
reader.Position = 1;
while (reader.Position < reader.Length) {
uint offset = (uint)reader.Position;
uint len;
if (!reader.ReadCompressedUInt32(out len)) {
if (offset == reader.Position)
reader.Position++;
continue;
}
if (len == 0 || reader.Position + len > reader.Length)
continue;
var data = reader.ReadBytes((int)len);
if (!cachedDict.ContainsKey(data))
cachedDict[data] = offset;
}
}
示例3: ImageSectionHeader
/// <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 ImageSectionHeader(IImageStream reader, bool verify) {
SetStartOffset(reader);
this.name = reader.ReadBytes(8);
this.virtualSize = reader.ReadUInt32();
this.virtualAddress = (RVA)reader.ReadUInt32();
this.sizeOfRawData = reader.ReadUInt32();
this.pointerToRawData = reader.ReadUInt32();
this.pointerToRelocations = reader.ReadUInt32();
this.pointerToLinenumbers = reader.ReadUInt32();
this.numberOfRelocations = reader.ReadUInt16();
this.numberOfLinenumbers = reader.ReadUInt16();
this.characteristics = reader.ReadUInt32();
SetEndoffset(reader);
displayName = ToString(name);
}
示例4: ReadInternal
void ReadInternal(IImageStream stream) {
stream.Position = 0;
string sig = Encoding.ASCII.GetString(stream.ReadBytes(30));
if (sig != "Microsoft C/C++ MSF 7.00\r\n\u001ADS\0")
throw new PdbException("Invalid signature");
stream.Position += 2;
uint pageSize = stream.ReadUInt32();
uint fpm = stream.ReadUInt32();
uint pageCount = stream.ReadUInt32();
uint rootSize = stream.ReadUInt32();
stream.ReadUInt32();
var numOfRootPages = RoundUpDiv(rootSize, pageSize);
var numOfPtrPages = RoundUpDiv(numOfRootPages * 4, pageSize);
if (pageCount * pageSize != stream.Length)
throw new PdbException("File size mismatch");
var pages = new IImageStream[pageCount];
try {
FileOffset offset = 0;
for (uint i = 0; i < pageCount; i++) {
pages[i] = stream.Create(offset, pageSize);
offset += pageSize;
}
var rootPages = new IImageStream[numOfRootPages];
int pageIndex = 0;
for (int i = 0; i < numOfPtrPages && pageIndex < numOfRootPages; i++) {
var ptrPage = pages[stream.ReadUInt32()];
ptrPage.Position = 0;
for (; ptrPage.Position < ptrPage.Length && pageIndex < numOfRootPages; pageIndex++)
rootPages[pageIndex] = pages[ptrPage.ReadUInt32()];
}
ReadRootDirectory(new MsfStream(rootPages, rootSize), pages, pageSize);
}
finally {
foreach (var page in pages) {
if (page != null)
page.Dispose();
}
}
ReadNames();
ReadStringTable();
var tokenMapStream = ReadModules();
documents = new Dictionary<string, DbiDocument>(StringComparer.OrdinalIgnoreCase);
foreach (var module in modules)
if (IsValidStreamIndex(module.StreamId))
module.LoadFunctions(this, streams[module.StreamId].Content);
if (IsValidStreamIndex(tokenMapStream ?? STREAM_INVALID_INDEX))
ApplyRidMap(streams[tokenMapStream.Value].Content);
functions = new Dictionary<uint, DbiFunction>();
foreach (var module in modules)
foreach (var func in module.Functions) {
functions.Add(func.Token, func);
}
}