Skip to content
nyfrk edited this page Aug 22, 2020 · 1 revision

FindPattern function

Scans the virtual address space for a byte pattern and returns the address of the first match.

Syntax

UINT32 FindPattern(
	UINT32 startAddr, 
	LPCSTR pattern, 
	UINT32 endAddr
);

Parameters

startAddr

The address where to start searching. Pass 0 (zero) if you wish to process the entire address space. If you wish to find a match within a module, pass the HMODULE to the startAddr parameter. If you want to scan the currents process image, pass the return value of GetModuleHandleA( NULL ).

pattern

The pattern to search for. It is a ascii c string containing of space separated hex numbers. For example "12 34 FC 1F C3 A0 CC". Use questionmarks (?) to wildcard bytes. For example "12 34 ? 1F C3 ? CC".

endAddr

Do not search at addresses greater or equal to the endAddr. (endAddr is excluded). The search is stopped when reaching this address and FindPattern will return 0 (zero).

Return value

If a match has been found the address to the first byte of the match is returned. Otherwise 0 (zero) is returned.

Remarks

none

Requirements

Minimum API Level 1
Target Edition Any
Header S4ModApi.h
Library settlers4api.lib
DLL settlers4api.dll

See also

Clone this wiki locally