srounet / Pymem

A python library for windows, providing the needed functions to start working on your own with memory editing.
MIT License
303 stars 45 forks source link

Fix scan_pattern_page read bytes out of range. #112

Closed SakuraHentai closed 1 week ago

SakuraHentai commented 8 months ago

fix #111

jmctune commented 8 months ago

With this patched in, I'm unfortunately still receiving WinApi 299 errors from read_bytes.

SakuraHentai commented 8 months ago

With this patched in, I'm unfortunately still receiving WinApi 299 errors from read_bytes.

Is your system is x64, and the target process is x86?

jmctune commented 8 months ago

Is your system is x64, and the target process is x86?

Yes, that is correct. I'm using a 32-bit version of Python 3.11 as well.

SakuraHentai commented 8 months ago

Is your system is x64, and the target process is x86?

Yes, that is correct. I'm using a 32-bit version of Python 3.11 as well.

I just read your library code, it is scanning memory directly with pattern_scan_all, there starts with 0 that should be no offset problem, it is probably caused by other places.

But I've tried the 32-bit process on my computer and it doesn't reproduce it, sorry can't help you.

jmctune commented 8 months ago

Yep, it's nothing fancy. Just a class that's wrapping pattern_scan_all.

I have a few functions that will run a scan indefinitely. It could work for minutes or hours, but it will eventually throw a 299. No changes to the pattern, but the exception is in my linked mention above.

It's not pattern_scan_all itself, but scan_pattern_page, which is called from above. As it's iterating over the pages, there's one page that trips it up while it's executing read_bytes over the pages.

SakuraHentai commented 8 months ago

Yep, it's nothing fancy. Just a class that's wrapping pattern_scan_all.

I have a few functions that will run a scan indefinitely. It could work for minutes or hours, but it will eventually throw a 299. No changes to the pattern, but the exception is in my linked mention above.

It's not pattern_scan_all itself, but scan_pattern_page, which is called from above. As it's iterating over the pages, there's one page that trips it up while it's executing read_bytes over the pages.

Oh, I thought it reported an error on first run.

You can ignore this error, as the program may be freeing memory or switching page properties.

srounet commented 7 months ago

@StarrFox what's your thoughts on this ?

StarrFox commented 7 months ago

@StarrFox what's your thoughts on this ?

seems fine to me