Table of Contents

Class TrampolineTableBuffer

Namespace
AsmResolver.PE.Builder
Assembly
AsmResolver.PE.dll

Represents a buffer of code trampolines used to redirect functions stored in address tables such as import address tables and VTable fixups.

public class TrampolineTableBuffer : SegmentBase, ISegment, IOffsetProvider, IWritable
Inheritance
TrampolineTableBuffer
Implements
Inherited Members

Constructors

TrampolineTableBuffer(Platform)

Creates a new buffer for the designated platform.

public TrampolineTableBuffer(Platform platform)

Parameters

platform Platform

The platform.

Properties

DataInitializerSymbol

When the buffer has data initializers registered, gets the symbol for the main initializer of the trampoline.

public ISymbol? DataInitializerSymbol { get; }

Property Value

ISymbol

RequiresDynamicInitialization

Gets a value indicating whether the trampoline table will require dynamic initialization.

public bool RequiresDynamicInitialization { get; }

Property Value

bool

Remarks

Currently, this is only the case if data slots are added to the table.

VirtualProtect

Gets or sets the symbol to kernel32.dll!VirtualProtect that is used during dynamic initialization of the trampolined table.

public ImportedSymbol? VirtualProtect { get; set; }

Property Value

ImportedSymbol

Methods

AddDataSlotInitializer(ISymbol, ISymbol)

Adds an initializer for the provided data table slot symbol.

public void AddDataSlotInitializer(ISymbol originalSlot, ISymbol newSlot)

Parameters

originalSlot ISymbol

The original data table slot to initialize.

newSlot ISymbol

The data table slot to initialize the original slot with.

AddFunctionTableSlotTrampoline(ISymbol, ISymbol)

Adds a new trampoline for the provided function table slot symbol.

public void AddFunctionTableSlotTrampoline(ISymbol functionTableSlot, ISymbol newSymbol)

Parameters

functionTableSlot ISymbol

The function table slot to redirect.

newSymbol ISymbol

The function table slot to redirect to.

ApplyPatches(PEFile)

Applies the trampoline address patches to the provided PE file.

public void ApplyPatches(PEFile file)

Parameters

file PEFile

The file to patch.

ApplyPatches(IList<PESection>)

Applies the trampoline address patches to the provided PE file sections.

public void ApplyPatches(IList<PESection> sections)

Parameters

sections IList<PESection>

The sections to patch.

GetPhysicalSize()

Computes the number of bytes that the structure contains.

public override uint GetPhysicalSize()

Returns

uint

The number of bytes.

GetRequiredBaseRelocations()

Obtains the base relocations that are required to be applied on all the generated trampoline code.

public IEnumerable<BaseRelocation> GetRequiredBaseRelocations()

Returns

IEnumerable<BaseRelocation>

The base relocations.

UpdateOffsets(in RelocationParameters)

Assigns a new file and virtual offset to the segment and all its sub-components.

public override 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 override void Write(BinaryStreamWriter writer)

Parameters

writer BinaryStreamWriter

The output stream to write the data to.