Leaked source code of windows server 2003
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.

94 lines
2.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2000-2001.
  5. //
  6. // File: debug.h
  7. //
  8. // Contents: Debugging macros and prototypes
  9. //
  10. //----------------------------------------------------------------------------
  11. #ifndef _DEBUG_H_
  12. #define _DEBUG_H_
  13. #if DBG == 1
  14. void __cdecl _TRACE (int level, const wchar_t *format, ... );
  15. //
  16. // External functions
  17. //
  18. PCSTR StripDirPrefixA(PCSTR);
  19. //
  20. // These macros are used for asserting certain conditions. They are
  21. // independent of the debugging level.
  22. // These also require additional paranthesis to enclose the msg as
  23. // shown below.
  24. //
  25. #ifdef _ASSERT
  26. #undef _ASSERT
  27. #undef _ASSERTMSG
  28. #endif
  29. #define _ASSERT(expr) \
  30. { \
  31. if (!(expr)) \
  32. { \
  33. _TRACE (0, L"Wsecedit Snapin(Thread ID: %d): Assert: %s(%u)\n", \
  34. GetCurrentThreadId(), \
  35. StripDirPrefixA(__FILE__), __LINE__); \
  36. DebugBreak(); \
  37. } \
  38. }
  39. #define _ASSERTMSG(expr, msg) \
  40. { \
  41. if (!(expr)) \
  42. { \
  43. _TRACE (0, L"Wsecedit Snapin(%d): Assert: %s(%u)\n", \
  44. GetCurrentThreadId(), \
  45. StripDirPrefixA(__FILE__), __LINE__); \
  46. _TRACE (0, msg); \
  47. _TRACE (0, "\n"); \
  48. DebugBreak(); \
  49. } \
  50. }
  51. #else // !DBG
  52. #define _TRACE
  53. #define _ASSERTMSG(expr, msg)
  54. #endif
  55. //
  56. // yet another trace style used by chklist.h & disabled here
  57. //
  58. #define TraceAssert(x)
  59. #define TraceLeaveResult(hr) { return hr; }
  60. #define TraceLeaveVoid() { return; }
  61. #define TraceLeaveValue(value) { return(value); }
  62. #define TraceSetMask(dwMask)
  63. #define TraceEnter(dwMask, fn)
  64. #define TraceLeave
  65. #define Trace
  66. #define TraceMsg(s)
  67. #define TraceGUID(s, rGUID)
  68. #endif // ifndef _DEBUG_H_