By Nagi
1 void *SearchPattern(void *pStartSearch, DWORD dwSearchLen, char *pPattern, DWORD dwPatternLen) 2 { 3 DWORD dwStartAddr = (DWORD)pStartSearch; 4 DWORD dwEndAddr = dwStartAddr + dwSearchLen - dwPatternLen; 5 6 while (dwStartAddr < dwEndAddr) 7 { 8 bool found = true; 9 10 for (DWORD i = 0; i < dwPatternLen; i++) 11 { 12 char code = *(char *)(dwStartAddr + i); 13 14 if (pPattern[i] != 0x2A && pPattern[i] != code) 15 { 16 found = false; 17 break; 18 } 19 } 20 21 if (found) 22 return (void *)dwStartAddr; 23 24 dwStartAddr++; 25 } 26 27 return 0; 28 }