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 


[HELP] AOB Search functions for C++

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
blitz02
Cheater
Reputation: 0

Joined: 28 Feb 2007
Posts: 44

PostPosted: Fri Apr 23, 2010 9:38 am    Post subject: [HELP] AOB Search functions for C++ Reply with quote

Hi there specially to DB.
I was wondering about this AOB Search.

I have surfed and searched the internet for almost 2 days trying to find a code on C++ that will basically search for an array of byte and replaces it.

I am trying to create an InGame Menu Trainer, the only problem left is the AOB Search and replace function.

So far my research came up with the Signature Scanning, but I'm getting errors prompt to compilation. Can somebody help me with this problem?

I'm know java language, and i'm really new into C++.
So bear with me people Smile
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Fri Apr 23, 2010 12:26 pm    Post subject: Reply with quote

why not code your own one. if you're not familiar with byte searching, just pretend the byte signature is a string and imagine how you would implement that ? it's exactly the same
Back to top
View user's profile Send private message
NoMercy
Master Cheater
Reputation: 1

Joined: 09 Feb 2009
Posts: 289

PostPosted: Fri Apr 23, 2010 3:40 pm    Post subject: Reply with quote

Code:
BYTE* ScanAOB(BYTE* AOB, BYTE* memdump, unsigned long searchsize, int aobsize)
{
   unsigned long a = 0, i = 0;
   for(i = 0; i < searchsize; i++)
   {     
      while(AOB[a] == '?')
      {
         a++;
         i++;
      }
      if(memdump[i] == AOB[a])
      {
         if(a == (aobsize - 1))
         {
            return &memdump[i-a];            
         }
         a++;
      }
      else a = 0;
   }
   return 0;
}


and this is how to call it

Code:
byte SendAob[9] = {0xB8, 0xb8, 0xb8, 0xb8, 0, 0xE8, 0xCD, 0x0E, 0x43};
DWORD SendAddy = (DWORD)ScanAOB(SendAob, (byte*)0x00400000, 0x600000, 9);
Back to top
View user's profile Send private message
blitz02
Cheater
Reputation: 0

Joined: 28 Feb 2007
Posts: 44

PostPosted: Fri Apr 23, 2010 8:19 pm    Post subject: Reply with quote

Thanks for the code! I kinda got a Clear Idea. Very Happy
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Sat Apr 24, 2010 6:52 am    Post subject: Reply with quote

wuttt are you sure that function even works.. ?!
Back to top
View user's profile Send private message
blitz02
Cheater
Reputation: 0

Joined: 28 Feb 2007
Posts: 44

PostPosted: Sat Apr 24, 2010 7:24 am    Post subject: Reply with quote

No it says,

First-chance exception in myfirsttry.exe: 0xC0000005: Access Violation.

but I am making another from that concept, although his function does really do the job. What does that error means? Access Violation?

[EDIT]

Thanks again, I got it.. I'll do it later, i combined it with LPVOID Very Happy now its working.. gotta eat first Razz thanks for the answer to my Q. Good day
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Sat Apr 24, 2010 9:54 am    Post subject: Reply with quote

it seems to me that if that code finds a partial match, it would fail then instead of scanning from that partial match's address + 1, it would scan from where it was different.

access violation is when your application tries to access memory in a page that is not accessible in the way you are trying with the current page access rights assigned to it.

either way, that is a yucky algo
Back to top
View user's profile Send private message
blitz02
Cheater
Reputation: 0

Joined: 28 Feb 2007
Posts: 44

PostPosted: Sat Apr 24, 2010 12:53 pm    Post subject: Reply with quote

Got It Very Happy

another question.. If I succesfully Injected a DLL, am I granted to access the memory? Even if it has gameguard?
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Sat Apr 24, 2010 1:45 pm    Post subject: Reply with quote

yes, the virtual memory mapped to the process you have injected into is fully accessible to your dll. since it is in the same memory space, all previous page protections hold
Back to top
View user's profile Send private message
blitz02
Cheater
Reputation: 0

Joined: 28 Feb 2007
Posts: 44

PostPosted: Sun Apr 25, 2010 8:30 am    Post subject: Reply with quote

Thanks for the INFOS Very Happy
I'm currently progressing on my thing Razz

[edit]

Hey guys, I need a little help..
The code that was posted above was working,
but the main exe we're closing when the code cannot find any match..

I am using SendAddy function and WriteProcessMemory.

[edit]

Another problem, help me..

I succesfully injected the code..
The menu displayed on the exe.
but it doesn't work.

I tried some several test,
I scan memory with CE, saw the whole memory regions.
but a bit later, all memory was gone..

Did gameguard hide it again?
I have no clue on this.. Need help pretty bad.
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 Gamehacking 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