5dword
FindInstructionSequence(
char *SearchPattern,
char *SearchMask, dword StartAddress, dword EndAddress,
int EntryPointOffset,
bool SearchForPrevADDIUSP)
10 dword i, p, NrOfInstr;
13 if(!StartAddress || !EndAddress || (strlen(SearchPattern) != strlen(SearchMask)))
21 for(i = 0; i < strlen(SearchPattern); i += 9)
23 SP[NrOfInstr] = strtoul(&SearchPattern[i], NULL, 16);
24 SM[NrOfInstr] = strtoul(&SearchMask[i], NULL, 16);
25 SP[NrOfInstr] &= SM[NrOfInstr];
30 for(p = StartAddress; p < EndAddress; p += 4)
33 for(i = 0; i < NrOfInstr; i++)
35 if(((* (dword *) (p + (i << 2))) & SM[i]) != SP[i])
44 if(SearchForPrevADDIUSP)
47 while((((*(dword *) p) & 0xffff0000) != 0x27bd0000) && (((*(dword *) p) &
CMD_MASK) !=
JMP_CMD))
61 return p + (EntryPointOffset << 2);
dword FindInstructionSequence(char *SearchPattern, char *SearchMask, dword StartAddress, dword EndAddress, int EntryPointOffset, bool SearchForPrevADDIUSP)