Table of Contents

Class VirtualMemory

Namespace
Echo.Memory
Assembly
Echo.dll

Represents an addressable region of memory that maps a collection of memory spaces to virtual addresses.

public class VirtualMemory : IMemorySpace
Inheritance
VirtualMemory
Implements
Inherited Members

Remarks

This class can be compared to the entire memory space of a running process.

Constructors

VirtualMemory()

Creates new uninitialized virtual memory.

public VirtualMemory()

VirtualMemory(long)

Creates new uninitialized virtual memory with the provided size.

public VirtualMemory(long size)

Parameters

size long

Properties

AddressRange

Gets the range that this memory space spans.

public AddressRange AddressRange { get; }

Property Value

AddressRange

Methods

GetMappedRanges()

Gets a collection of all ranges that were mapped into this virtual memory.

public IEnumerable<AddressRange> GetMappedRanges()

Returns

IEnumerable<AddressRange>

The address ranges within the memory.

IsValidAddress(long)

Gets a value indicating whether the provided address is a valid address, and can be used to read and/or write to.

public bool IsValidAddress(long address)

Parameters

address long

The address to query.

Returns

bool

true if the address was valid, false otherwise.

Map(long, IMemorySpace)

Maps a memory space at the provided virtual memory address.

public void Map(long address, IMemorySpace space)

Parameters

address long

The address to map the data at.

space IMemorySpace

The data to map.

Exceptions

ArgumentException

Occurs when the address was already in use.

Read(long, BitVectorSpan)

Copies data at the provided address into the provided buffer.

public void Read(long address, BitVectorSpan buffer)

Parameters

address long

The address to start reading at.

buffer BitVectorSpan

The buffer to write into.

Rebase(long)

Relocates the memory to a new base address.

public void Rebase(long baseAddress)

Parameters

baseAddress long

The new base address.

Unmap(long)

Unmaps a memory space that was mapped at the provided address.

public void Unmap(long address)

Parameters

address long

The address of the memory space to unmap.

Write(long, BitVectorSpan)

Writes the provided buffer of data at the provided address.

public void Write(long address, BitVectorSpan buffer)

Parameters

address long

The address to start writing at.

buffer BitVectorSpan

The data to write.

Write(long, ReadOnlySpan<byte>)

Writes the provided buffer of data at the provided address.

public void Write(long address, ReadOnlySpan<byte> buffer)

Parameters

address long

The address to start writing at.

buffer ReadOnlySpan<byte>

The data to write.