Table of Contents

Class RelocatableSegmentBuilder

Namespace
AsmResolver.PE.Relocations
Assembly
AsmResolver.PE.dll

Provides a mechanism for joining relocatable segments into one single segment.

public class RelocatableSegmentBuilder : ISegment, IOffsetProvider, IWritable, IEnumerable<ISegment>, IEnumerable
Inheritance
RelocatableSegmentBuilder
Implements
Inherited Members

Properties

CanUpdateOffsets

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

public bool CanUpdateOffsets { get; }

Property Value

bool

Count

Gets the number of segments that were concatenated.

public int Count { get; }

Property Value

int

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

Methods

Add(ISegment)

Adds the provided segment with no alignment.

public void Add(ISegment segment)

Parameters

segment ISegment

The segment to add.

Add(ISegment, uint)

Adds the provided segment to the offset that is the next multiple of the provided alignment.

public void Add(ISegment segment, uint alignment)

Parameters

segment ISegment

The segment to add.

alignment uint

The alignment of the segment.

Add(RelocatableSegment)

Adds the provided relocatable segment with no alignment.

public void Add(RelocatableSegment segment)

Parameters

segment RelocatableSegment

The segment to add.

Add(RelocatableSegment, uint)

Adds the provided relocatable segment to the offset that is the next multiple of the provided alignment.

public void Add(RelocatableSegment segment, uint alignment)

Parameters

segment RelocatableSegment

The segment to add.

alignment uint

The alignment of the segment.

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<ISegment> GetEnumerator()

Returns

IEnumerator<ISegment>

An enumerator that can be used to iterate through the collection.

GetPhysicalSize()

Computes the number of bytes that the structure contains.

public uint GetPhysicalSize()

Returns

uint

The number of bytes.

GetRequiredBaseRelocations()

Collects all base relocations that are required when adding the final segment to a PE image.

public IEnumerable<BaseRelocation> GetRequiredBaseRelocations()

Returns

IEnumerable<BaseRelocation>

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.