A simpler way to do RPM or WPM
Before:
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, 1144);
SIZE_T NumberOfBytesRead;
ReadProcessMemory(
hProcess,
(LPCVOID)ptr2int,
&intRead,
sizeof(intRead),
&NumberOfBytesRead
);
Basic usage:
#include "ProcessMemory.h"
MPointer mptr(
1144, // process id
PROCESS_ALL_ACCESS // desired access rights
);
int* ptr2int = reinterpret_cast<int*>(0x61fef8);
int intToWrite = 20000;
int intToRead;
// Set Address
mptr[ptr2int];
// Read
mptr.read<int>(&intToRead);
mptr >> intToRead;
// Write
mptr.write<int>(&intToWrite);
mptr << intToRead;
Some combinations:
int intToRead;
mptr[ptr2int].read<int>(&intToRead);
mptr[ptr2int] >> intToRead;
Operators:
// the followings will return the address after calculating
mptr + 0x98;
mptr - 0x98;
mptr[mptr.base + 0x98];
Get success:
bool ret = mptr.read<int>(&intToRead);
// OR
if (mptr.read<int>(&intToRead)) {
// on success
}
// OR
if (mptr >> intToRead) {
// on success
}
Public Members:
mptr.lastError; // last error
mptr.numberOfBytes; // number of bytes
mptr.base; // base address of the process, initialized when constructing
mptr.getBaseAddress(); // get base address of the process
the inital address will be base address