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
private long pScan(long startadress, int maxbytestoscan, string[] pattern, string[] mask)
{
for (int i = 0; i <= maxbytestoscan; i++) {
byte[] n = ReadMemory(startadress + i, pattern.Length);
for (int k = 0; k <= n.Length - 1; k++) {
if (mask[k] == "X") {
if (pattern[k] == n[k]) {
if (k == n.Length - 1) {
return startadress + i;
} else {
continue;
}
} else {
break; // TODO: might not be correct. Was : Exit For
}
} else {
continue;
}
}
}
return 0;
}