Class AddressTableInitializerStub
- Namespace
- AsmResolver.PE.Platforms
- Assembly
- AsmResolver.PE.dll
Represents a stub of code that initializes slots in a trampolined address table.
public abstract class AddressTableInitializerStub : ISegment, IOffsetProvider, IWritable
- Inheritance
-
AddressTableInitializerStub
- Implements
- Inherited Members
Constructors
AddressTableInitializerStub(ISegment, ISegment, RelocatableSegment)
Initializes an address table initialization stub with the provided code.
protected AddressTableInitializerStub(ISegment prologue, ISegment epilogue, RelocatableSegment slotInitializer)
Parameters
prologue
ISegmentThe prologue of the initializer code.
epilogue
ISegmentThe epilogue of the initializer code.
slotInitializer
RelocatableSegmentThe implementation of a function that initializes one slot in a table.
Properties
Body
Gets the raw body (excluding prologue and epilogue) of the initializer stub.
protected RelocatableSegmentBuilder Body { get; }
Property Value
CanUpdateOffsets
Determines whether this structure can be relocated to another offset or virtual address.
public bool CanUpdateOffsets { get; }
Property Value
EntryPoint
Gets the entry point symbol of the address table initializer.
public ISymbol EntryPoint { get; }
Property Value
Offset
Gets the physical starting offset of the segment.
public ulong Offset { get; }
Property Value
Rva
Gets the virtual address relative to the beginning of the section that the segment is located in.
public uint Rva { get; }
Property Value
SlotInitializer
Gets the symbol pointing to the function that initializes a single slot in the table.
protected ISymbol SlotInitializer { get; }
Property Value
Remarks
This is a function that expects two pointer-sized parameters (original slot address and value), passed in using
the __stdcall
calling convention of the underlying ABI.
Methods
AddInitializer(ISymbol, ISymbol)
Adds code a single address slot initializer to the stub.
public abstract void AddInitializer(ISymbol originalSlot, ISymbol newSlot)
Parameters
originalSlot
ISymbolThe original slot to initialize.
newSlot
ISymbolThe new slot to redirect the original slot to.
GetPhysicalSize()
Computes the number of bytes that the structure contains.
public uint GetPhysicalSize()
Returns
- uint
The number of bytes.
GetRequiredBaseRelocations()
Collects all required base relocations when adding the initializer stub to a PE image.
public IEnumerable<BaseRelocation> GetRequiredBaseRelocations()
Returns
- IEnumerable<BaseRelocation>
The required base relocations.
GetVirtualSize()
Computes the number of bytes the segment will contain when it is mapped into memory.
public uint GetVirtualSize()
Returns
- uint
The number of bytes.
UpdateOffsets(in RelocationParameters)
Assigns a new file and virtual offset to the segment and all its sub-components.
public void UpdateOffsets(in RelocationParameters parameters)
Parameters
parameters
RelocationParametersThe parameters containing the new offset information for the segment.
Write(BinaryStreamWriter)
Serializes the structure to an output stream.
public void Write(BinaryStreamWriter writer)
Parameters
writer
BinaryStreamWriterThe output stream to write the data to.