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.

81 lines
2.5 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"Cert Template 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"Cert Template 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. void CheckDebugOutputLevel ();
  52. #else // !DBG
  53. #define _TRACE
  54. #define _ASSERTMSG(expr, msg)
  55. #endif
  56. #endif // ifndef _DEBUG_H_