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
PlatformThe 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
RequiresDynamicInitialization
Gets a value indicating whether the trampoline table will require dynamic initialization.
public bool RequiresDynamicInitialization { get; }
Property Value
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
Methods
AddDataSlotInitializer(ISymbol, ISymbol)
Adds an initializer for the provided data table slot symbol.
public void AddDataSlotInitializer(ISymbol originalSlot, ISymbol newSlot)
Parameters
originalSlot
ISymbolThe original data table slot to initialize.
newSlot
ISymbolThe 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
ISymbolThe function table slot to redirect.
newSymbol
ISymbolThe 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
PEFileThe file to patch.
ApplyPatches(IList<PESection>)
Applies the trampoline address patches to the provided PE file sections.
public void ApplyPatches(IList<PESection> sections)
Parameters
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
RelocationParametersThe 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
BinaryStreamWriterThe output stream to write the data to.