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
typeRelocationTypeThe type of relocation to apply.
offsetintThe 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
valueushortThe raw value of the entry.
Properties
IsEmpty
Gets a value indicating the entry is a zero entry.
public bool IsEmpty { get; }
Property Value
Offset
Gets the offset (relative to the current relocation block) to the pointer to relocate.
public int Offset { get; }
Property Value
RelocationType
Gets the type of the relocation to apply.
public RelocationType RelocationType { get; }
Property Value
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
otherRelocationEntryAn 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 otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin 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
otherRelocationEntryAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
writerBinaryStreamWriterThe output stream to write the data to.