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 


[C++] Memory Scan Access Violation

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

Joined: 07 Nov 2015
Posts: 6
Location: Oh...Around.

PostPosted: Sun Nov 08, 2015 1:10 pm    Post subject: [C++] Memory Scan Access Violation Reply with quote

So yes, i have a memory scanner that to my knowledge is acting rather strangely, It reads memory, And skips unallocated memory, up to a Point
after a certain Point it suddenly tries to read a section of unallocated memory, Throwing an Access Violation exception.
If i try handling this exception then i'll notice that pretty much every single unallocated memoryspace after the first one is read too, and the code after a while suddenly returns a seemingly random adress somewhere in unallocated memoryspace.

I know for a fact that what i'm searching has an extremely minimal chance of existing in the program, And it should in theory therefore Always scan all the memory and return 0, Something it does not when the exception is handled.

To show some of this in action: (Not handling the exception on this one, I'd rather make sure it never happens) EDIT: I Put the link in my Signature, As i'm apparently unable to post links (I couldn't find the rules D: And didn't see anything about posting links in the FAQ?)

Any thoughts?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25806
Location: The netherlands

PostPosted: Sun Nov 08, 2015 1:37 pm    Post subject: Reply with quote

Welcome to injected memory scanning.
It's a hell.

During the scan, after virtualQueryEx, but before the scan is finished, a thread of the game can free the memoryblock you're currently scanning.
(Another issue with injected scanners is that sometimes you're scanning your own allocated memory where you add the results, which you will find again, which you'll add, and again, ....)

You could add some exception handling around every page you're going to read, and if an exception happens, do virtualquery again and start from the next available page

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
qoazi
How do I cheat?
Reputation: 0

Joined: 07 Nov 2015
Posts: 6
Location: Oh...Around.

PostPosted: Sun Nov 08, 2015 2:23 pm    Post subject: Reply with quote

Yea, That's Pretty much what i tried earlier, added it again and compiled and retried, Result in the second video in my signature

These is what i mentioned in my first post, When handling the exception i instead get wierd seemingly random return values of addresses pointing to unallocated memoryspace.

Considering this memoryspace is unallocated it should had been skipped, But it wasn't

Considering it is unallocated (again) it should have thrown an exception when read, But it didn't!

Considering it doesn't exist at all the comparisons should be wrong! But instead they all match up and return the adress?!

I can't wrap my head around it!

can the try/Catch statement somehow cause a return that exits the function? (and returns an adress :7 )
Back to top
View user's profile Send private message
qoazi
How do I cheat?
Reputation: 0

Joined: 07 Nov 2015
Posts: 6
Location: Oh...Around.

PostPosted: Mon Nov 09, 2015 10:02 am    Post subject: Reply with quote

Dark Byte wrote:
Welcome to injected memory scanning.
It's a hell.

<Snip!>
(Another issue with injected scanners is that sometimes you're scanning your own allocated memory where you add the results, which you will find again, which you'll add, and again, ....)

<Snip!>

What you have predicted almighty one has come true!

I'm not sure i did anything, But when i woke up this morning the scan actually showed the correct adress i'm searching for!
and one wrong address but hey it's better than when i Went to bed!
I'm suspecting some magical being must have snuck into my room while i was asleep, Either that or a friendly RAT, Who knows?

I'm not storing the value yet, so it only happens once but i'm assuming this was why i found all the wierd values after handling the Access Violation exception.

But if i can solve that (perhaps by skipping the memory the module was given?) then the scanner does work and finds what i'm searching for!
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