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.

49 lines
1.4 KiB

  1. //+-------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1999
  5. //
  6. // File: nodemgrdebug.h
  7. //
  8. // Contents: Debugging helpers for MMC & Snapins.
  9. //
  10. // History: 10-May-2000 AnandhaG Created
  11. //
  12. //--------------------------------------------------------------------
  13. #pragma once
  14. /*+-------------------------------------------------------------------------*
  15. *
  16. * TraceSnapinException
  17. *
  18. * PURPOSE: When a snapin throws an exception and is caught by MMC this
  19. * function traces that exception.
  20. *
  21. * PARAMETERS:
  22. * CLSID& clsidSnapin - Class id of the offending snapin, used to get name.
  23. * LPCTSTR szFunctionName - the method in snapin called by mmc.
  24. * int event - MMC_NOTIFY_EVENT
  25. *
  26. * RETURNS:
  27. * void
  28. *
  29. *+-------------------------------------------------------------------------*/
  30. inline void TraceSnapinException(const CLSID& clsidSnapin, LPCTSTR szFunctionName, int event)
  31. {
  32. #ifdef DBG
  33. SC sc = E_FAIL;
  34. sc.SetFunctionName(szFunctionName);
  35. tstring strSnapinName = TEXT("Unknown");
  36. GetSnapinNameFromCLSID(clsidSnapin, strSnapinName);
  37. sc.SetSnapinName(strSnapinName.data());
  38. WTL::CString strErrorMessage;
  39. strErrorMessage.Format(TEXT("threw an exception during the notify event : 0x%x\n"), event);
  40. TraceSnapinError(strErrorMessage, sc);
  41. sc.Clear(); // dont want sc to trace again.
  42. #endif
  43. }