Table of Contents

Class VersionInfoResource

Namespace
AsmResolver.PE.Win32Resources.Version
Assembly
AsmResolver.PE.Win32Resources.dll

Represents a native version resource file.

public class VersionInfoResource : VersionTableEntry, ISegment, IOffsetProvider, IWritable, IWin32Resource
Inheritance
VersionInfoResource
Implements
Inherited Members

Constructors

VersionInfoResource()

Creates a new empty version info resource targeting the English (United States) language identifier.

public VersionInfoResource()

VersionInfoResource(int)

Creates a new empty version info resource.

public VersionInfoResource(int lcid)

Parameters

lcid int

The language identifier the resource version info is targeting.

Fields

VsVersionInfoKey

The name of the root object of the native version resource file.

public const string VsVersionInfoKey = "VS_VERSION_INFO"

Field Value

string

Properties

FixedVersionInfo

Gets the fixed version info stored in this version resource.

public FixedVersionInfo FixedVersionInfo { get; set; }

Property Value

FixedVersionInfo

this[string]

Gets or sets a version table entry by its name.

public VersionTableEntry this[string name] { get; set; }

Parameters

name string

The name of the child.

Property Value

VersionTableEntry

Key

Gets the name of the table.

public override string Key { get; }

Property Value

string

Lcid

Gets the language identifier the resource version info is targeting.

public int Lcid { get; }

Property Value

int

ValueType

Gets the value type of the table.

protected override VersionTableValueType ValueType { get; }

Property Value

VersionTableValueType

Methods

AddEntry(VersionTableEntry)

Adds (or overrides the existing entry with the same name) to the version resource.

public void AddEntry(VersionTableEntry entry)

Parameters

entry VersionTableEntry

The entry to add.

FindAllFromDirectory(ResourceDirectory)

Obtains all version info resources from the provided root win32 resources directory.

public static IEnumerable<VersionInfoResource?> FindAllFromDirectory(ResourceDirectory rootDirectory)

Parameters

rootDirectory ResourceDirectory

The root resources directory to extract the version info from.

Returns

IEnumerable<VersionInfoResource>

The version info resource, or null if none was found.

FromDirectory(ResourceDirectory)

Obtains the first version info resource from the provided root win32 resources directory.

public static VersionInfoResource? FromDirectory(ResourceDirectory rootDirectory)

Parameters

rootDirectory ResourceDirectory

The root resources directory to extract the version info from.

Returns

VersionInfoResource

The version info resource, or null if none was found.

FromDirectory(ResourceDirectory, int)

Obtains the version info resource from the provided root win32 resources directory.

public static VersionInfoResource? FromDirectory(ResourceDirectory rootDirectory, int lcid)

Parameters

rootDirectory ResourceDirectory

The root resources directory to extract the version info from.

lcid int

The language identifier to get the version info from.

Returns

VersionInfoResource

The version info resource, or null if none was found.

FromReader(ref BinaryStreamReader)

Reads a version resource from an input stream.

public static VersionInfoResource FromReader(ref BinaryStreamReader reader)

Parameters

reader BinaryStreamReader

The input stream.

Returns

VersionInfoResource

The parsed version resource.

Exceptions

FormatException

Occurs when the input stream does not point to a valid version resource.

FromReader(int, ref BinaryStreamReader)

Reads a version resource from an input stream.

public static VersionInfoResource FromReader(int lcid, ref BinaryStreamReader reader)

Parameters

lcid int

The language identifier to get the version info from.

reader BinaryStreamReader

The input stream.

Returns

VersionInfoResource

The parsed version resource.

Exceptions

FormatException

Occurs when the input stream does not point to a valid version resource.

FromResourceData(ResourceData)

Obtains the version info resource from the provided resource data entry.

public static VersionInfoResource FromResourceData(ResourceData dataEntry)

Parameters

dataEntry ResourceData

The data entry to extract the version info from.

Returns

VersionInfoResource

The extracted version info resource.

GetChild<TEntry>(string)

Gets a version table entry by its name.

public TEntry GetChild<TEntry>(string name) where TEntry : VersionTableEntry

Parameters

name string

The name of the child.

Returns

TEntry

The entry.

Type Parameters

TEntry

The type of the version table entry to lookup.

GetChildren()

Gets a collection of entries stored in the version resource.

public IEnumerable<VersionTableEntry> GetChildren()

Returns

IEnumerable<VersionTableEntry>

GetPhysicalSize()

Computes the number of bytes that the structure contains.

public override uint GetPhysicalSize()

Returns

uint

The number of bytes.

GetValueLength()

Gets the length of the raw value.

protected override uint GetValueLength()

Returns

uint

The raw value.

InsertIntoDirectory(ResourceDirectory)

Serializes the win32 resource to the provided root win32 resource data directory.

public void InsertIntoDirectory(ResourceDirectory rootDirectory)

Parameters

rootDirectory ResourceDirectory

The root directory to submit the changes to.

RemoveEntry(string)

Remove an entry by its name.

public bool RemoveEntry(string name)

Parameters

name string

The name of the child to remove..

Returns

bool

true if the name existed in the table and was removed successfully, false otherwise.

WriteValue(BinaryStreamWriter)

Writes the value field of the version structure.

protected override void WriteValue(BinaryStreamWriter writer)

Parameters

writer BinaryStreamWriter

The output stream.