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.

87 lines
2.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: T R A C E . H
  7. //
  8. // Contents: Class definition for CTracing
  9. //
  10. // Notes:
  11. //
  12. // Author: jeffspr 15 Apr 1997
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "tracetag.h"
  17. #ifdef ENABLETRACE
  18. // This is needed for TraceHr, since we can't use a macro (vargs), but we
  19. // need to get the file and line from the source.
  20. #define FAL __FILE__,__LINE__
  21. // Trace error functions. The leaading _ is to establish the real function,
  22. // while adding a new macro so we can add __FILE__ and __LINE__ to the output.
  23. //
  24. VOID WINAPI TraceErrorFn (PCSTR pszaFile, INT nLine, PCSTR psza, HRESULT hr);
  25. VOID WINAPI TraceResultFn (PCSTR pszaFile, INT nLine, PCSTR psza, BOOL f);
  26. VOID WINAPI TraceErrorOptionalFn (PCSTR pszaFile, INT nLine, PCSTR psza, HRESULT hr, BOOL fOpt);
  27. VOID WINAPI TraceErrorSkipFn (PCSTR pszaFile, INT nLine, PCSTR psza, HRESULT hr, UINT c, ...);
  28. VOID WINAPIV TraceLastWin32ErrorFn (PCSTR pszaFile, INT nLine, PCSTR psza);
  29. #define TraceError(sz, hr) TraceErrorFn(__FILE__, __LINE__, sz, hr);
  30. #define TraceResult(sz, f) TraceResultFn(__FILE__, __LINE__, sz, f);
  31. #define TraceErrorOptional(sz, hr, _bool) TraceErrorOptionalFn(__FILE__, __LINE__, sz, hr, _bool);
  32. #define TraceErrorSkip1(sz, hr, hr1) TraceErrorSkipFn(__FILE__, __LINE__, sz, hr, 1, hr1);
  33. #define TraceErrorSkip2(sz, hr, hr1, hr2) TraceErrorSkipFn(__FILE__, __LINE__, sz, hr, 2, hr1, hr2);
  34. #define TraceErrorSkip3(sz, hr, hr1, hr2, hr3) TraceErrorSkipFn(__FILE__, __LINE__, sz, hr, 3, hr1, hr2, hr3);
  35. #define TraceLastWin32Error(sz) TraceLastWin32ErrorFn(__FILE__,__LINE__, sz);
  36. VOID
  37. WINAPIV
  38. TraceHr (
  39. TRACETAGID ttid,
  40. PCSTR pszaFile,
  41. INT nLine,
  42. HRESULT hr,
  43. BOOL fIgnore,
  44. PCSTR pszaFmt,
  45. ...);
  46. VOID
  47. WINAPIV
  48. TraceTag (
  49. TRACETAGID ttid,
  50. PCSTR pszaFmt,
  51. ...);
  52. #else // !ENABLETRACE
  53. #define FAL (void)0
  54. #define TraceError(_sz, _hr)
  55. #define TraceResult(_sz, _f)
  56. #define TraceErrorOptional(_sz, _hr, _bool)
  57. #define TraceErrorSkip1(_sz, _hr, _hr1)
  58. #define TraceErrorSkip2(_sz, _hr, _hr1, _hr2)
  59. #define TraceErrorSkip3(_sz, _hr, _hr1, _hr2, _hr3)
  60. #define TraceLastWin32Error(_sz)
  61. #define TraceHr NOP_FUNCTION
  62. #define TraceTag NOP_FUNCTION
  63. #endif // ENABLETRACE
  64. #ifdef ENABLETRACE
  65. //---[ Initialization stuff ]-------------------------------------------------
  66. HRESULT HrInitTracing();
  67. HRESULT HrUnInitTracing();
  68. #endif // ENABLETRACE