** 的没有 ??的有
[Asm] 纯文本查看 复制代码
//x64 支持
//参数:扫描头,扫描尾,搜索字符串 ,例 4C 8D 45 ?? 48 8B DA ?? 89 ?? B7
DWORD64 signature(DWORD64 scanbase , DWORD64 scanend, const char* szSignature)
{
DWORD64 startAddress = scanbase;
DWORD64 endAddress = scanend;
const char* pat = szSignature;
DWORD64 firstMatch = 0;
for (DWORD64 pCur = startAddress; pCur < endAddress; pCur++) {
if (!*pat) return firstMatch;
if (*(PBYTE)pat == '\?' || *(BYTE*)pCur == getByte(pat)) {
if (!firstMatch) firstMatch = pCur;
if (!pat[2]) return firstMatch;
if (*(PWORD)pat == '\?\?' || *(PBYTE)pat != '\?') pat += 3;
else pat += 2;
}
else {
pat = szSignature;
firstMatch = 0;
}
}
return NULL;
} |