// vim: ft=cpp sw=4 ts=4 et /* (C) 2003-2008 Willem Jan Hengeveld * * Web: http://www.xs4all.nl/~itsme/projects/ida/ */ #include // this script tries to find unintended references // for instance constants which were incorrectly interpreted as offsets by IDA static fisstrange(f_start) { auto ea, f_end, x, i, is_c; auto next; next=0; f_end= FindFuncEnd(f_start); ea= NextNotTail(f_start); while (eaScreenEA() && next==0) { next= ea; } break; } x= RnextB0(ea, x); } x= DfirstB(ea); is_c= isCode(GetFlags(ea)); while (x!=BADADDR) { if (x < f_start || f_end <= x) { if (is_c || isData(GetFlags(x))) { Message("strange data ref: %08lx %s\n", ea, Name(ea)); if (ea>ScreenEA() && next==0) { next= ea; } break; } } x= DnextB(ea, x); } ea= NextNotTail(ea); } if (next) { Jump(next); return 1; } return 0; } static findstrange(void) { auto ea; ea= ScreenEA(); ea= NextFunction(ea); while (ea!=BADADDR) { if (fisstrange(ea)) { Message("Function %08lx %s\n", ea, Name(ea)); return; } ea= NextFunction(ea); } Message("No strange refs found after cursor line\n"); }