Table of Contents

Class TlsDirectory

Namespace
AsmResolver.PE.Tls
Assembly
AsmResolver.PE.dll

Represents the data directory containing Thread-Local Storage (TLS) data.

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

Constructors

TlsDirectory()

Initializes a new empty TLS data directory.

public TlsDirectory()

Properties

CallbackFunctions

Gets a table of function callbacks that need to be called upon every thread creation.

public ReferenceTable CallbackFunctions { get; }

Property Value

ReferenceTable

Characteristics

Gets or sets the characteristics that are assigned to this directory.

public TlsCharacteristics Characteristics { get; set; }

Property Value

TlsCharacteristics

Index

The location to receive the TLS index, which the loader assigns

public ISegmentReference Index { get; set; }

Property Value

ISegmentReference

SizeOfZeroFill

Gets or sets the number of zero bytes that need to be appended after the template data referenced by TemplateData.

public uint SizeOfZeroFill { get; set; }

Property Value

uint

TemplateData

Gets or sets the block of data that is used as a template to initialize TLS data. The system copies all of this data each time a thread is created.

public IReadableSegment? TemplateData { get; set; }

Property Value

IReadableSegment

Methods

GetCallbackFunctions()

Obtains the table of callback functions.

protected virtual ReferenceTable GetCallbackFunctions()

Returns

ReferenceTable

The callback functions.

Remarks

This method is called upon initialization of the CallbackFunctions property.

GetPhysicalSize()

Computes the number of bytes that the structure contains.

public override uint GetPhysicalSize()

Returns

uint

The number of bytes.

GetRequiredBaseRelocations()

Obtains a collection of base address relocations that need to be applied to the TLS data directory after the image was loaded into memory.

public IEnumerable<BaseRelocation> GetRequiredBaseRelocations()

Returns

IEnumerable<BaseRelocation>

The required base relocations.

GetTemplateData()

Obtains the block of template data.

protected virtual IReadableSegment? GetTemplateData()

Returns

IReadableSegment

The template data.

Remarks

This method is called upon initialization of the TemplateData property.

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.