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.

153 lines
5.6 KiB

  1. /*++
  2. Copyright (c) 1989-1993 Microsoft Corporation
  3. Module Name:
  4. Debug.h
  5. Abstract:
  6. This file contains debug printing constants for NBT.
  7. Author:
  8. Jim Stewart (Jimst) 10-2-92
  9. Revision History:
  10. --*/
  11. #ifndef _DEBUGNBT_H
  12. #define _DEBUGNBT_H
  13. //
  14. // Debug support.. this macro defines a check on a global flag that
  15. // selectively enables and disables debugging in different parts of NBT
  16. // NbtDebug is a global ULONG declared in driver.c
  17. //
  18. #if DBG
  19. extern ULONG NbtDebug;
  20. #endif // DBG
  21. // Assert support
  22. #ifdef _NTDRIVER_
  23. #if DBG
  24. #undef ASSERT
  25. #undef ASSERTMSG
  26. #define ASSERT( exp ) \
  27. if (!(exp)) { \
  28. DbgPrint( "Assertion \"%s\" failed at file %s, line %d\n", #exp, __FILE__, __LINE__ ); \
  29. if (NbtConfig.BreakOnAssert) \
  30. DbgBreakPoint(); \
  31. }
  32. #define ASSERTMSG( msg, exp ) \
  33. if (!exp) { \
  34. DbgPrint( "Message: %s\nAssertion \"%s\" failed at file %s, line %d\n", msg, #exp, __FILE__, __LINE__ ); \
  35. if (NbtConfig.BreakOnAssert) \
  36. DbgBreakPoint(); \
  37. }
  38. #endif // DBG
  39. #endif // _NTDRIVER_
  40. #if DBG
  41. #define IF_DBG(flags) if(NbtDebug & flags)
  42. #define NBT_DEBUG_REGISTRY 0x00000001 // registry.c
  43. #define NBT_DEBUG_DRIVER 0x00000002 // driver.c
  44. #define NBT_DEBUG_NTUTIL 0x00000004 // ntutil.c
  45. #define NBT_DEBUG_TDIADDR 0x00000008 // tdiaddr.c
  46. #define NBT_DEBUG_TDICNCT 0x00000010 // tidaddr.c
  47. #define NBT_DEBUG_NETBIOS_EX 0x00000020 // NETBIOS_EX address type debugging
  48. #define NBT_DEBUG_NAME 0x00000040 // name.c
  49. #define NBT_DEBUG_NTISOL 0x00000080 // ntisol.c
  50. #define NBT_DEBUG_NBTUTILS 0x00000100 // nbtutils.c
  51. #define NBT_DEBUG_NAMESRV 0x00000200 // namesrv.c
  52. #define NBT_DEBUG_HNDLRS 0x00000400 // hndlrs.c
  53. #define NBT_DEBUG_PROXY 0x00000800 // proxy.c
  54. #define NBT_DEBUG_HASHTBL 0x00001000 // hashtbl.c
  55. #define NBT_DEBUG_UDPSEND 0x00002000 // udpsend.c
  56. #define NBT_DEBUG_TDIOUT 0x00004000 // tdiout.c
  57. #define NBT_DEBUG_SEND 0x00008000 // sends
  58. #define NBT_DEBUG_RCV 0x00010000 // rcvs
  59. #define NBT_DEBUG_RCVIRP 0x00020000 // rcv irp processing
  60. #define NBT_DEBUG_INDICATEBUFF 0x00040000 // tdihndlrs.c indicate buffer
  61. #define NBT_DEBUG_REFRESH 0x00080000 // refresh logic
  62. #define NBT_DEBUG_REF 0x00100000 // reference counts
  63. #define NBT_DEBUG_DISCONNECT 0x00200000 // Disconnects
  64. #define NBT_DEBUG_FILLIRP 0x00400000 // Filling the Irp(Rcv)
  65. #define NBT_DEBUG_LMHOST 0x00800000 // Lmhost file stuff
  66. #define NBT_DEBUG_FASTPATH 0x01000000 // Rcv code - fast path
  67. #define NBT_DEBUG_WINS 0x02000000 // Wins Interface debug
  68. #define NBT_DEBUG_PNP_POWER 0x04000000 // NT PNP debugging
  69. #define NBT_DEBUG_HANDLES 0x08000000 // To debug Handle RefCount issues
  70. #define NBT_DEBUG_TDIHNDLR 0x10000000 // tdihndlr.c
  71. #define NBT_DEBUG_MEMFREE 0x20000000 // memory alloc/free
  72. #define NBT_DEBUG_KDPRINTS 0x80000000 // KdPrint output
  73. //----------------------------------------------------------------------------
  74. //
  75. // Remove Debug spew on Debug builds!
  76. //
  77. #ifndef VXD
  78. #undef KdPrint
  79. #define KdPrint(_x_) \
  80. if (NbtDebug & NBT_DEBUG_KDPRINTS) \
  81. { \
  82. DbgPrint _x_; \
  83. }
  84. #endif // !VXD
  85. //----------------------------------------------------------------------------
  86. #else
  87. #define IF_DBG(flags)
  88. #endif
  89. /*
  90. * Software Tracing
  91. */
  92. #define WPP_CONTROL_GUIDS WPP_DEFINE_CONTROL_GUID(CtlGuid,(bca7bd7f,b0bf,4051,99f4,03cfe79664c1), \
  93. WPP_DEFINE_BIT(NBT_TRACE_DNS) \
  94. WPP_DEFINE_BIT(NBT_TRACE_OUTBOUND) \
  95. WPP_DEFINE_BIT(NBT_TRACE_INBOUND) \
  96. WPP_DEFINE_BIT(NBT_TRACE_DISCONNECT) \
  97. WPP_DEFINE_BIT(NBT_TRACE_LOWER_EDGE) \
  98. WPP_DEFINE_BIT(NBT_TRACE_IOCTL) \
  99. WPP_DEFINE_BIT(NBT_TRACE_PNP) \
  100. WPP_DEFINE_BIT(NBT_TRACE_NAMESRV) \
  101. WPP_DEFINE_BIT(NBT_TRACE_SEND) \
  102. WPP_DEFINE_BIT(NBT_TRACE_RECV) \
  103. WPP_DEFINE_BIT(NBT_TRACE_SENDDGRAM) \
  104. WPP_DEFINE_BIT(NBT_TRACE_RECVDGRAM) \
  105. WPP_DEFINE_BIT(NBT_TRACE_LOCALNAMES) \
  106. WPP_DEFINE_BIT(NBT_TRACE_REMOTECACHE) \
  107. WPP_DEFINE_BIT(NBT_TRACE_PROXY) \
  108. WPP_DEFINE_BIT(NBT_TRACE_VERBOSE) \
  109. )
  110. //
  111. // Enable Software Tracing on all builds
  112. //
  113. #ifndef _NBT_WMI_SOFTWARE_TRACING_
  114. #define _NBT_WMI_SOFTWARE_TRACING_
  115. #endif
  116. #ifndef _NBT_WMI_SOFTWARE_TRACING_
  117. /*
  118. * Totally turn off software tracing
  119. */
  120. # define NbtTrace(l,m)
  121. # define WPP_ENABLED() (0)
  122. # define WPP_LEVEL_ENABLED(LEVEL) (0)
  123. #define WPP_LOGNBTNAME(x)
  124. #else
  125. int nbtlog_strnlen(char *p, int n);
  126. static CHAR NBTLOGNAME=0;
  127. #define WPP_LOGNBTNAME(x) \
  128. WPP_LOGPAIR(nbtlog_strnlen((char*)x,15),x) WPP_LOGPAIR(1,&NBTLOGNAME)
  129. #endif
  130. #endif