本文整理汇总了C#中IPEImage.ToRVA方法的典型用法代码示例。如果您正苦于以下问题:C# IPEImage.ToRVA方法的具体用法?C# IPEImage.ToRVA怎么用?C# IPEImage.ToRVA使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPEImage
的用法示例。
在下文中一共展示了IPEImage.ToRVA方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
/// <summary>
/// Initializes MD tables
/// </summary>
/// <param name="peImage">The PEImage</param>
public void Initialize(IPEImage peImage) {
if (initialized)
throw new Exception("Initialize() has already been called");
initialized = true;
reserved1 = imageStream.ReadUInt32();
majorVersion = imageStream.ReadByte();
minorVersion = imageStream.ReadByte();
flags = (MDStreamFlags)imageStream.ReadByte();
log2Rid = imageStream.ReadByte();
validMask = imageStream.ReadUInt64();
sortedMask = imageStream.ReadUInt64();
int maxPresentTables;
var dnTableSizes = new DotNetTableSizes();
var tableInfos = dnTableSizes.CreateTables(majorVersion, minorVersion, out maxPresentTables);
mdTables = new MDTable[tableInfos.Length];
ulong valid = validMask;
var sizes = new uint[64];
for (int i = 0; i < 64; valid >>= 1, i++) {
uint rows = (valid & 1) == 0 ? 0 : imageStream.ReadUInt32();
if (i >= maxPresentTables)
rows = 0;
sizes[i] = rows;
if (i < mdTables.Length)
mdTables[i] = new MDTable((Table)i, rows, tableInfos[i]);
}
if (HasExtraData)
extraData = imageStream.ReadUInt32();
dnTableSizes.InitializeSizes(HasBigStrings, HasBigGUID, HasBigBlob, sizes);
var currentRva = peImage.ToRVA(imageStream.FileOffset) + (uint)imageStream.Position;
foreach (var mdTable in mdTables) {
var dataLen = (long)mdTable.TableInfo.RowSize * (long)mdTable.Rows;
mdTable.ImageStream = peImage.CreateStream(currentRva, dataLen);
var newRva = currentRva + (uint)dataLen;
if (newRva < currentRva)
throw new BadImageFormatException("Too big MD table");
currentRva = newRva;
}
InitializeTables();
}