Posted: Tue Apr 13, 2021 12:14 am Post subject: How can I avoid ACCESS_DENIED exception from Windows?
Let's say that in a script I wanna access what's on [eax-100], how can I know beforehand that I can access that memory? Can I somehow check that that memory belongs to the process/game attached?
I have a script that accesses thousands of different addresses and what's happening is that every once in a while, a value comes and crashes my game with the Windows exception 5 (ACCESS_DENIED).
It would also help if I could know the size of the structure that's on [eax] (which I know I can access), I know there's a tool for it in CE but didn't see a way to do that on a script (with lua or something else).
how can I know beforehand that I can access that memory?
You can't. IsBadReadPtr tries to solve this, but it's obviously a race condition between the call and the access. If the access could sometimes be bad, the safest way is to establish an exception handler. (a test for null pointers can quickly handle some cases)
Sp4rt wrote:
It would also help if I could know the size of the structure that's on [eax]
Again, you can't know that for certain. As far as I'm aware CE doesn't have a tool that can find the structure size in the general case.
Sometimes, there's debugging information available that CE can use to gather information about the semantics of data- e.g. mono. There's a Lua interface for accessing this information. _________________
I don't know where I'm going, but I'll figure it out when I get there.
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