AI Memory: Pattern Scanning
AI-first map of pattern helpers, signatures, and offset behavior in the memory API.
Memory / Pattern Scanning Map
Reference map for signature helpers, BytePattern / StringPattern,
single-pattern vs multi-pattern search behavior, and how pattern offsets fit
into memory workflows.
User Intents
- Scan a module for a stable byte signature.
- Build a signature with wildcards.
- Mark a point of interest inside a match with
^. - Find one pattern or scan several in one pass.
- Convert a module-relative offset into a virtual address.
- Use signatures as anchors before reading pointer chains or structs.
Concept Model
BytePatternis the core signature representation.StringPatternis the compatibility wrapper around template-based patterns.IMemoryis the usual scan surface, often obtained throughMemoryOfModule(...).FindOffset(...)/GetOffset(...)return a single raw match start.FindOffsets(...)/GetOffsets(...)scan multiple patterns and return offsets keyed by pattern.PatternOffsetis metadata stored on the pattern, not automatically applied by every helper.
API Details
BytePattern.FromPattern(...)- exact byte-sequence signature.BytePattern.FromTemplate(...)- template-based signature with hex bytes, wildcards, and optional^.BytePattern.FromMaskedPattern(...)- byte array plus explicitx/?mask.StringPattern- compatibility layer for template signatures.MemoryExtensionsForPatterns- pattern-scan helpers onIMemory.FindOffset(...)- returns the raw match start or-1.GetOffset(...)- returns the raw match start or throws.FindOffsets(...)- returns all requested pattern offsets keyed by pattern.GetOffsets(...)- same asFindOffsets(...), but throws on missing patterns.PatternOffset- pattern-relative index marked by^inside a template.
Common Flows
-
Scan a module:
- create a process reader.
- narrow scope with
MemoryOfModule(...). - build
BytePatternorStringPattern. - call
FindOffset(...)/GetOffset(...). - add
memory.BaseAddressif you need an absolute address.
-
Scan a RIP-relative instruction:
- build a template with
^at the displacement bytes. - use a singular helper to get the raw match start.
- add
pattern.PatternOffsetyourself to reach the marked field. - decode the displacement and compute the final address.
- build a template with
-
Scan multiple anchors:
- create several patterns.
- call
FindOffsets(...)/GetOffsets(...). - read the resulting dictionary by pattern instance.
Single vs Multi-Pattern Behavior
FindOffset(...)andGetOffset(...)return the raw match start.FindOffsets(...)andGetOffsets(...)return offsets withPatternOffsetalready applied.- If you used
^with a singular helper, addpattern.PatternOffsetyourself.
using var process = LocalProcess.ByProcessName("pathofexile");
using var memory = process.MemoryOfModule("pathofexile.exe");
var playerPattern = BytePattern.FromTemplate("55 8B ?? ^ EC 00");
var targetPattern = BytePattern.FromTemplate("BB AA ??");
var matchOffset = memory.FindOffset(playerPattern);
var displacementOffset = matchOffset >= 0
? matchOffset + playerPattern.PatternOffset
: -1;
var offsetsByPattern = memory.FindOffsets(playerPattern, targetPattern);
var criticalMatchOffset = memory.GetOffset(playerPattern);
var criticalDisplacementOffset =
criticalMatchOffset + playerPattern.PatternOffset;
Supported Signature Formats
- exact byte arrays
- hex templates like
48 8B ?? 74 0A - wildcards with
?/?? - C-style templates like
\x48\x8B\xC0 - masked byte patterns with
xand? - templates with
^to mark a pattern-relative point of interest
Prefer
- Prefer scanning a specific module instead of the whole process.
- Prefer templates with wildcards over brittle exact signatures when bytes are unstable.
- Prefer
Get*helpers when a missing pattern means an incompatible target. - Prefer treating signatures as anchors before pointer-chain or struct reads.
Avoid
- Avoid assuming the returned offset is always the
^position. - Avoid using
FindOffset(...)with multiple patterns; useFindOffsets(...). - Avoid scanning whole-process memory when you know the target module.
- Avoid extremely short signatures that can match unrelated code or data.
Research Anchors
BytePatternStringPatternPatternOffsetFromTemplateFromMaskedPatternFindOffsetGetOffsetFindOffsetsGetOffsetsMemoryExtensionsForPatternsMemoryOfModule
Search Synonyms
- pattern scan
- signature scan
- byte pattern
- byte signature
- wildcard pattern
- masked pattern
- memory signature
- pattern offset
- caret offset
BytePatternStringPattern
Related Maps
processes.md../../memory-api/pattern-scanning.md../../memory-api/getting-started.md