本文整理汇总了C#中Section.MapView方法的典型用法代码示例。如果您正苦于以下问题:C# Section.MapView方法的具体用法?C# Section.MapView怎么用?C# Section.MapView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section.MapView方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapAndLoad
private void MapAndLoad(FileHandle fileHandle, bool readOnly)
{
using (Section section = new Section(
fileHandle,
false,
readOnly ? MemoryProtection.ExecuteRead : MemoryProtection.ExecuteReadWrite
))
{
_size = (int)fileHandle.GetSize();
_view = section.MapView(_size);
_memory = _view;
byte* start = (byte*)_memory;
if (start[0] != 'M' || start[1] != 'Z')
throw new Exception("The file is not a valid executable image.");
_ntHeaders = this.GetNtHeaders();
_sections = (ImageSectionHeader*)((byte*)&_ntHeaders->OptionalHeader + _ntHeaders->FileHeader.SizeOfOptionalHeader);
_magic = _ntHeaders->OptionalHeader.Magic;
if (_magic != Win32.Pe32Magic && _magic != Win32.Pe32PlusMagic)
throw new Exception("The file is not a PE32 or PE32+ image.");
}
}
示例2: MapAndLoad
private void MapAndLoad(FileHandle fileHandle, bool readOnly)
{
using (Section section = new Section(
fileHandle,
false,
readOnly ? MemoryProtection.ExecuteRead : MemoryProtection.ExecuteReadWrite
))
{
_size = (int)fileHandle.FileSize;
_view = section.MapView(_size);
this.Load(_view);
}
}