Here, my pattern function:
External AoB.
Code:
Private Function pScan(ByVal startadress As Long, ByVal maxbytestoscan As Integer, ByVal pattern() As String, ByVal mask() As String) As Long
For i As Integer = 0 To maxbytestoscan
Dim n() As Byte = ReadMemory(startadress + i, pattern.Length)
For k As Integer = 0 To n.Length - 1
If mask(k) = "X" Then
If pattern(k) = n(k) Then
If k = n.Length - 1 Then
Return startadress + i
Else
Continue For
End If
Else
Exit For
End If
Else
Continue For
End If
Next
Next
Return 0
End Function