Current Capabilities:
Reading memory of another process.
Writing memory of another process.
Module scanning / retrieval
Pattern scanning
Multi level pointer support
Define Addresses with the "Address" type (not int, long, intptr, etc.)
Define Pointers with the "MemoryPointer" type (use the MemoryPointer.AddressBeingPointedTo property to resolve a given pointer)
Basic usage example depicting reading, writing, and pattern scanning.
FIRST: in your solution explorer, right click Dependencies and add a project reference to the correct SharpMemory dll (depending on whether the game is 32 or 64 bit)
using System.Diagnostics;
using SharpMemory;
using SharpMemory.Native;
string GameProcessName = "GameName.exe";
Address healthAddress = 0xDEADBEEF;
Address moneyAddress = 0xFADEDBEE;
var desiredAccessLevel = NativeData.ProcessAccessFlags.VMRead | NativeData.ProcessAccessFlags.VMWrite | NativeData.ProcessAccessFlags.VMOperation;
SharpMem SharpMem = new SharpMem(GameProcessName, desiredAccessLevel);
Reading a variable via Address extension (Recommended)
float moneyValue = moneyAddress.Read<float>();
Reading a variable legacy way
int healthValue = SharpMem.ReadFuncs.Read<int>(healthAddress);
Writing an address via extension (Recommended)
moneyAddress.Write(99999999f);
//the above line implicty assumes it is writing a float because of the F at the end of the number. If we want to explicity tell it we do it with <> brackets like so:
moneyAddress.Write<float>(99999999);
Writing an address legacy way
SharpMem.WriteFuncs.Write<float>(moneyAddress, 99999999);
Pattern Scanning
ProcessModule MainModule = SharpMem.ModuleFuncs.GetModule(GameProcessName);
string bytePattern = "89 B7 BC 20 00 00";
Address patternBaseAddress;
if(SharpMem.PatternScanning.PatternScanModule(MainModule, bytePattern, out patternBaseAddress))
Console.WriteLine(patternBaseAddress.ToString("X"));
Be sure to match the bit type of all 3 (The game, your code, and the SharpMem dll) (i.e. all 64bit or all x86)