-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the ability to get a list of memory pages #6
Comments
This would also serve as a base for the solution of an issue from SigScan: |
Perhaps lifting out the code from buffers that does the walk, and doing the page walk in a separate module/library altogether. |
Since |
Also, since |
I'd be willing to shuffle some things around. Essentially I want to lay out the library in a way such that it can be efficiently shared across 9.X was technically supposed to be that, but I have concerns that I put too much functionality into the main Page walking is not a frequent operation either, which is why I'd ideally prefer to throw that into a separate binary. At least that's my take. |
Lots of modding tools require this functionality to perform pattern scans (so that'd be the |
It really depends, there are 3 different classes of modding tools here. There's:
The main library was built for the first of the three. When you're writing regular game mods, you shouldn't really be scanning the heap. If you're after memory which can be anywhere in the heap you must have a very, very specific special use case; for example, finding emulator memory across a huge version range of emulator; or you're building a memory scanner like cheat engine. When writing mods for games, you should instead scan for the code which allocates some specific memory you want. Then either extract the field address that stores the pointer from the code (if it's a static and it's possible), or hook and extract it from the register. Relying on scanning the heap there is very unreliable. The game may update and have different data on the heap, or the user may inject external code (e.g. Shader injectors like ReShade on Windows); so relying on that is not recommended. I'm not against putting this functionality in the core library for 9.X, but it's just additional context. |
Let me give you some context on what exactly I'm trying to achieve. I'm working on an external tool for Team Fortress 2 for advanced Discord Rich Presence on Linux. Let's just focus on the map name for now. The map name field is stored in one of the game modules. Now, here is the thing. On Windows, getting the name would be as simple as pattern scanning in the module itself, considering that the fields before the name field almost always have the same value (and I already found a common pattern). On Linux however, this data mapped just besides the module, but not IN the module range. So, in order to find that specific page, I at the very least need to get the pages list to find the first rw page after the module. Now, say I knew the base and length of that page, SigScan does not provide the functionality to scan custom ranges, which brings us to the other issue.
Wouldn't that only complicate things? If I already have a common pattern, why get it through the code, which will most likely change in the future either way? |
Sorry for delay, was eating.
A sigscan on the code would fail either if:
Both of these are highly unlikely.
That said, I think that without running code inside the game process; which I would not recommend for an online game, sigscanning is probably the best option you have; if you can't pull an address without grabbing it from the game's assembly. So you're probably doing the right thing here. Do remember though that the page the name may be in could change due to changes in external unrelated code. Developers usually don't manually allocate pages after all, so these pages really are what the implementation of In any case, I wouldn't mind accepting a PR for doing a page walk (via enumerator preferably, as pages change frequently). The code in |
My proposal is to add functions to
Memory
andExternalMemory
that allow for iterating through all the available memory pages to get their details such as start address, length and flags.If I get some free time, I might start working on a PR, but for now I'm creating this issue for discussion.
The text was updated successfully, but these errors were encountered: