Table of Contents

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 ISegment

The prologue of the initializer code.

epilogue ISegment

The epilogue of the initializer code.

slotInitializer RelocatableSegment

The 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

RelocatableSegmentBuilder

CanUpdateOffsets

Determines whether this structure can be relocated to another offset or virtual address.

public bool CanUpdateOffsets { get; }

Property Value

bool

EntryPoint

Gets the entry point symbol of the address table initializer.

public ISymbol EntryPoint { get; }

Property Value

ISymbol

Offset

Gets the physical starting offset of the segment.

public ulong Offset { get; }

Property Value

ulong

Rva

Gets the virtual address relative to the beginning of the section that the segment is located in.

public uint Rva { get; }

Property Value

uint

SlotInitializer

Gets the symbol pointing to the function that initializes a single slot in the table.

protected ISymbol SlotInitializer { get; }

Property Value

ISymbol

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 ISymbol

The original slot to initialize.

newSlot ISymbol

The 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 RelocationParameters

The 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 BinaryStreamWriter

The output stream to write the data to.