Table of Contents

Class SegmentBuilder

Namespace
AsmResolver
Assembly
AsmResolver.dll

Represents a collection of segments concatenated (and aligned) after each other.

public class SegmentBuilder : ISegment, IOffsetProvider, IWritable, IEnumerable<ISegment>, IEnumerable
Inheritance
SegmentBuilder
Implements
Inherited Members
Extension Methods

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 sub segments that are stored into the segment.

public int Count { get; }

Property Value

int

IsEmpty

Gets a value indicating whether the collection of concatenated segments is empty.

public bool IsEmpty { get; }

Property Value

bool

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.

GetEnumerator()

Returns an object that enumerates all segments in the segment builder.

public IEnumerator<ISegment> GetEnumerator()

Returns

IEnumerator<ISegment>

The enumerator.

GetPhysicalSize()

Computes the number of bytes that the structure contains.

public uint GetPhysicalSize()

Returns

uint

The number of bytes.

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.