Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
4.4 KiB

  1. /*
  2. * SnapTrace.cxx
  3. *
  4. *
  5. * Copyright (c) 1998-1999 Microsoft Corporation
  6. *
  7. * PURPOSE: Support functions for debug trace
  8. *
  9. *
  10. * OWNER: ptousig
  11. */
  12. #include "headers.hxx"
  13. #ifdef DBG
  14. // ScFromHr(E_UNEXPECTED);
  15. CTraceTag tagBaseSnapinNotify(_T("BaseMMC"), _T("Notify"));
  16. CTraceTag tagBaseSnapinRegister(_T("BaseMMC"), _T("Register"));
  17. CTraceTag tagBaseSnapinISnapinAbout(_T("BaseMMC"), _T("ISnapinAbout"));
  18. CTraceTag tagBaseSnapinIComponent(_T("BaseMMC"), _T("IComponent"));
  19. CTraceTag tagBaseSnapinIComponentQueryDataObject(_T("BaseMMC"), _T("IComponent::QueryDataObject"));
  20. CTraceTag tagBaseSnapinIComponentGetDisplayInfo(_T("BaseMMC"), _T("IComponent::GetDisplayInfo"));
  21. CTraceTag tagBaseSnapinIComponentData(_T("BaseMMC"), _T("IComponentData"));
  22. CTraceTag tagBaseSnapinIComponentDataQueryDataObject(_T("BaseMMC"), _T("IComponentData::QueryDataObject"));
  23. CTraceTag tagBaseSnapinIComponentDataGetDisplayInfo(_T("BaseMMC"), _T("IComponentData::GetDisplayInfo"));
  24. CTraceTag tagBaseSnapinIResultOwnerData(_T("BaseMMC"), _T("IResultOwnerData"));
  25. CTraceTag tagBaseSnapinIDataObject(_T("BaseMMC"), _T("IDataObject"));
  26. CTraceTag tagBaseSnapinISnapinHelp(_T("BaseMMC"), _T("ISnapinHelp"));
  27. CTraceTag tagBaseSnapinIExtendContextMenu(_T("BaseMMC"), _T("IExtendContextMenu"));
  28. CTraceTag tagBaseSnapinIExtendPropertySheet(_T("BaseMMC"), _T("IExtendPropertySheet"));
  29. CTraceTag tagBaseSnapinIResultDataCompare(_T("BaseMMC"), _T("IResultDataCompare"));
  30. CTraceTag tagBaseSnapinIPersistStreamInit(_T("BaseMMC"), _T("IPersistStreamInit"));
  31. CTraceTag tagBaseSnapinDebugDisplay(_T("BaseMMC"), _T("Debug Display"));
  32. CTraceTag tagBaseSnapinDebugCopy(_T("BaseMMC"), _T("Copy to WordPad"));
  33. CTraceTag tagBaseSnapinItemTracker(_T("BaseMMC"), _T("Item Tracker"));
  34. CTraceTag tagBaseMultiSelectSnapinItemTracker(_T("BaseMMC"), _T("Multiselect Item Tracker"));
  35. #define CASE_DEBUG_NAME(a) case a: return _T(#a)
  36. tstring SzGetDebugNameOfHr(HRESULT hr)
  37. {
  38. //
  39. // First try some of the common HRESULTs
  40. //
  41. switch (hr)
  42. {
  43. CASE_DEBUG_NAME(S_FALSE);
  44. CASE_DEBUG_NAME(E_NOTIMPL);
  45. CASE_DEBUG_NAME(DV_E_FORMATETC);
  46. CASE_DEBUG_NAME(E_INVALIDARG);
  47. CASE_DEBUG_NAME(DV_E_TYMED);
  48. CASE_DEBUG_NAME(S_OK);
  49. CASE_DEBUG_NAME(E_UNEXPECTED);
  50. default:
  51. //
  52. // If we reached this point we don't know what the HRESULT is.
  53. // We can still say wether it's an error code or not.
  54. //
  55. if (SUCCEEDED(hr))
  56. return TEXT("Unknown Success Code");
  57. else
  58. return TEXT("Unknown Error Code");
  59. }
  60. }
  61. tstring SzGetDebugNameOfDATA_OBJECT_TYPES(DATA_OBJECT_TYPES type)
  62. {
  63. switch (type)
  64. {
  65. CASE_DEBUG_NAME(CCT_SCOPE);
  66. CASE_DEBUG_NAME(CCT_RESULT);
  67. CASE_DEBUG_NAME(CCT_SNAPIN_MANAGER);
  68. CASE_DEBUG_NAME(CCT_UNINITIALIZED);
  69. default:
  70. return _T("Unknown");
  71. }
  72. }
  73. tstring SzGetDebugNameOfMMC_NOTIFY_TYPE(MMC_NOTIFY_TYPE event)
  74. {
  75. switch (event)
  76. {
  77. CASE_DEBUG_NAME(MMCN_ACTIVATE);
  78. CASE_DEBUG_NAME(MMCN_ADD_IMAGES);
  79. CASE_DEBUG_NAME(MMCN_BTN_CLICK);
  80. CASE_DEBUG_NAME(MMCN_CLICK);
  81. CASE_DEBUG_NAME(MMCN_COLUMN_CLICK);
  82. CASE_DEBUG_NAME(MMCN_CONTEXTMENU);
  83. CASE_DEBUG_NAME(MMCN_CUTORMOVE);
  84. CASE_DEBUG_NAME(MMCN_DBLCLICK);
  85. CASE_DEBUG_NAME(MMCN_DELETE);
  86. CASE_DEBUG_NAME(MMCN_DESELECT_ALL);
  87. CASE_DEBUG_NAME(MMCN_EXPAND);
  88. CASE_DEBUG_NAME(MMCN_EXPANDSYNC);
  89. CASE_DEBUG_NAME(MMCN_HELP);
  90. CASE_DEBUG_NAME(MMCN_MENU_BTNCLICK);
  91. CASE_DEBUG_NAME(MMCN_MINIMIZED);
  92. CASE_DEBUG_NAME(MMCN_PASTE);
  93. CASE_DEBUG_NAME(MMCN_PROPERTY_CHANGE);
  94. CASE_DEBUG_NAME(MMCN_QUERY_PASTE);
  95. CASE_DEBUG_NAME(MMCN_REFRESH);
  96. CASE_DEBUG_NAME(MMCN_REMOVE_CHILDREN);
  97. CASE_DEBUG_NAME(MMCN_RENAME);
  98. CASE_DEBUG_NAME(MMCN_SELECT);
  99. CASE_DEBUG_NAME(MMCN_SHOW);
  100. CASE_DEBUG_NAME(MMCN_VIEW_CHANGE);
  101. CASE_DEBUG_NAME(MMCN_SNAPINHELP);
  102. CASE_DEBUG_NAME(MMCN_CONTEXTHELP);
  103. CASE_DEBUG_NAME(MMCN_INITOCX);
  104. CASE_DEBUG_NAME(MMCN_FILTER_CHANGE);
  105. CASE_DEBUG_NAME(MMCN_FILTERBTN_CLICK);
  106. CASE_DEBUG_NAME(MMCN_RESTORE_VIEW);
  107. CASE_DEBUG_NAME(MMCN_PRINT);
  108. CASE_DEBUG_NAME(MMCN_PRELOAD);
  109. CASE_DEBUG_NAME(MMCN_LISTPAD);
  110. default:
  111. return _T("Unknown");
  112. }
  113. }
  114. #else
  115. tstring SzGetDebugNameOfHr(HRESULT hr){return _T("");}
  116. //
  117. #endif