debdump.cpp
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 2k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. #include "priv.h"
  2. #include "resource.h"   // IDM_AB_* fir this!
  3. #include "shbrows2.h"
  4. #include "browbar.h"
  5. #include "menuband.h"
  6. #include "mnbase.h"
  7. #include "menusite.h"
  8. #include "menubar.h"
  9. #include "browmenu.h"
  10. #include "mnstatic.h"
  11. #include "mnfolder.h"
  12. #ifdef DEBUG // {
  13. #define DM_FIXME    0       // trace/break when hit unknown guy
  14. struct DBClassInfo {
  15.     int     cbSize;
  16.     TCHAR * pszName;
  17. };
  18. //
  19. // EXTERNALOBJECTS is a macro which simply expands to X(C,0) X(D,1)
  20. // X(E, 2)...
  21. // where C, D, E, ... are classes whose sizes are defined externally.
  22. //
  23. #define EXTERNALOBJECTS 
  24. //    X(CSDWindows, 0)  
  25. //    X(CDesktopBrowser, 1)  
  26. #define TABENT(c)   { SIZEOF(c), TEXT(#c) }
  27. #define X(c, n)  { 0, TEXT(#c) },
  28. struct DBClassInfo DBClassInfoTab[] =
  29. {
  30.     // BUGBUG tons of table entries missing
  31.     // maybe drive off same file as debug extensions dumpers?
  32.     TABENT(CSHELLBROWSER),  // 0
  33.     TABENT(CBrowserBar),    // 1
  34.     TABENT(CMenuBand),
  35.     TABENT(CMenuDeskBar),
  36.     TABENT(CMenuSite),
  37.     TABENT(CFavoritesCallback),
  38.     TABENT(CMenuSFToolbar),
  39.     TABENT(CMenuStaticToolbar),
  40.     TABENT(CMenuData),
  41.     #define NUM_INTERNAL_OBJECTS 11
  42.     EXTERNALOBJECTS // 3...
  43.     { 0 },
  44. };
  45. #undef  TABENT
  46. #undef  X
  47. #define X(c, n) extern "C" extern const int SIZEOF_##c;
  48. EXTERNALOBJECTS
  49. #undef X
  50. //***   DBGetClassSymbolic -- map size to class name (guess)
  51. // NOTES
  52. //  we just take the 1st hit, so if there are multiple classes w/ the
  53. //  same size you get the wrong answer.  if that turns out to be a pblm
  54. //  we can add special-case heuristics for the relevant classes.
  55. //
  56. //  BUGBUG TODO: should use a generic DWORD value/data pair lookup
  57. //  helper func.
  58. //
  59. TCHAR *DBGetClassSymbolic(int cbSize)
  60. {
  61.     struct DBClassInfo *p;
  62. #define X(c, n) 
  63.     DBClassInfoTab[NUM_INTERNAL_OBJECTS+n].cbSize = SIZEOF_##c;
  64.     EXTERNALOBJECTS
  65. #undef X
  66.     for (p = DBClassInfoTab; p->cbSize != 0; p++) {
  67.         if (p->cbSize == cbSize)
  68.             return p->pszName;
  69.     }
  70.     if (DM_FIXME) {
  71.         TraceMsg(DM_FIXME, "DBgcs: cbSize=%d  no entry", cbSize);
  72.         ASSERT(0);
  73.     }
  74.     return NULL;
  75. }
  76. #endif // }