hlsdk

VTableWalk

Apr 15th, 2011
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1.  
  2. //
  3. // - IDA Pro script -
  4. // Name: VTableWalk.idc
  5. // Desc: Attempts to determine vtable function count and encourages IDA to create functions at those function locations
  6. //
  7. // Ver: 1.0a - October 13, 2010 - HL-SDK [TEAM METALSLAVE]
  8. //
  9.  
  10. #include <idc.idc>
  11.  
  12. static GetNumMethods(vtbl)
  13. {
  14. auto a, x;
  15. a = 0;
  16. x = Dword(vtbl + a);
  17.  
  18. while ((x) && (x != BADADDR) && (Dword(x) != BADADDR))
  19. {
  20. a = a + 4;
  21. x = Dword(vtbl + a);
  22. }
  23. return (a-4) / 4;
  24. }
  25.  
  26. static ParseVtbl1()
  27. {
  28. auto a, b, c;
  29. a = ScreenEA();
  30. b = GetNumMethods(a);
  31. Message("%d Vfuncs found\n", b);
  32. for (c = a; c < a + (b*4); c = c + 4)
  33. {
  34. if (c != BADADDR)
  35. {
  36. Message("Trying to make Function at: %X\n", c);
  37. MakeData(c, FF_DWRD, 4, 0);
  38. }
  39. }
  40.  
  41. }
  42.  
  43. static main()
  44. {
  45. AddHotkey("Alt-F7","ParseVtbl1");
  46. Message("Use Alt-F7 to parse vtable\n");
  47. }
Advertisement
Add Comment
Please, Sign In to add comment