Functions for process memory manipulation
This struct encapsulates process memory manipulation functionality.
Gets a ProcessMemory with associated with current processes.
Construct a ProcessMemory from a processHandle.
Returns whether this is associated with a process handle. It is asserted that no member functions are called for an unassociated ProcessMemory struct.
assert(ProcessMemory.current.associated); assert(!ProcessMemory.init.associated); auto h = ProcessMemory.init.processHandle; // assert violation
Gets the handle of the associated process.
Set access protection of the specified memory region to newProtection. Returns previous protection of the first page in the specified region.
Reads buff.length bytes of memory starting with baseAddress into buff.
uint[1] buff; uint a = 7; current.read(cast(RemoteAddress) &a, buff); assert(buff[0] == 7); import std.exception: assertThrown; assertThrown(ProcessMemory.current.read(0, buff));
Reads T.sizeof bytes of memory starting with baseAddress and returns it as T.
uint a = 7; assert(current.get!uint(cast(RemoteAddress) &a) == 7); assert(current.get!(char[2])(cast(RemoteAddress) "ab".ptr) == "ab"); import std.exception: assertThrown; assertThrown(current.get!ubyte(0));
Writes T.sizeof bytes of memory starting with baseAddress and returns it as T.
uint[3] a = [7, 8, 9]; current.write(cast(RemoteAddress) &a[1], [10]); assert(a == [7, 10, 9]); import std.exception: assertThrown; assertThrown(current.write(0, [0]));