Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Delphi] Searching for AOB's

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Reak
I post too much
Reputation: 0

Joined: 15 May 2007
Posts: 3496

PostPosted: Mon Oct 15, 2007 7:33 am    Post subject: [Delphi] Searching for AOB's Reply with quote

foreword: Well my overall-knowledge is damn low, but my knowledge in ASM is VERRYY low.

Some of you guys know GameVision. (Made by Shu)
It updates scripts/pointers..whatever.
But how does it work ?
How can I search for AOB's in another process to get the adress?
I asked the same question in another forum, a delphi forum. But they didn't really understand what Im talking about, they said the adress Im talking about likes 00643E7E is a offset.
Idk if it's true. But here's my question...
How can I scan for an AOB in a process to get the adress/offset and save it in a variable ?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Oct 15, 2007 10:28 am    Post subject: Reply with quote

I can't help with the code, but I can point out what you will need.

Firstly, if the game is using code shifting, you would need to know the base address of the module that the pointer is located in. I will use HL2 for this example. Everything player based is based on server.dll.

So the first three things you will need is:
- Process ID of HL2.exe [For OpenProcess to get handle.]
- Module Base of server.dll
- Module Size of server.dll

You want the base and size because you only want to scan in this modules memory, scanning else where will take more time and may locate AoB's that you don't want.

To get the process ID, module base and size you will need the following API:
- CreateToolhelp32Snapshot
- Process32First
- Process32Next
- Module32First
- Module32Next
- OpenProcess
- CloseHandle

(Theres other ways to get the above info, this is the easiest method.)

Next, once you have the above info, you will want to open the process for at least reading access, but, PROCESS_ALL_ACCESS does the trick Wink Once open, you will need to copy the memory of the module space into a temporary buffer. To do that, you will need:
- ReadProcessMemory

Create a buffer array to hold the bits, the buffer should be the size of the module that you will be scanning, then the read should be something like:

ReadProcessMemory( gHandle, pBaseAddress, &pBuffer, dwModuleSize, NULL );

Which reads the memory of the dll (start at the dlls base address) and reads the full size of it into your buffer. Now that its in your applications memory, you can use memcmp (memory compare) to compare against another buffer which would hold your AoB.

So you would need to loop the size of the module for that in a for loop stepping 1 spot each time. (This method doesn't include unknown bytes that change so you will need to do a little more work to do that.)

So you would do something like:

Code:

for( DWORD i = 0; i < dwBaseSize; i++ )
{
   if( memcmp( (PVOID)(dwBaseAddress+i), (PVOID)pArrayPointer, iPatternSize ) == 0 )
   {
      // Found The Pattern, Return The Address
      return (dwBaseAddress+i);
   }
}


Which would return the address containing the first byte of your array.

Hope that helps some >.>
Back to top
View user's profile Send private message Visit poster's website
SXGuy
I post too much
Reputation: 0

Joined: 19 Sep 2006
Posts: 3551

PostPosted: Mon Oct 15, 2007 10:40 am    Post subject: Reply with quote

i dont think that helps at all.

there will be tons of arrays which hold the first byte, he wants to know the exact array.

_________________
Proud member of "The DACEF" (Distruction Against Criminal Egotistical Forces"

Sign up today and receive your free "I Hate x0r Badge"
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Oct 15, 2007 12:00 pm    Post subject: Reply with quote

SXGuy wrote:
i dont think that helps at all.

there will be tons of arrays which hold the first byte, he wants to know the exact array.


Um... did you read what I said? It compares for the whole array, then returns the address the first byte of the array is found at.
Back to top
View user's profile Send private message Visit poster's website
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Mon Oct 15, 2007 12:25 pm    Post subject: Reply with quote

You could check the scan when type is "Array of Bytes" in the ce source. Wink
Good luck? Laughing
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites