From 7af0c81cd9d85a29acea7499645466dbf5a04a5a Mon Sep 17 00:00:00 2001 From: Louis M Date: Wed, 16 Jul 2025 21:36:35 -0400 Subject: [PATCH] Fixing search_by_value on Windows --- PyMemoryEditor/win32/enums/memory_protections.py | 2 +- PyMemoryEditor/win32/functions.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/PyMemoryEditor/win32/enums/memory_protections.py b/PyMemoryEditor/win32/enums/memory_protections.py index 6ee82ae..e99d120 100644 --- a/PyMemoryEditor/win32/enums/memory_protections.py +++ b/PyMemoryEditor/win32/enums/memory_protections.py @@ -57,7 +57,7 @@ class MemoryProtectionsEnum(Enum): PAGE_READWRITE = 0x04 # Indicates memory page is readable. (Custom constant) - PAGE_READABLE = PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_READWRITE + PAGE_READABLE = PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_READWRITE | PAGE_READONLY # Indicates memory page is readable and writeable. (Custom constant) PAGE_READWRITEABLE = PAGE_EXECUTE_READWRITE | PAGE_READWRITE diff --git a/PyMemoryEditor/win32/functions.py b/PyMemoryEditor/win32/functions.py index 6cdf0bc..64c0b65 100644 --- a/PyMemoryEditor/win32/functions.py +++ b/PyMemoryEditor/win32/functions.py @@ -174,7 +174,8 @@ def SearchAddressesByValue( # Only committed, non-shared and readable memory pages. if region["struct"].State != MemoryAllocationStatesEnum.MEM_COMMIT.value: continue - if region["struct"].Type != MemoryTypesEnum.MEM_PRIVATE.value: continue + if (region["struct"].Type != MemoryTypesEnum.MEM_PRIVATE.value and + region["struct"].Type != MemoryTypesEnum.MEM_IMAGE.value): continue if region["struct"].Protect & MemoryProtectionsEnum.PAGE_READABLE.value == 0: continue # If writeable_only is True, checks if the memory page is writeable.