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.

245 lines
5.5 KiB

  1. /*++
  2. Copyright (c) 1987-1996 Microsoft Corporation
  3. Module Name:
  4. nldebug.h
  5. Abstract:
  6. Netlogon service debug support
  7. Author:
  8. Ported from Lan Man 2.0
  9. Revision History:
  10. 21-May-1991 (cliffv)
  11. Ported to NT. Converted to NT style.
  12. --*/
  13. //
  14. // nlp.c will #include this file with DEBUG_ALLOCATE defined.
  15. // That will cause each of these variables to be allocated.
  16. //
  17. #ifdef EXTERN
  18. #undef EXTERN
  19. #endif
  20. #ifdef DEBUG_ALLOCATE
  21. #define EXTERN
  22. #else
  23. #define EXTERN extern
  24. #endif
  25. ////////////////////////////////////////////////////////////////////////
  26. //
  27. // Debug Definititions
  28. //
  29. ////////////////////////////////////////////////////////////////////////
  30. #define NL_INIT 0x00000001 // Initialization
  31. #define NL_MISC 0x00000002 // Misc debug
  32. #define NL_LOGON 0x00000004 // Logon processing
  33. #define NL_SYNC 0x00000008 // Synchronization and replication
  34. #define NL_MAILSLOT 0x00000010 // Mailslot messages
  35. #define NL_SITE 0x00000020 // Sites
  36. #define NL_CRITICAL 0x00000100 // Only real important errors
  37. #define NL_SESSION_SETUP 0x00000200 // Trusted Domain maintenance
  38. #define NL_DOMAIN 0x00000400 // Hosted Domain maintenance
  39. #define NL_2 0x00000800
  40. #define NL_SERVER_SESS 0x00001000 // Server session maintenance
  41. #define NL_CHANGELOG 0x00002000 // Change Log references
  42. #define NL_DNS 0x00004000 // DNS name registration
  43. //
  44. // Very verbose bits
  45. //
  46. #define NL_WORKER 0x00010000 // Debug worker thread
  47. #define NL_DNS_MORE 0x00020000 // Verbose DNS name registration
  48. #define NL_PULSE_MORE 0x00040000 // Verbose pulse processing
  49. #define NL_SESSION_MORE 0x00080000 // Verbose session management
  50. #define NL_REPL_TIME 0x00100000 // replication timing output
  51. #define NL_REPL_OBJ_TIME 0x00200000 // replication objects get/set timing output
  52. #define NL_ENCRYPT 0x00400000 // debug encrypt and decrypt across net
  53. #define NL_SYNC_MORE 0x00800000 // additional replication dbgprint
  54. #define NL_PACK_VERBOSE 0x01000000 // Verbose Pack/Unpack
  55. #define NL_MAILSLOT_TEXT 0x02000000 // Verbose Mailslot messages
  56. #define NL_CHALLENGE_RES 0x04000000 // challenge response debug
  57. #define NL_SITE_MORE 0x08000000 // Verbose sites
  58. //
  59. // Control bits.
  60. //
  61. #define NL_INHIBIT_CANCEL 0x10000000 // Don't cancel API calls
  62. #define NL_TIMESTAMP 0x20000000 // TimeStamp each output line
  63. #define NL_ONECHANGE_REPL 0x40000000 // Only replicate one change per call
  64. #define NL_BREAKPOINT 0x80000000 // Enter debugger on startup
  65. #ifdef WIN32_CHICAGO
  66. #ifdef NETLOGONDBG
  67. #undef NETLOGONDBG
  68. #endif
  69. #if DBG
  70. #define NETLOGONDBG 1
  71. #endif // DBG
  72. #endif // WIN32_CHICAGO
  73. #if NETLOGONDBG || defined(NLTEST_IMAGE)
  74. #ifdef WIN32_CHICAGO
  75. EXTERN DWORD NlGlobalTrace;
  76. #endif // WIN32_CHICAGO
  77. //
  78. // Debug share path.
  79. //
  80. EXTERN LPWSTR NlGlobalDebugSharePath;
  81. #ifndef WIN32_CHICAGO
  82. #define IF_NL_DEBUG(Function) \
  83. if (NlGlobalParameters.DbFlag & NL_ ## Function)
  84. #else
  85. #define IF_NL_DEBUG(Function) \
  86. if (NlGlobalTrace & NL_ ## Function)
  87. #endif
  88. #define NlPrint(_x_) NlPrintRoutine _x_
  89. #define NlPrintDom(_x_) NlPrintDomRoutine _x_
  90. #define NlPrintCs(_x_) NlPrintCsRoutine _x_
  91. VOID
  92. NlAssertFailed(
  93. IN PVOID FailedAssertion,
  94. IN PVOID FileName,
  95. IN ULONG LineNumber,
  96. IN PCHAR Message OPTIONAL
  97. );
  98. #define NlAssert(Predicate) \
  99. { \
  100. if (!(Predicate)) \
  101. NlAssertFailed( #Predicate, __FILE__, __LINE__, NULL ); \
  102. }
  103. #define DEBUG_DIR L"\\debug"
  104. #define DEBUG_FILE L"\\netlogon.log"
  105. #define DEBUG_BAK_FILE L"\\netlogon.bak"
  106. #define DEBUG_SHARE_NAME L"DEBUG"
  107. VOID
  108. NlPrintRoutine(
  109. IN DWORD DebugFlag,
  110. IN LPSTR FORMATSTRING, // PRINTF()-STYLE FORMAT STRING.
  111. ... // OTHER ARGUMENTS ARE POSSIBLE.
  112. );
  113. #ifdef _NETLOGON_SERVER
  114. VOID
  115. NlPrintDomRoutine(
  116. IN DWORD DebugFlag,
  117. IN PDOMAIN_INFO DomainInfo OPTIONAL,
  118. IN LPSTR Format,
  119. ...
  120. );
  121. VOID
  122. NlPrintCsRoutine(
  123. IN DWORD DebugFlag,
  124. IN PCLIENT_SESSION,
  125. IN LPSTR Format,
  126. ...
  127. );
  128. VOID
  129. NlPrintRoutineV(
  130. IN DWORD DebugFlag,
  131. IN LPSTR Format,
  132. va_list arglist
  133. );
  134. VOID
  135. NlPrintRpcDebug(
  136. IN LPCSTR RpcRoutineName,
  137. IN NTSTATUS StatusIn
  138. );
  139. #endif // _NETLOGON_SERVER
  140. VOID
  141. NlpDumpGuid(
  142. IN DWORD DebugFlag,
  143. IN GUID *Guid
  144. );
  145. VOID
  146. NlpDumpSid(
  147. IN DWORD DebugFlag,
  148. IN PSID Sid
  149. );
  150. VOID
  151. NlpDumpTime(
  152. IN DWORD DebugFlag,
  153. IN LPSTR Comment,
  154. IN LARGE_INTEGER ConvertTime
  155. );
  156. VOID
  157. NlpDumpPeriod(
  158. IN DWORD DebugFlag,
  159. IN LPSTR Comment,
  160. IN ULONG Period
  161. );
  162. VOID
  163. NlpDumpBuffer(
  164. IN DWORD DebugFlag,
  165. IN PVOID Buffer,
  166. IN DWORD BufferSize
  167. );
  168. VOID
  169. NlOpenDebugFile(
  170. IN BOOL ReopenFlag
  171. );
  172. //
  173. // Debug log file
  174. //
  175. EXTERN HANDLE NlGlobalLogFile;
  176. #define DEFAULT_MAXIMUM_LOGFILE_SIZE 20000000
  177. EXTERN LPBYTE NlGlobalLogFileOutputBuffer;
  178. //
  179. // To serialize access to log file.
  180. //
  181. #ifndef WIN32_CHICAGO
  182. EXTERN CRITICAL_SECTION NlGlobalLogFileCritSect;
  183. #endif // WIN32_CHICAGO
  184. #else
  185. #define IF_NL_DEBUG(Function) if (FALSE)
  186. // Nondebug version.
  187. #define NlpDumpBuffer
  188. #define NlpDumpGuid
  189. #define NlpDumpSid
  190. #define NlPrint(_x_)
  191. #define NlPrintDom(_x_)
  192. #define NlPrintCs(_x_)
  193. #define NlAssert(Predicate) /* no output; ignore arguments */
  194. #undef EXTERN
  195. #endif // NETLOGONDBG