Table of Contents

Class StoredPointer

Namespace
CStructSharp.Memory
Assembly
CStructSharp.dll

The exact stored value of a pointer as found in memory, together with its width. Reading one never follows it.

public sealed record StoredPointer : IEquatable<StoredPointer>
Inheritance
StoredPointer
Implements
Inherited Members

Remarks

A pointer field is just a stored number until a format's rules say what it means: an absolute virtual address, an offset from the containing object, an address with flag bits in its low end, or an address in some other process. Keeping storage and interpretation apart lets a record be read, displayed, and written back without ever decoding the pointer wrongly. Address is therefore the stored value, as the core's Pointer.Address is; MemorySession interprets it only when a path asks for a target with .value, through the session's resolver, and the record itself is unchanged.

Width is in bytes and must match the schema's declared pointer width when the value is written. A value of zero is null, even if the address space happens to have readable bytes at address zero; this is a deliberate rule of the API.

Constructors

StoredPointer(ulong, int)

Creates a pointer value, checking that the stored value fits the declared width.

public StoredPointer(ulong address, int width = 8)

Parameters

address ulong

The stored unsigned value, exactly as read.

width int

Storage width in bytes: 1, 2, 4, or 8.

Exceptions

ArgumentOutOfRangeException

width is not 1, 2, 4, or 8, or address does not fit it.

Properties

Address

Gets the stored unsigned value, uninterpreted: it may carry tag bits or be relative to a base.

public ulong Address { get; }

Property Value

ulong

IsNull

Gets whether the stored value is zero, which the API treats as null.

public bool IsNull { get; }

Property Value

bool

Width

Gets the storage width in bytes.

public int Width { get; }

Property Value

int

Methods

Equals(StoredPointer?)

public bool Equals(StoredPointer? other)

Parameters

other StoredPointer

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

Operators

operator ==(StoredPointer?, StoredPointer?)

public static bool operator ==(StoredPointer? left, StoredPointer? right)

Parameters

left StoredPointer
right StoredPointer

Returns

bool

operator !=(StoredPointer?, StoredPointer?)

public static bool operator !=(StoredPointer? left, StoredPointer? right)

Parameters

left StoredPointer
right StoredPointer

Returns

bool