Skip to content

feat: resolve file-backed paths for memory regions on Windows and macOS#65

Merged
JeanExtreme002 merged 2 commits into
mainfrom
jeanextreme002/region-file-path
Jun 7, 2026
Merged

feat: resolve file-backed paths for memory regions on Windows and macOS#65
JeanExtreme002 merged 2 commits into
mainfrom
jeanextreme002/region-file-path

Conversation

@JeanExtreme002

Copy link
Copy Markdown
Owner

Populates MemoryRegion.path with the backing file path on Windows and macOS, matching the existing Linux behavior.

Changes

  • Windows: uses GetMappedFileNameW from psapi.dll to get the NT device path (e.g. \\Device\\HarddiskVolume3\\Windows\\System32\\ntdll.dll).
  • macOS: uses proc_regionfilename to get the mapped file path.
  • make_region: now accepts an optional path keyword argument that overrides the struct-based lookup (used by Win32 and macOS backends).
  • Tests: adds integration tests validating region enumeration and path resolution against the current process.

Motivation

Previously only Linux exposed the file-backed path for memory regions (from /proc/<pid>/maps). Windows and macOS left the field empty. This change brings parity across all three platforms, which is useful for the memory map dialog, module identification, and filtering.

Add GetMappedFileNameW (psapi.dll) on Windows and proc_regionfilename on
macOS to populate the MemoryRegion.path field with the backing file path.

- win32/functions.py: import psapi, add _get_mapped_filename helper
- macos/functions.py: add _get_region_filename helper using proc_regionfilename
- macos/libsystem.py: declare proc_regionfilename binding
- macos/process.py: pass pid to get_memory_regions
- process/region.py: make_region accepts a path kwarg overriding struct lookup
- tests/process/test_memory_region.py: integration tests for region enumeration
  and path resolution
@github-actions github-actions Bot added win32 Windows backend changes (PyMemoryEditor/win32/) macOS macOS backend changes (PyMemoryEditor/macos/) lib Library changes (PyMemoryEditor/) tests Test changes (tests/) labels Jun 7, 2026
@JeanExtreme002 JeanExtreme002 merged commit f877857 into main Jun 7, 2026
17 checks passed
@github-actions github-actions Bot deleted the jeanextreme002/region-file-path branch June 7, 2026 16:26
JeanExtreme002 added a commit that referenced this pull request Jun 7, 2026
…#66)

The path field documentation still described it as Linux-only,
but #65 added GetMappedFileNameW (Windows) and proc_regionfilename
(macOS) support. Update the API reference, guide table and
make_region signature to match the current implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib Library changes (PyMemoryEditor/) macOS macOS backend changes (PyMemoryEditor/macos/) tests Test changes (tests/) win32 Windows backend changes (PyMemoryEditor/win32/)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant