Class RelativeReference
- Namespace
- AsmResolver
- Assembly
- AsmResolver.dll
Represents a pointer or reference that is relative to the beginning of another segment or structure.
public sealed class RelativeReference : ISegmentReference, IOffsetProvider
- Inheritance
-
RelativeReference
- Implements
- Inherited Members
Constructors
RelativeReference(IOffsetProvider, int)
Creates a new relative reference.
public RelativeReference(IOffsetProvider @base, int additive)
Parameters
base
IOffsetProviderThe segment the reference is relative to.
additive
intThe number of bytes to skip after the beginning of the segment.
Properties
Additive
Gets the number of bytes to skip after the beginning of the segment indicated by Base.
public int Additive { get; }
Property Value
Base
Gets the segment or structure that this reference is relative to.
public IOffsetProvider Base { get; }
Property Value
CanRead
Gets a value indicating whether the referenced segment can be read using a binary reader.
public bool CanRead { get; }
Property Value
IsBounded
Gets a value indicating whether the referenced segment is bounded to a fixed size.
public bool IsBounded { get; }
Property Value
Offset
Gets the physical starting offset of the segment.
public ulong Offset { get; }
Property Value
Rva
Gets the virtual address relative to the beginning of the section that the segment is located in.
public uint Rva { get; }
Property Value
Methods
CreateReader()
Creates a binary reader starting at the beginning of the segment.
public BinaryStreamReader CreateReader()
Returns
- BinaryStreamReader
The binary reader.
Remarks
When CanRead is false
, it is not guaranteed this method will succeed.
GetSegment()
Obtains the segment referenced by this reference.
public ISegment? GetSegment()
Returns
- ISegment
The segment.
Remarks
When IsBounded is false
, it is not guaranteed this method will succeed.
Exceptions
- InvalidOperationException
Occurs when the segment could not be obtained.