Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ts95/process-memory

Process memory reading/writing library.
https://github.com/ts95/process-memory

Last synced: about 2 months ago
JSON representation

Process memory reading/writing library.

Awesome Lists containing this project

README

        

Process memory library
==============

A library that simplifies the process of reading and writing to
the memory of another process in a .NET langauge.

__Remember to compile with /unsafe__

Example of a program which simply reads an array
of 16 bytes from address 0x1D8153A4 in the 'program' process and then
it prints out those bytes to the console.
When passing the name of a process you can write it with or without
'.exe' at the end of the string.
```C#
unsafe class Program
{
static void Main(string[] args)
{
var pm = new ProcessMemory("program.exe", AccessLevel.Read);

// The address the library will read from
long address = 0x1D8153A4;

// Check if the process is running currently
if (pm.ProcessExists)
{
// Read an array of bytes from the address
byte[] bytes = pm.ReadArray(address, 16);

// Print out each byte to the console
foreach (byte b in bytes)
Console.WriteLine("0x{0:X2}", b);
}
Console.Read();
}
}
```

Example of a program that reads an int from memory, then
adds 10 to it and writes it back to the same address.
```C#
unsafe class Program
{
static void Main(string[] args)
{
// Implicitly using AccessLevel.All
var pm = new ProcessMemory("program.exe");

long address = 0x1D8153A4;

if (pm.ProcessExists)
{
int number;

number = pm.Read(address);
number += 10;

pm.Write(address, number);
}
}
}
```