I'm making an application that will simulate an action using mouse/keyboard (macro) deppending on the value of a variable.
Here I have de scanning code that I made:
void ReadMemory(int value){
DWORD primeiroAddress = 0x000000;
DWORD finalAddress = 0xFFFFFF;
DWORD address=0;
std::ostringstream ss;
int i=0;
TListItem *ListIt;
int valor;
HANDLE phandle = OpenProcess(PROCESS_VM_READ,0,TargetPID);
if(!phandle){
ShowMessage("Não encoutrou o processo");
}else{
for(address=primeiroAddress;address<=finalAddress;address+=sizeof(valor)){
ReadProcessMemory(phandle,(void*)address,&valor,sizeof(valor),0);
if(valor==value){
i++;
ss << std::hex << address;
Form1->Label5->Caption=i;
ListIt = Form1->ListView1->Items->Add();
ListIt->Caption = AnsiString(ss.str().c_str()).UpperCase();
ListIt->SubItems->Add(IntToStr(valor));
ss.str(std::string());
}
}
}
}
I was wondering what I could make to make the scanning faster