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 


AOBScan works in CE, but not in my C++ program?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
SeanTheLawn
How do I cheat?
Reputation: 0

Joined: 27 May 2016
Posts: 6

PostPosted: Mon Jun 13, 2016 8:27 am    Post subject: AOBScan works in CE, but not in my C++ program? Reply with quote

I'm pretty new to this kind of programming, but I've been taking CE mods/scripts for one of my favorite games and implementing them in C++ (using a DLL wrapper for the game) to learn more about C++/game modding etc (and for fun of course).

I've had success using an AOBScan library (my account's pretty new so I can't post URLs yet, but the library I'm using will be the first result if you Google "[Library] Pretty fast Pattern/AoB Scan Library") for some of my mods, but I've run into an issue with it.

The current mod I'm trying to implement scans for an Array Of Bytes to find an address. In CE, the AOB is found, but in C++, it can't be found. After some investigation, I noticed that in CE, the AOB is usually found in memory somewhere in the range of 0x05000000 to 0x06000000. However, the C++ AOBScan library I'm using takes the base address and size of the game, and scans that memory region. The base address is usually 0x00400000, and the size is usually around 0x011C2000. This means my C++ implementation only scans the range around 0x00400000 to 0x015C2000, and the address I'm looking for is always out of range and is never found. Additionally, my attempts to use this AOBScan library outside of the game's memory always seem to cause a crash (read access violation).

tl;dr of my problem:
-CE's AOBScan finds my address somewhere in the range around 0x05000000 to 0x06000000
-My C++ implementation only scans the game's memory (around 0x00400000 to 0x015C2000), so it never finds the address I need.


If anyone has the time, I was wondering if you could answer any of these questions for me:
-How would I go about scanning for the address I need?
-Is there a better AOBScan library/method I should be using?
-How can CE find values in the game's process if they seem to be outside of the game's memory?

I'm still kind of a newb but I'm addicted to learning more about this stuff, so I hope you can find the time to help me out. If you read this far, thanks for your time!
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 Jun 13, 2016 12:07 pm    Post subject: Reply with quote

Use VirtualQuery to walk the memory regions of the process (if you are injected). Walk the memory regions and pass their base/size to the aob scanner code you are using until it is found.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
SeanTheLawn
How do I cheat?
Reputation: 0

Joined: 27 May 2016
Posts: 6

PostPosted: Mon Jun 13, 2016 1:51 pm    Post subject: Reply with quote

It worked! Thank you
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