1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#include "gfMem.h"
//-----------------------------------------------------
// gfMem()-> Assign Memory address to variable address
//-----------------------------------------------------
// p -> process handle
// a -> base_address
// o -> offsets
// c -> offsets count
//-----------------------------------------------------
gfMem::gfMem(HANDLE p, int a, int o[], int c)
{
base_address = a;
if(o!=NULL)
{
int address = base_address;
int* val = new int;
for(int x = 0; x < c; x++)
{
ReadProcessMemory(p,(void*)address,val,4,NULL);
address = *val + o[x];
}
}
else
{
address = base_address;
}
}//--> end_gfMem()
//-----------------------------------------------------
// nValue() - get 4byte value of address
//-----------------------------------------------------
int gfMem::nValue(HANDLE p)
{
int* val = new int;
ReadProcessMemory(p,(void*)address,val,4,NULL);
return *val;
}//--> end_nValue()
//-----------------------------------------------------
// fValue() - get float value of address
//-----------------------------------------------------
float gfMem::fValue(HANDLE p)
{
float* val = new float;
ReadProcessMemory(p,(void*)address,val,
sizeof(float),NULL);
return *val;
}//--> end_fValue()
//-----------------------------------------------------
// sValue() - get string value of address
//-----------------------------------------------------
std::string gfMem::sValue(HANDLE p)
{
std::string* val = new std::string;
ReadProcessMemory(p,(void*)address,val,
sizeof(std::string),NULL);
return *val;
}//--> end_sValue()
|