Table of Contents

Struct RelocationEntry

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

Represents one entry in a base relocation block, containing the offset within the page, as well as the type of relocation to apply after the PE image was loaded by the OS.

public readonly struct RelocationEntry : IWritable, IEquatable<RelocationEntry>, IComparable<RelocationEntry>
Implements
Inherited Members

Constructors

RelocationEntry(RelocationType, int)

Creates a new relocation entry.

public RelocationEntry(RelocationType type, int offset)

Parameters

type RelocationType

The type of relocation to apply.

offset int

The offset within the page to apply the relocation on.

Exceptions

ArgumentOutOfRangeException

Occurs when the offset does not indicate a valid offset within the page.

RelocationEntry(ushort)

Creates a new relocation entry.

public RelocationEntry(ushort value)

Parameters

value ushort

The raw value of the entry.

Properties

IsEmpty

Gets a value indicating the entry is a zero entry.

public bool IsEmpty { get; }

Property Value

bool

Offset

Gets the offset (relative to the current relocation block) to the pointer to relocate.

public int Offset { get; }

Property Value

int

RelocationType

Gets the type of the relocation to apply.

public RelocationType RelocationType { get; }

Property Value

RelocationType

Methods

CompareTo(RelocationEntry)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(RelocationEntry other)

Parameters

other RelocationEntry

An object to compare with this instance.

Returns

int

A value that indicates the relative order of the objects being compared. The return value has these meanings:

Value Meaning
Less than zero This instance precedes other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in the sort order.

Equals(RelocationEntry)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(RelocationEntry other)

Parameters

other RelocationEntry

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

GetPhysicalSize()

Computes the number of bytes that the structure contains.

public uint GetPhysicalSize()

Returns

uint

The number of bytes.

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.