Table of Contents

Class DotNetDirectory

Namespace
AsmResolver.PE.DotNet
Assembly
AsmResolver.PE.dll

Represents a data directory containing the CLR 2.0 header and data directories of a .NET binary.

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

Constructors

DotNetDirectory()

Creates a new .NET data directory.

public DotNetDirectory()

Properties

CodeManagerTable

Gets or sets the data directory containing the code manager table of the .NET binary (if available).

public IReadableSegment? CodeManagerTable { get; set; }

Property Value

IReadableSegment

DotNetResources

Gets or sets the data directory containing the embedded resources data of the .NET binary (if available).

public DotNetResourcesDirectory? DotNetResources { get; set; }

Property Value

DotNetResourcesDirectory

EntryPoint

Gets or sets the metadata token or entry point virtual address, depending on whether NativeEntryPoint is set in Flags.

public DotNetEntryPoint EntryPoint { get; set; }

Property Value

DotNetEntryPoint

Remarks

Setting this property will not alter Flags. This means that even if a native entry point is assigned to this property, the NativeEntryPoint flag should be set manually for a properly working .NET module.

ExportAddressTable

Gets or sets the data directory containing the addresses to native stubs of exports defined in the .NET binary (if available).

public IReadableSegment? ExportAddressTable { get; set; }

Property Value

IReadableSegment

Flags

Gets or sets the flags associated to the .NET binary.

public DotNetDirectoryFlags Flags { get; set; }

Property Value

DotNetDirectoryFlags

MajorRuntimeVersion

Gets or sets the major runtime version of the directory format.

public ushort MajorRuntimeVersion { get; set; }

Property Value

ushort

Remarks

This field is set to 2 in most .NET binaries.

ManagedNativeHeader

Gets or sets the data directory containing the managed native header of a mixed mode application (if available).

public IManagedNativeHeader? ManagedNativeHeader { get; set; }

Property Value

IManagedNativeHeader

Metadata

Gets or sets the data directory containing the metadata of the .NET binary.

public MetadataDirectory? Metadata { get; set; }

Property Value

MetadataDirectory

MinorRuntimeVersion

Gets or sets the minor runtime version of the directory format.

public ushort MinorRuntimeVersion { get; set; }

Property Value

ushort

Remarks

This field is set to 5 in most .NET binaries.

StrongName

Gets or sets the data directory containing the strong name signature of the .NET binary (if available).

public IReadableSegment? StrongName { get; set; }

Property Value

IReadableSegment

VTableFixups

Gets or sets the data directory containing the VTable fixups that need to be applied when executing mixed mode applications (if available).

public VTableFixupsDirectory? VTableFixups { get; set; }

Property Value

VTableFixupsDirectory

Methods

GetCodeManagerTable()

Obtains the data directory containing the code manager table of the .NET binary.

protected virtual IReadableSegment? GetCodeManagerTable()

Returns

IReadableSegment

The data directory.

Remarks

This method is called upon initialization of the CodeManagerTable property

GetExportAddressTable()

Obtains the data directory containing the export address table of the .NET binary.

protected virtual IReadableSegment? GetExportAddressTable()

Returns

IReadableSegment

The data directory.

Remarks

This method is called upon initialization of the ExportAddressTable property

GetManagedNativeHeader()

Obtains the data directory containing the managed native header of the .NET binary.

protected virtual IManagedNativeHeader? GetManagedNativeHeader()

Returns

IManagedNativeHeader

The data directory.

Remarks

This method is called upon initialization of the ManagedNativeHeader property

GetMetadata()

Obtains the data directory containing the metadata of the .NET binary.

protected virtual MetadataDirectory? GetMetadata()

Returns

MetadataDirectory

The data directory.

Remarks

This method is called upon initialization of the Metadata property

GetPhysicalSize()

Computes the number of bytes that the structure contains.

public override uint GetPhysicalSize()

Returns

uint

The number of bytes.

GetResources()

Obtains the data directory containing the embedded resources data of the .NET binary.

protected virtual DotNetResourcesDirectory? GetResources()

Returns

DotNetResourcesDirectory

The data directory.

Remarks

This method is called upon initialization of the DotNetResources property

GetStrongName()

Obtains the data directory containing the strong name signature of the .NET binary.

protected virtual IReadableSegment? GetStrongName()

Returns

IReadableSegment

The data directory.

Remarks

This method is called upon initialization of the StrongName property

GetVTableFixups()

Obtains the data directory containing the VTable fixups of the .NET binary.

protected virtual VTableFixupsDirectory? GetVTableFixups()

Returns

VTableFixupsDirectory

The data directory.

Remarks

This method is called upon initialization of the VTableFixups property

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.