ReadProcessMemory slowing my prog
Hi everyone,
I finally completed my memory scanner with some help, the scan work but it take a lot of time.
The part that is slowing the prog :
Code:
for (currentAddress = lpAddress ; currentAddress < ((lpAddress + dwSize))-sizeof(value);currentAddress++)
{
if (ReadProcessMemory(phandle,(void*)currentAddress,&value,sizeof(value),0) != 0)
{
if (value == searchfor)
{
printf(" 0x%08X", currentAddress);
tableau[found]=currentAddress;
if (found < (MAXADDR-1))
found++;
}
}
}
if (ReadProcessMemory(phandle,(void*)currentAddress,& value,sizeof(value),0) != 0)
Assume ram is like 1,000,000 bytes long (actually much much bigger).
Is it faster to call ReadProcessMemory() 1,000,000 times and read 1 byte each time
or,
is it faster to call ReadProcessMemory() 1,000 times and read 1000 bytes each time.
1000 function calls vs 1 million.
This is why it's taking so long.