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.

113 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name :
  4. drdbg.h
  5. Abstract:
  6. User-Mode RDP Device Redirector Debugging Module.
  7. Author:
  8. TadB
  9. Revision History:
  10. --*/
  11. #ifndef _DRDBG_
  12. #define _DRDBG_
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif // __cplusplus
  16. // We can run a stand-alone unit test for testing.
  17. //#define UNITTEST
  18. ////////////////////////////////////////////////////////
  19. //
  20. // Debugging
  21. //
  22. #undef ASSERT
  23. // Used to scramble released memory.
  24. #define DBG_GARBAGEMEM 0xCC
  25. // Debug message levels
  26. #define DBG_NONE 0x0000
  27. #define DBG_INFO 0x0001
  28. #define DBG_WARN 0x0002
  29. #define DBG_WARNING 0x0002
  30. #define DBG_ERROR 0x0004
  31. #define DBG_TRACE 0x0008
  32. #define DBG_SECURITY 0x0010
  33. #define DBG_EXEC 0x0020
  34. #define DBG_PORT 0x0040
  35. #define DBG_NOTIFY 0x0080
  36. #define DBG_PAUSE 0x0100
  37. #define DBG_ASSERT 0x0200
  38. #define DBG_THREADM 0x0400
  39. #define DBG_MIN 0x0800
  40. #define DBG_TIME 0x1000
  41. #define DBG_FOLDER 0x2000
  42. #define DBG_NOHEAD 0x8000
  43. #if DBG
  44. ULONG DbgPrint(PCH Format, ...);
  45. VOID DbgBreakPoint(VOID);
  46. /* These flags are not used as arguments to the DBGMSG macro.
  47. * You have to set the high word of the global variable to cause it to break.
  48. * It is ignored if used with DBGMSG.
  49. * (Here mainly for explanatory purposes.)
  50. */
  51. #define DBG_BREAK_ON_WARNING ( DBG_WARNING << 16 )
  52. #define DBG_BREAK_ON_ERROR ( DBG_ERROR << 16 )
  53. /* Double braces are needed for this one, e.g.:
  54. *
  55. * DBGMSG( DBG_ERROR, ( "Error code %d", Error ) );
  56. *
  57. * This is because we can't use variable parameter lists in macros.
  58. * The statement gets pre-processed to a semi-colon in non-debug mode.
  59. *
  60. * Set the global variable GLOBAL_DEBUG_FLAGS via the debugger.
  61. * Setting the flag in the low word causes that level to be printed;
  62. * setting the high word causes a break into the debugger.
  63. * E.g. setting it to 0x00040006 will print out all warning and error
  64. * messages, and break on errors.
  65. */
  66. #define DBGMSG( Level, MsgAndArgs ) \
  67. { \
  68. if( ( Level & 0xFFFF ) & GLOBAL_DEBUG_FLAGS ) \
  69. DbgPrint MsgAndArgs; \
  70. if( ( Level << 16 ) & GLOBAL_DEBUG_FLAGS ) \
  71. DbgBreakPoint(); \
  72. }
  73. #define ASSERT(expr) \
  74. if (!(expr)) { \
  75. DbgPrint( "Failed: %s\nLine %d, %s\n", \
  76. #expr, \
  77. __LINE__, \
  78. __FILE__ ); \
  79. DebugBreak(); \
  80. }
  81. #else
  82. #define DBGMSG
  83. #define ASSERT(exp)
  84. #endif
  85. #ifdef __cplusplus
  86. }
  87. #endif // __cplusplus
  88. #endif // #ifndef _DRDBG_