 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
ShurikeN Advanced Cheater
Reputation: 0
Joined: 09 Jan 2008 Posts: 84
|
Posted: Mon May 19, 2008 7:24 am Post subject: Faster RPM array of bytes |
|
|
im using this code to scan array of bytes but the problem is it's taking hours to complete scan which is very annoying!!
| Code: |
BYTE byArray[] = { 0x68, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0xA1, 0x00, 0x00, 0x00, 0xA2, 0x00, 0x00, 0x00, 0xA3, 0x00, 0x00, 0x00 };
BYTE byBuffer[ sizeof(byArray) ];
int currentAddress = 0x01000000;
int endAddress = 0x0F000000;
do{
ReadProcessMemory( hProcess, (void*)currentAddress, (void*)byBuffer, sizeof( byBuffer ), 0 );
if( memcmp( byBuffer, byArray, sizeof( byArray )) == 0 )
{
//found
}
++currentAddress;
}while( currentAddress != endAddress );
|
how do i make the scanning faster? like CE does.
_________________
| Code: | XXXXXX XXXXXX
XXXXX XXXXX
XXXXXXXX
D I R E C T
XXXXXXXX
XXXXX XXXXX
XXXXXX XXXXXX
GameDev
|
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 474
Joined: 09 May 2003 Posts: 25968 Location: The netherlands
|
Posted: Mon May 19, 2008 7:33 am Post subject: |
|
|
read as much as possible with readprocessmemory at a time and then scan the buffer you get
Do not call readprocessmemory repeatedly with a small buffer. It'll be really slow.
e.g.
read a big block and then
| Code: |
for (i=0; i<totalmemoryread-sizeof(mybuffer); i++)
if( memcmp( &byBuffer[i], byArray, sizeof( byArray )) == 0 )
{
//found
}
|
virtualqueryex helps finding out the size of that block
_________________
Tools give you results. Knowledge gives you control.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
ShurikeN Advanced Cheater
Reputation: 0
Joined: 09 Jan 2008 Posts: 84
|
Posted: Mon May 19, 2008 8:04 am Post subject: |
|
|
ok i get it, but how do i get the address after finding the array inside the buffer??
| Code: |
int address;
for (i=0; i<totalmemoryread-sizeof(mybuffer); i++)
if( memcmp( &byBuffer[i], byArray, sizeof( byArray )) == 0 )
{
address = ???? // address of the array found.
}
|
sorry for being so noob.
_________________
| Code: | XXXXXX XXXXXX
XXXXX XXXXX
XXXXXXXX
D I R E C T
XXXXXXXX
XXXXX XXXXX
XXXXXX XXXXXX
GameDev
|
|
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Mon May 19, 2008 8:09 am Post subject: |
|
|
|
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Mon May 19, 2008 8:19 am Post subject: |
|
|
No, i is just the current value in the for loop where the address was found. More or less so, an offset in the block of memory.
| Code: | | address = StartAddress + i; |
_________________
- Retired. |
|
| Back to top |
|
 |
ShurikeN Advanced Cheater
Reputation: 0
Joined: 09 Jan 2008 Posts: 84
|
Posted: Mon May 19, 2008 7:19 pm Post subject: |
|
|
i tried using VirtualQueryEx but i really can't get it work, so i tried experimenting other ways. is this ok???
| Code: |
BYTE* byBuffer[4096];
startAddress = 0x00400000;
endAddress = 0x7FFFFFFF;
for( int size = startAddress; size < endAddress; size += 4096 )
{
if( ReadProcessMemory( hProcess, (void*)startAddress, (void*)byBuffer, 4096, 0 ) == 0 )
{
startAddress += 4096;
}
else
{
for( int z = 0; z < 4096; ++z )
{
if( memcmp( &byBuffer[z], byArray, sizeof( byArray )) == 0 )
{
//found
}
}
startAddress += 4096;
}
}
|
if you can show me how VirtualQueryEx is properly used pls do
_________________
| Code: | XXXXXX XXXXXX
XXXXX XXXXX
XXXXXXXX
D I R E C T
XXXXXXXX
XXXXX XXXXX
XXXXXX XXXXXX
GameDev
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|