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
addressulongThe stored unsigned value, exactly as read.
widthintStorage width in bytes: 1, 2, 4, or 8.
Exceptions
- ArgumentOutOfRangeException
widthis not 1, 2, 4, or 8, oraddressdoes 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
IsNull
Gets whether the stored value is zero, which the API treats as null.
public bool IsNull { get; }
Property Value
Width
Gets the storage width in bytes.
public int Width { get; }
Property Value
Methods
Equals(StoredPointer?)
public bool Equals(StoredPointer? other)
Parameters
otherStoredPointer
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(StoredPointer?, StoredPointer?)
public static bool operator ==(StoredPointer? left, StoredPointer? right)
Parameters
leftStoredPointerrightStoredPointer
Returns
operator !=(StoredPointer?, StoredPointer?)
public static bool operator !=(StoredPointer? left, StoredPointer? right)
Parameters
leftStoredPointerrightStoredPointer