-
Notifications
You must be signed in to change notification settings - Fork 10
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
64bit process reading from 32bit process copies too large addresses. #5
Comments
A fix (for Windows only. Issue remains on Linux/macOS) is here: Kiiyya@707eae2 But since it's based on #4 I won't open a PR yet. |
I think you might have missed that `Architecture`s work on `ProcessHandle`s and should be called on them.
So some working code for you might be something like:
```rs
let process_handle = get_pid("32-bit.exe").try_into_process_handle()?;
let process_handle = process_handle.set_arch(Architecture::Arch32Bit);
let member = ...
```
The reason for this structure is that even though you can (likely) determine the correct architecture of a Windows program by looking for `SysWOW64`, I don't think that the same can be done for Linux and OSX and I'm not sure about trying to include functionality that doesn't work on all supported OSes and may not even function correctly across different architectures (e.g. does SysWOW64 still exist to show 32-bit programs on Windows on ARM?).
Please let me know if this solves your issue or if you think that there might still be room for improvement on handling varying architectures.
|
I think a functionality to get the architecture of an executable/process would be super convenient. Setting it to native by default creates issues like I ran into, debugging things which are difficult to debug, since most of the time copying 8 byte pointers instead of 4 bytes pointers will work just fine (if there's an extra few zeros just by chance), but then some other times it will fail. And it's not obvious what causes that. Imagine users just assuming the library knows what it's doing. Also, at least trying to consult IsWow64Process is better than just blindly choosing native architecture. I'll have a look into whether determining arch will be possible on Linux on the weekend. I'd suggest something like As far as I know, there exists IsWow64Process2 which had something mentioned about ARM, but I'll look into that on the weekend. |
I was debugging why something isn't working, and then I realized
CopyAddress::get_offset()
is copying too many bytes. My program is 64bit, whereas the game I read from is 32bit.I believe the culprit is this:
rs-process-memory/src/windows.rs
Line 46 in 5bd1055
from_native()
here? I thought the whole point of having Architecture was to support reading from 32bit processes? Gonna work on a fix while waiting for replies.If I miss something, sorry, I'm new to rust :).
The text was updated successfully, but these errors were encountered: