This Code works fine, but i try add all Offsets and memory bytes into txt db, anyone have idea? i want
read all lines from a txt to compare in memory... is for anticheat.. :)
ex of txt..

Offset Memory Dump
Offset Memory Dump..

but i donw know how use loaded data, cuz when i try load Array (mMemory) whit data from txt i have error

#define MAX_DUMP_SIZE 32
#define MAX_PROCESS_DUMP 1

bool ScanProcessMemory(HANDLE hProcess) 
{
	for(int i = 0; i < MAX_PROCESS_DUMP; i++)
	{
		char aTmpBuffer[MAX_DUMP_SIZE];
		SIZE_T aBytesRead = 0;
		char mMemory[MAX_DUMP_SIZE] = {0x64,0x89,0x25,0x00,0x00,0x00,0x00,0x83,0xec,0x58,0x53,0x56,0x57,0x89,0x65,0xe8,0xff,0x15,0x04,0xf4,0x48,0x00,0x33,0xd2,0x8a,0xd4,0x89,0x15,0xd8,0x0a,0x4d,0x00},
		char mOffset = 0x0044e08c;

		ReadProcessMemory(hProcess, (LPCVOID)mOffset, (LPVOID)aTmpBuffer, sizeof(aTmpBuffer), &aBytesRead);
		if(memcmp(aTmpBuffer,mMemory, MAX_DUMP_SIZE) == 0)
		{
			return true;
			break;
		}
	}
}

Thanks

>>when i try load Array (mMemory) whit data from txt i have error
What error? The code you posted does not atempt to read mMemory from a text file.

And why is that in a loop?

The loop is cuz i will add a long list of cheats...

1>.\Loading.cpp(39) : error C2106: '=' : el operando izquierdo debe ser valor L

after fix that i dont know how convert.. my txt string..like 6489250000000083ec585356578965e8ff1504f4480033d28ad48915d80a4d00
into array to use in if(memcmp(aTmpBuffer,mMemory, MAX_DUMP_SIZE) == 0)

Last code use static offset for test function.. now i try add all in a txt... is more easy to update to users.. cuz i only force download new DB when i want..

Loading.h

struct S_CheatSystem
{
	unsigned int mOffset;
	char mMemory[MAX_DUMP_SIZE];
};
class C_CheatSystem
{
public:
	S_CheatSystem c_struct[MAX_PROCESS_DUMP];
	unsigned short c_num;
	void c_LoadSystem();
};
extern C_CheatSystem Cheats;

Loading.cpp

void C_CheatSystem::c_LoadSystem()
{
this->c_num = 0;

	FILE * hFile;
	fopen_s(&hFile, ".\\DB.txt", "r");
	char Line[1024];
	int offset;
	char code[MAX_DUMP_SIZE];
	if(hFile == 0)
	{
		MessageBox(NULL,"Error Open DB.txt","Error",NULL);
		::ExitProcess(0);
		return;
	}
    while(!feof(hFile))
    {
        fgets(Line, 1024, hFile);
		if(!strcmp(Line, "end"))
			break;

		if(Line[strlen(Line) - 1] == '\n' || Line[strlen(Line) - 1] == '\r')
		{
			if(Line[0] != '/' || Line[1] != '/')
			{
				if(c_num > MAX_PROCESS_DUMP)
				{
					MessageBoxA(NULL,"Max lines!","Fatal Error",NULL);
					ExitThread(0);
				}
				sscanf_s(Line, "%d %d", &offset, &code);
				c_struct[this->c_num].mOffset		= offset;
				c_struct[this->c_num].mMemory		= code;
				c_num++;
			}
		}
	}
	fclose(hFile);
}

Sorry bad bad eng..

Help in this code plz

The thread is over 6 months old. Maybe the op has already solved the problem.

I'm trying to do the same code and I can not read data for the struct.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.