home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Mammon_ / entrytree.idc < prev    next >
Text File  |  2000-05-25  |  1KB  |  48 lines

  1.  
  2. // Entrytree.idc code per mammon_ ("use, steal, change, but do not claim.")
  3. // Outputs to the message window a recursive tree of the calls from each entry point of the file
  4.  
  5. #include <idc.idc>
  6.  
  7. static OutputLine(ea, x, nest){
  8.     auto j;
  9.     for ( j = 0; j <= nest; j = j + 1) {
  10.         Message("   ");
  11.     }
  12.     Message(atoa(ea) + " refers to " + Name(x) + " : " + atoa(x) + "\n");
  13. }
  14. static GetXrefs(ea, nest){
  15.     auto x;
  16.     nest = nest + 1;
  17.     x = Rfirst0(ea);
  18.     if ( x != BADADDR) {
  19.     OutputLine(ea, x, nest);
  20.     GetXrefs(x, nest);
  21.     x = Rnext0(ea,x);
  22.     }
  23.     while ( x != BADADDR) {
  24.         OutputLine(ea, x, nest);
  25.         GetXrefs(x, nest);
  26.         x = Rnext0(ea,x);
  27.     }
  28.     nest = nest - 1;
  29. }
  30.  
  31. static main(){
  32.     auto ea, x, i, nest, f_end, EPOrd;
  33.     nest = -1;
  34.     Message("\n*** Code References from " + GetFunctionName(ea) + " : "  + atoa(ea) + "\n");
  35.     for ( i = 0; i < GetEntryPointQty(); i = i + 1) {
  36.         Message("Entry Point " + ltoa(i, 10) + "\n");
  37.         EPOrd = GetEntryOrdinal(i);
  38.         ea = GetEntryPoint(EPOrd);
  39.         f_end = FindFuncEnd(ea);
  40.         for ( ea ; ea <= f_end; ea = NextAddr(ea) ) {
  41.             GetXrefs(ea, nest);
  42.         }
  43.     }
  44.     Message("End of output. \n");
  45. }
  46.  
  47.  
  48.