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.

189 lines
4.2 KiB

  1. /*++
  2. Copyright (c) 1994-7 Microsoft Corporation
  3. Module Name:
  4. debug.h
  5. Abstract:
  6. This file contains debugging macros for the binl server.
  7. Author:
  8. Colin Watson (colinw) 14-Apr-1997
  9. Environment:
  10. User Mode - Win32
  11. Revision History:
  12. --*/
  13. #define DEBUG_DIR L"\\debug"
  14. #define DEBUG_FILE L"\\binlsvc.log"
  15. #define DEBUG_BAK_FILE L"\\binlsvc.bak"
  16. //
  17. // LOW WORD bit mask (0x0000FFFF) for low frequency debug output.
  18. //
  19. #define DEBUG_ADDRESS 0x00000001 // subnet address
  20. #define DEBUG_OPTIONS 0x00000008 // binl option
  21. #define DEBUG_ERRORS 0x00000010 // hard error
  22. #define DEBUG_STOC 0x00000020 // protocol error
  23. #define DEBUG_INIT 0x00000040 // init error
  24. #define DEBUG_SCAVENGER 0x00000080 // sacvenger error
  25. #define DEBUG_TIMESTAMP 0x00000100 // debug message timing
  26. #define DEBUG_REGISTRY 0x00000400 // Registry operation
  27. #define DEBUG_NETINF 0x00000800 // NETINF error
  28. #define DEBUG_MISC 0x00008000 // misc info.
  29. //
  30. // HIGH WORD bit mask (0x0000FFFF) for high frequency debug output.
  31. // ie more verbose.
  32. //
  33. #define DEBUG_MESSAGE 0x00010000 // binl message output.
  34. #define DEBUG_OSC 0x00040000 // OSChooser message output.
  35. #define DEBUG_OSC_ERROR 0x00080000 // OSChooser error output.
  36. #define DEBUG_BINL_CACHE 0x00100000 // Binl client cache output.
  37. #define DEBUG_ROGUE 0x00200000 // rogue processing.
  38. #define DEBUG_POLICY 0x00400000 // group policy filtering.
  39. #define DEBUG_THREAD 0x04000000 // debug message contains threadid
  40. #define DEBUG_MEMORY 0x08000000 // Memory Allocation Tracking Spew
  41. #define DEBUG_FUNC 0x10000000 // function entry
  42. #define DEBUG_STARTUP_BRK 0x40000000 // breakin debugger during startup.
  43. #define DEBUG_LOG_IN_FILE 0x80000000 // log debug output in a file.
  44. VOID
  45. DebugInitialize(
  46. VOID
  47. );
  48. VOID
  49. DebugUninitialize(
  50. VOID
  51. );
  52. VOID
  53. BinlOpenDebugFile(
  54. IN BOOL ReopenFlag
  55. );
  56. VOID
  57. BinlServerEventLog(
  58. DWORD EventID,
  59. DWORD EventType,
  60. DWORD ErrorCode
  61. );
  62. extern const char g_szTrue[];
  63. extern const char g_szFalse[];
  64. #define BOOLTOSTRING( _f ) ( _f ? g_szTrue : g_szFalse )
  65. VOID
  66. BinlPrintRoutine(
  67. IN DWORD DebugFlag,
  68. IN LPSTR Format,
  69. ...
  70. );
  71. #define BinlPrint(_x_) BinlPrintRoutine _x_;
  72. #if DBG
  73. VOID
  74. BinlDumpMessage(
  75. DWORD BinlDebugFlag,
  76. LPDHCP_MESSAGE BinlMessage
  77. );
  78. VOID
  79. BinlAssertFailed(
  80. LPSTR FailedAssertion,
  81. LPSTR FileName,
  82. DWORD LineNumber,
  83. LPSTR Message
  84. );
  85. #define BinlAssert(Predicate) \
  86. { \
  87. if (!(Predicate)) {\
  88. BinlAssertFailed( #Predicate, __FILE__, __LINE__, NULL ); \
  89. } \
  90. }
  91. #define BinlAssertMsg(Predicate, Message) \
  92. { \
  93. if (!(Predicate)) {\
  94. BinlAssertFailed( #Predicate, __FILE__, __LINE__, #Message ); \
  95. } \
  96. }
  97. #define BinlPrintDbg(_x_) BinlPrintRoutine _x_;
  98. #define TraceFunc( _func ) BinlPrintDbg(( DEBUG_FUNC, "%s", _func ));
  99. //
  100. // Leak detection
  101. //
  102. #define INITIALIZE_TRACE_MEMORY InitializeCriticalSection( &g_TraceMemoryCS );
  103. #define UNINITIALIZE_TRACE_MEMORY DebugMemoryCheck( ); DeleteCriticalSection( &g_TraceMemoryCS );
  104. CRITICAL_SECTION g_TraceMemoryCS;
  105. HGLOBAL
  106. DebugAlloc(
  107. LPCSTR pszFile,
  108. UINT uLine,
  109. LPCSTR pszModule,
  110. UINT uFlags,
  111. DWORD dwBytes,
  112. LPCSTR pszComment );
  113. void
  114. DebugMemoryDelete(
  115. HGLOBAL hglobal );
  116. HGLOBAL
  117. DebugMemoryAdd(
  118. HGLOBAL hglobal,
  119. LPCSTR pszFile,
  120. UINT uLine,
  121. LPCSTR pszModule,
  122. UINT uFlags,
  123. DWORD dwBytes,
  124. LPCSTR pszComment );
  125. HGLOBAL
  126. DebugFree(
  127. HGLOBAL hglobal );
  128. void
  129. DebugMemoryCheck( );
  130. #else // not DBG
  131. #define INITIALIZE_TRACE_MEMORY
  132. #define UNINITIALIZE_TRACE_MEMORY
  133. #define BinlPrintDbg(_x_)
  134. #define TraceFunc( _func )
  135. #define BinlAssert(_x_)
  136. #define BinlAssertMsg(_x_, _y_)
  137. #define BinlDumpMessage(_x_, _y_)
  138. #define DebugMemoryAdd( x1, x2, x3, x4, x5, x6, x7 )
  139. #endif // not DBG