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.

108 lines
2.9 KiB

  1. #ifndef _DEBUG_H_
  2. #define _DEBUG_H_
  3. #if DBG
  4. #define DBG_NONE 0x00000000
  5. #define DBG_INIT 0x00000001
  6. #define DBG_READWRITE 0x00000002
  7. #define DBG_POOL 0x00000004
  8. #define DBG_IOCTL 0x00000008
  9. #define DBG_PNP 0x00000010
  10. #define DBG_POWER 0x00000020
  11. #define DBG_SRB 0x00000040
  12. #define DBG_THREAD 0x00000080
  13. #define DBG_WINDOW 0x00000100
  14. #define DBG_ALL 0x7FFFFFFF
  15. #define DBG_BREAK_ON_UNRECOGNIZED_IOCTL 0x80000000
  16. #define DBG_ERROR 0x00000001
  17. #define DBG_NOTIFY 0x00000002
  18. #define DBG_WARN 0x00000003
  19. #define DBG_INFO 0x00000004
  20. #define DBG_VERBOSE 0x00000005
  21. #define DBG_PAINFUL 0x00000006
  22. extern ULONG BreakOnEntry;
  23. extern ULONG DebugComponents;
  24. extern ULONG DebugLevel;
  25. #define DEFAULT_BREAK_ON_ENTRY FALSE
  26. #define DEFAULT_DEBUG_LEVEL DBG_ERROR
  27. #define DEFAULT_DEBUG_COMPONENTS DBG_ALL
  28. #ifndef DBG_HEADER
  29. #define DBG_HEADER "RAMDISK: "
  30. #endif
  31. #define DBGPRINT( _component, _level, _fmt ) { \
  32. if ( ((DebugComponents & (_component)) != 0) && ((_level) <= DebugLevel) ) { \
  33. KdPrint(( "%s", DBG_HEADER )); \
  34. KdPrint( _fmt ); \
  35. } \
  36. }
  37. #define UNRECOGNIZED_IOCTL_BREAK { \
  38. if ( (DebugComponents & DBG_BREAK_ON_UNRECOGNIZED_IOCTL) != 0 ) { \
  39. ASSERT( FALSE ); \
  40. } \
  41. }
  42. #else
  43. #define DBGPRINT( _component, _level, _fmt )
  44. #define UNRECOGNIZED_IOCTL_BREAK
  45. #endif // DBG
  46. #if DBG
  47. #define POOL_DBG 1
  48. #endif
  49. #if !defined(POOL_DBG)
  50. #define ALLOCATE_POOL( _type, _size, _private ) ExAllocatePoolWithTag( (_type), (_size), RAMDISK_TAG_GENERAL )
  51. #define FREE_POOL( _addr, _private ) ExFreePool( (_addr) )
  52. #else
  53. VOID
  54. RamdiskInitializePoolDebug (
  55. VOID
  56. );
  57. PVOID
  58. RamdiskAllocatePoolWithTag (
  59. POOL_TYPE PoolType,
  60. SIZE_T Size,
  61. ULONG Tag,
  62. LOGICAL Private,
  63. PCHAR File,
  64. ULONG Line
  65. );
  66. VOID
  67. RamdiskFreePool (
  68. PVOID Address,
  69. LOGICAL Private,
  70. PCHAR File,
  71. ULONG Line
  72. );
  73. #define ALLOCATE_POOL( _type, _size, _private ) \
  74. RamdiskAllocatePoolWithTag( \
  75. (_type), \
  76. (_size), \
  77. RAMDISK_TAG_GENERAL, \
  78. (_private), \
  79. __FILE__, \
  80. __LINE__ )
  81. #define FREE_POOL( _addr, _private ) RamdiskFreePool( (_addr), (_private), __FILE__, __LINE__ )
  82. #endif
  83. #endif // _DEBUG_H_