
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using wMCLib; // Including library
namespace mclibtest
{
class Program
{
static void Main(string[] args)
{
// Create a variable of mcLib class
mcLib m = new mcLib("notepad", 32);
m.Open(); //Open process
Console.WriteLine(m.getPID()); //Write PID of notepad
uint allocated = m.Alloc(); //Allocate new memory
string str = "yo!hello!"; //String which will be written
m.Write(str, allocated, (uint)str.Length); //Write in notepad's memory
m.Read(allocated, (uint)str.Length); //Read it back
string read = m.bufferToStringA();//buffer(bytes) -> string
Console.WriteLine(read);//Write it in console (OUTPUT: yo!hello!)
m.Free(allocated);//Delete allocated memory
m.Close(); // better to close it but not needed
Console.ReadKey(true);
}
}
}
mcLib(string procName, uint bufferSize) void Open(uint accessRights) void Close() void Write(string value, uint to, uint size) void Write(string value, uint to, uint size, uint memProtect) void Read(uint from, uint size) void Read(uint from, uint size, uint memProtect) uint Alloc(uint sizeOfAllocatedMemory, uint memProtect) - returns address where new memory starts void Free(uint ptr) uint FindSignature(uint base, uint size, string sign, string mask) uint getProcessSize() uint getProcessBaseAddr() uint getModuleSize(string moduleName) uint getModuleBaseAddr(string moduleName) uint getPID() x bufferToX() - convert buffer to X (x may be double, float, uint64, int64, uint32, int32, uint16, int16, uint8, int8) string bufferToStringA() - converts buffer to string using char* (C++) string bufferToStringW() - converts buffer to string usgin wchar_t* (C++)