Repository navigation
v3.2.0
What's changed
A second review of the project, platform by platform. The biggest find was on Windows: since v2.0, scanning a 32-bit process from 64-bit Python failed every time. Alongside it came a thread-port leak on macOS, a Linux backend that could write into a different process after the target's pid was reused, and pattern scans that missed overlapping matches. All of it is fixed here, each with a test — including a real 32-bit child process on the Windows CI runners. The release also adds Python 3.14 and 3.15 to the supported and tested versions.
Fixed
- Windows: 32-bit (WOW64) targets work again. A 64-bit Python handed
VirtualQueryExthe 28-byte 32-bitMEMORY_BASIC_INFORMATIONfor a WOW64 target. The kernel only fills the caller's native layout and rejects a smaller buffer, so the region walk hit its failure cap and every scan of a 32-bit process raised. The walk now always uses the host's native struct (#108) - Windows: non-ASCII process and module names. The ANSI Toolhelp32 structs were decoded as UTF-8, so a name with accents came back garbled and
OpenProcess(name=...)missed it. The backend uses the wide (W) API now: process names are exact, and module names are exact for characters in the system's ANSI code page (Toolhelp32 itself builds module entries from ANSI data) (#108) - macOS:
get_threads()no longer leaks thread port rights. It freed the arraytask_threadsreturns but never the send rights inside it, so every call leaked one reference per thread — unbounded for anything polling the thread list. The Mach region structs are also packed to match the kernel headers, and loop bounds read from the target's memory are capped (#108) - macOS: writes to protected pages restore the right protection. The temporary elevation dropped
EXECUTE, and a write crossing into a neighbouring region restored the first region's protection over both.EXECUTEis kept where the kernel allows it, and each region gets its own protection back (#108) - Linux: a reused pid is never written to. The backend addressed the target by pid on every call, so after the target exited, a process that inherited the pid received the writes. Objects now bind to the original process with a pidfd (or its start time where pidfds are unavailable) and raise
ProcessIDNotExistsErroronce it is gone (#108) - Pattern scans find overlapping matches.
90 90over90 90 90returned one match where the exact-value scan returned two. Fixed-width patterns — every IDA-style signature — report overlapping matches now; variable-width regexes keep non-overlapping semantics (#108) search_by_addressesis faster and finds more. It read the whole chunk (up to 256 MiB) around each requested address; it now reads windows around the addresses — 20–150x faster on sparse result sets — and reads a value that runs into an adjacent readable region instead of reportingNone. Programming errors andMemoryErrorpropagate instead of turning intoNone(#108)- MCP: close and shutdown no longer hang. A pointer scan held the session lock for its whole walk and closing waited on it forever. Closing waits at most 5 seconds and leaves the handle to the running call, which stops at its next check — the pointer walk and the refine now have one.
open_processno longer blocks the server's other requests while it attaches, and scan descriptions stay bounded across long refine chains (#108) - App: changing process no longer closes the old handle while a stalled worker may still be using it; the pointer scan's Stop button also ends the path search; the Memory Map on Windows no longer frees regions the app did not allocate (#108)
Changed
- Ordered comparisons of
bytesare lexicographic.BIGGER_THAN,SMALLER_THANandVALUE_BETWEENonbytesfollowed the host byte order, whilestr— and the app's refine step — compared lexicographically, so a first scan and its refine could disagree.bytesnow compares likestr; compare raw numbers of any width asint(#108) - Windows:
free_memoryrefuses memory the object did not allocate unlesssize=is passed, as macOS already did. It used to release any address, including the target's own heap segments and thread stacks (#108) - macOS:
ThreadInfo.tidis the system-wide thread id (whatpthread_threadid_npreturns) instead of the Mach port name: stable across calls, andmain_threadis the real main thread (#108) - MCP: an ambiguous process name hides the candidates the policy denies (reported as
hidden_by_policy) and selects the one that remains; the server's write-confirmation wording no longer claims that every client asks before a write (#108)
Added
- Python 3.14 and 3.15 in the classifiers and the test matrix (Ubuntu and Windows). 3.15 is tested against its release candidate until 3.15.0 is out (#110)
should_stoponscan_pointer_paths: a callable polled during the path search, so a deadline or a cancel button can end a search that runs a long time between two results (#108)- CI builds the documentation with warnings as errors, and the GitHub Actions used by the workflows are on their current major versions (#108, #107)
Install
pip install --upgrade PyMemoryEditor📖 Full documentation: pymemoryeditor.readthedocs.io · MCP guide: pymemoryeditor.readthedocs.io/en/latest/mcp.html
Full Changelog: v3.1.0...v3.2.0