Enums

ScanTypesEnum

class ScanTypesEnum

Comparison modes for search_by_value() and search_by_value_between().

from PyMemoryEditor import ScanTypesEnum
MemberValueMatches when…
EXACT_VALUE0value == target (default)
NOT_EXACT_VALUE1value != target
BIGGER_THAN2value > target
SMALLER_THAN3value < target
BIGGER_THAN_OR_EXACT_VALUE4value ≥ target
SMALLER_THAN_OR_EXACT_VALUE5value ≤ target
VALUE_BETWEEN6min ≤ value ≤ max (used by search_by_value_between)
NOT_VALUE_BETWEEN7value < min or value > max

Example

from PyMemoryEditor import OpenProcess, ScanTypesEnum

with OpenProcess(process_name="game.exe") as process:
    for address in process.search_by_value(int, value=1000, scan_type=ScanTypesEnum.BIGGER_THAN):
        print(hex(address))

ProcessOperationsEnum (Windows only)

class ProcessOperationsEnum

Bitmask of Windows process access rights, passed as the permission= argument of OpenProcess on Windows.

Bitmask of process access rights. Defined as IntFlag so members can be combined with |:

from PyMemoryEditor import ProcessOperationsEnum

mask = (
    ProcessOperationsEnum.PROCESS_VM_READ
    | ProcessOperationsEnum.PROCESS_QUERY_INFORMATION
)
MemberHexRequired for
PROCESS_TERMINATE0x0001TerminateProcess
PROCESS_CREATE_THREAD0x0002Creating a thread
PROCESS_VM_OPERATION0x0008Allocating / freeing / changing page protection
PROCESS_VM_READ0x0010ReadProcessMemory
PROCESS_VM_WRITE0x0020WriteProcessMemory
PROCESS_DUP_HANDLE0x0040Duplicating a handle
PROCESS_CREATE_PROCESS0x0080Creating a process
PROCESS_SET_QUOTA0x0100Setting memory limits
PROCESS_SET_INFORMATION0x0200Setting priority class, etc.
PROCESS_QUERY_INFORMATION0x0400VirtualQueryEx, token info
PROCESS_SUSPEND_RESUME0x0800Suspend/resume the process
PROCESS_QUERY_LIMITED_INFORMATION0x1000Limited info queries
PROCESS_SET_LIMITED_INFORMATION0x2000Limited info set
PROCESS_ALL_ACCESS0x1FFFFFEverything

Default permission

The default mask used by OpenProcess on Windows is:

PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_VM_OPERATION | PROCESS_QUERY_INFORMATION

This is enough for both read and write operations plus region enumeration (VirtualQueryEx needs PROCESS_QUERY_INFORMATION).


MemoryProtectionsEnum (Windows only)

class MemoryProtectionsEnum

The Win32 PAGE_* page-protection constants.

The Win32 PAGE_* constants. Used as the permission= argument of allocate_memory and surfaced in region["struct"].Protect.

from PyMemoryEditor.win32.enums.memory_protections import MemoryProtectionsEnum
MemberHexMeaning
PAGE_NOACCESS0x01Disables all access.
PAGE_READONLY0x02Read-only.
PAGE_READWRITE0x04Read + write.
PAGE_WRITECOPY0x08Copy-on-write.
PAGE_EXECUTE0x10Execute-only.
PAGE_EXECUTE_READ0x20Read + execute.
PAGE_EXECUTE_READWRITE0x40Read + write + execute. (allocate_memory default)
PAGE_EXECUTE_WRITECOPY0x80Read + execute + copy-on-write.
PAGE_GUARD0x100Pages become guard pages.
PAGE_NOCACHE0x200Non-cachable.
PAGE_WRITECOMBINE0x400Write-combined.

Convenience composites

MemberIncludes
PAGE_READABLEEvery PAGE_* that allows reads.
PAGE_READWRITEABLEEvery PAGE_* that allows writes.