Search Memory Pattern
Posted: Sat Oct 14, 2023 3:16 pm
; Hello team
; I'm trying to search the Current Process Memory for a certain pattern.
; I'm trying since yeasterday PeekS & PeekL to do the comparsion but both didn't work.
; Pease help.
// Code Tags added (Kiffi)
; I'm trying to search the Current Process Memory for a certain pattern.
; I'm trying since yeasterday PeekS & PeekL to do the comparsion but both didn't work.
; Pease help.
Code: Select all
Procedure SearchMemoryPattern()
Pattern.s = "E821C2000085C0741B" ; Pattern to search in Memory
hModule = GetModuleHandle_(0) ; Working with Current Process Memory
StartAddress = hModule
EndAddress = hModule + 10000
PatternLen = Len(Pattern) ; Get the size of the Pattern
MemoryBuffer = AllocateMemory(PatternLen) ; Allocate a buffer to read memory into
For MemoryAddress = StartAddress To EndAddress ; Loop through memory to search for the Pattern
CopyMemory(MemoryAddress, MemoryBuffer, PatternLen)
MemoryData.s = PeekS(MemoryBuffer, PatternLen) ; Doent give expected values (Note:PeekL doesnt cover the whole Pattern Length)
If MemoryData = Pattern
MessageRequester("", "Pattern found at address: " + Hex(MemoryAddress)) ; Pattern found!
EndIf
Next
FreeMemory(MemoryBuffer) ; Free the allocated buffer
EndProcedure