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.

136 lines
2.9 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. ksdebug.h
  5. Abstract:
  6. Debug header.
  7. --*/
  8. #if !defined(_KSDEBUG_)
  9. #define _KSDEBUG_
  10. #if !defined(REMIND)
  11. #define QUOTE(x) #x
  12. #define QQUOTE(y) QUOTE(y)
  13. #define REMIND(str) __FILE__ "(" QQUOTE(__LINE__) ") : " str
  14. #endif // !defined(REMIND)
  15. #if defined(__cplusplus)
  16. extern "C" {
  17. #endif // defined(__cplusplus)
  18. #if defined(_NTDDK_)
  19. #define DEBUGLVL_BLAB 3
  20. #define DEBUGLVL_VERBOSE 2
  21. #define DEBUGLVL_TERSE 1
  22. #define DEBUGLVL_ERROR 0
  23. #if (DBG)
  24. #if !defined( DEBUG_LEVEL )
  25. #if defined( DEBUG_VARIABLE )
  26. #if defined( KSDEBUG_INIT )
  27. ULONG DEBUG_VARIABLE = DEBUGLVL_TERSE;
  28. #else
  29. extern ULONG DEBUG_VARIABLE;
  30. #endif
  31. #else
  32. #define DEBUG_VARIABLE DEBUGLVL_TERSE
  33. #endif
  34. #else
  35. #if defined( DEBUG_VARIABLE )
  36. #if defined( KSDEBUG_INIT )
  37. ULONG DEBUG_VARIABLE = DEBUG_LEVEL;
  38. #else
  39. extern ULONG DEBUG_VARIABLE;
  40. #endif
  41. #else
  42. #define DEBUG_VARIABLE DEBUG_LEVEL
  43. #endif
  44. #endif
  45. #define _DbgPrintF(lvl, strings) \
  46. { \
  47. if (((lvl)==DEBUG_VARIABLE) || (lvl < DEBUG_VARIABLE)) {\
  48. DbgPrint(STR_MODULENAME);\
  49. DbgPrint##strings;\
  50. DbgPrint("\n");\
  51. if ((lvl) == DEBUGLVL_ERROR) {\
  52. DbgBreakPoint();\
  53. } \
  54. } \
  55. }
  56. #define _DbgPrintFEx(component, lvl, strings) \
  57. { \
  58. if ((lvl) <= DEBUG_VARIABLE) {\
  59. DbgPrintEx(component, lvl, STR_MODULENAME);\
  60. DbgPrintEx(component, lvl, strings);\
  61. DbgPrintEx(component, lvl, "\n");\
  62. if ((lvl) == DEBUGLVL_ERROR) {\
  63. DbgBreakPoint();\
  64. } \
  65. } \
  66. }
  67. #else // !DBG
  68. #define _DbgPrintF(lvl, strings)
  69. #define _DbgPrintFEx(component, lvl, strings)
  70. #endif // !DBG
  71. #endif // !defined(_NTDDK_)
  72. //
  73. // macros
  74. //
  75. #if defined(__cplusplus)
  76. }
  77. #endif // defined(__cplusplus)
  78. //
  79. // constants
  80. //
  81. #if (DBG)
  82. #if defined(IRPMJFUNCDESC)
  83. static const PCHAR IrpMjFuncDesc[] =
  84. {
  85. "IRP_MJ_CREATE",
  86. "IRP_MJ_CREATE_NAMED_PIPE",
  87. "IRP_MJ_CLOSE",
  88. "IRP_MJ_READ",
  89. "IRP_MJ_WRITE",
  90. "IRP_MJ_QUERY_INFORMATION",
  91. "IRP_MJ_SET_INFORMATION",
  92. "IRP_MJ_QUERY_EA",
  93. "IRP_MJ_SET_EA",
  94. "IRP_MJ_FLUSH_BUFFERS",
  95. "IRP_MJ_QUERY_VOLUME_INFORMATION",
  96. "IRP_MJ_SET_VOLUME_INFORMATION",
  97. "IRP_MJ_DIRECTORY_CONTROL",
  98. "IRP_MJ_FILE_SYSTEM_CONTROL",
  99. "IRP_MJ_DEVICE_CONTROL",
  100. "IRP_MJ_INTERNAL_DEVICE_CONTROL",
  101. "IRP_MJ_SHUTDOWN",
  102. "IRP_MJ_LOCK_CONTROL",
  103. "IRP_MJ_CLEANUP",
  104. "IRP_MJ_CREATE_MAILSLOT",
  105. "IRP_MJ_QUERY_SECURITY",
  106. "IRP_MJ_SET_SECURITY",
  107. "IRP_MJ_SET_POWER",
  108. "IRP_MJ_QUERY_POWER"
  109. };
  110. #endif // defined(IRPMJFUNCDESC)
  111. #endif // DBG
  112. #endif // !_KSDEBUG_