The memory library for .NET applications helps you access Windows APIs such as WriteProcessMemory
or ReadProcessMemory
in the simplest way.
I created this library to help me read-write memory from any process, and game (at that time it's Warcraft III). I copied the code and started the new project over and over again. So I decided to learn how to create a library and plug it into my game helper.
** Sometimes you might need to run an executable as administrator to access other process's memory.
OpenProcess using process name, this will select the first process name that we've found.
MemoryX.Memory MemX = new MemoryX.Memory();
MemX.GetProcessHandle("notepad");
OpenProcess using PID.
MemoryX.Memory MemX = new MemoryX.Memory();
MemX.GetProcessHandle(12345);
public long GetBaseAddress(String moduleName)
var procName = "Tutorial-x86_64";
long baseAddress = myProc.GetBaseAddress(procName + ".exe");
Console.WriteLine("BaseAddress: {0}", (baseAddress).ToString("X")); // BaseAddress: 100000000
WriteMemory( [address], [data types])
WriteMemory( address, 12345);
WriteMemory( address, "Hello");
WriteMemory(address, 3.1415928f);
WriteMemory(address, 7.1474d);
WriteMemory(address, 0xba);
WriteMemory(address, new byte[] { 0xaa, 0xbb, 0xcc });
Console.WriteLine("BYTES IS " + myProc.ReadMemory(address , 1)[0].ToString("X"));
byte[] b = myProc.ReadMemory(address, 2);
Console.WriteLine(BitConverter.ToInt16(b, 0));
// New an object , one object per process
MemoryX.Memory myProc = new MemoryX.Memory();
// for process name without .exe
// Example you open task manager and see "notepad.exe"
// you can change and put it into "procName" without extensions
var procName = "notepad";
//address for access our process memory
var address = 0x000D1940;
// for open our process
myProc.GetProcessHandle(procName);
// for write memory string value to memory
myProc.WriteMemory(address, "Hello");
// for write memory int value to memory
myProc.WriteMemory(address, 12345);
// for write memory float or single value to memory
myProc.WriteMemory(address, 3.1415928f);
// for write memory double value to memory
myProc.WriteMemory(address, 7.1474d);
// for write memory byte value to memory
myProc.WriteMemory(address, 0xba);
// for write memory array of bytes value to memory
myProc.WriteMemory(address, new byte[] { 0xaa, 0xbb, 0xcc });
// for read a single byte value from memory
Console.WriteLine("BYTES IS " + myProc.ReadMemory(address , 1)[0].ToString("X"));
byte[] arrBytes = myProc.ReadMemory(address, 5);
// for print byte values
foreach (byte b in arrBytes)
Console.WriteLine(b.ToString("X"));
// for read a memory address value and return to double
Console.WriteLine(myProc.ReadDouble(address));
// for read a memory address value and return to flot or Single
Console.WriteLine(myProc.ReadFloat(address));
// for read memory and return to string value
Console.WriteLine(myProc.ReadString(address, 11));
// get a base address of module and print out
Console.WriteLine(myProc.GetBaseAddress("notepad.exe").ToString("X"));
MemoryX.Memory myProc = new MemoryX.Memory();
var procName = "Tutorial-x86_64";
myProc.GetProcessHandle(procName);
long baseAddress = myProc.GetBaseAddress(procName + ".exe");
long address = baseAddress + 0x002C4A80;
int[] offsets = new int[] {0x10, 0x18 ,0 , 0x18};
Console.WriteLine(myProc.ReadMemoryPointerInt(address, offsets));
MemoryX.Memory myProc = new MemoryX.Memory();
String procName = "Tutorial-x86_64";
myProc.GetProcessHandle(procName);
long baseAddress = myProc.GetBaseAddress(procName + ".exe");
long address = baseAddress + 0x002C4A00;
int[] offsets = new int[] { 0x598, 0x6F0, 0xD8, 0xA0, 0x780 };
Console.WriteLine(myProc.WriteMemoryPointer(address, offsets, 666));
Pull requests are welcome =D.