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.

116 lines
2.8 KiB

  1. // Copyright (c) 1996-1999 Microsoft Corporation
  2. //+-------------------------------------------------------------------------
  3. //
  4. // File: debug.hxx
  5. //
  6. // Contents: Debug declarations.
  7. //
  8. // Classes:
  9. //
  10. // Functions:
  11. //
  12. // History: 18-Nov-96 BillMo Created.
  13. //
  14. // Notes:
  15. //
  16. // Codework:
  17. //
  18. //--------------------------------------------------------------------------
  19. #if !DBG || defined(lint) || defined(_lint)
  20. #define DBGSTATIC static // hidden function
  21. #else
  22. #define DBGSTATIC // visible for use in debugger.
  23. #endif
  24. #if DBG
  25. VOID TrkDebugCreate( ULONG grfFlags, CHAR *ptszModuleName );
  26. VOID TrkDebugDelete( VOID);
  27. #else
  28. #define TrkDebugCreate( grf, ptsz )
  29. #define TrkDebugDelete()
  30. #endif
  31. enum TRK_DBG_FLAGS
  32. {
  33. TRK_DBG_FLAGS_WRITE_TO_DBG = 1,
  34. TRK_DBG_FLAGS_WRITE_TO_FILE = 2,
  35. TRK_DBG_FLAGS_APPEND_TO_FILE = 4,
  36. TRK_DBG_FLAGS_WRITE_TO_STDOUT = 8
  37. };
  38. #if DBG == 1
  39. extern CHAR TrkGlobalDebugBuffer[ 1024]; // arbitrary
  40. extern DWORD TrkGlobalDebug;
  41. ////////////////////////////////////////////////////////////////////////
  42. //
  43. // Debug Definititions
  44. //
  45. ////////////////////////////////////////////////////////////////////////
  46. extern CRITICAL_SECTION g_ProtectLogFile;
  47. extern HANDLE g_LogFile;
  48. extern ULONG g_grfDebugFlags;
  49. extern CHAR g_DebugBuffer[];
  50. //
  51. // Control bits.
  52. //
  53. VOID TrkAssertFailed(
  54. IN PVOID FailedAssertion,
  55. IN PVOID FileName,
  56. IN ULONG LineNumber,
  57. IN PCHAR Message OPTIONAL
  58. );
  59. #define TrkAssert( Predicate) \
  60. { \
  61. if (!(Predicate)) \
  62. TrkAssertFailed( #Predicate, __FILE__, __LINE__, NULL ); \
  63. }
  64. #define TrkVerify TrkAssert
  65. VOID TrkLogErrorRoutine(
  66. IN DWORD DebugFlag,
  67. IN HRESULT hr,
  68. IN LPTSTR Format, // PRINTF()-STYLE FORMAT STRING.
  69. ... // OTHER ARGUMENTS ARE POSSIBLE.
  70. );
  71. VOID TrkLogRoutine(
  72. IN DWORD DebugFlag,
  73. IN LPTSTR Format, // PRINTF()-STYLE FORMAT STRING.
  74. ... // OTHER ARGUMENTS ARE POSSIBLE.
  75. );
  76. VOID TrkLogErrorRoutineInternal(
  77. IN DWORD DebugFlag,
  78. IN LPSTR pszHR,
  79. IN LPTSTR Format,
  80. IN va_list Arguments
  81. );
  82. VOID TrkLogRuntimeList( IN PCHAR Comment);
  83. VOID TrkLogTimeout( IN DWORD timeout);
  84. #define TrkLog( _x_) TrkLogRoutine _x_
  85. #else // #if DBG == 1
  86. #define TrkAssert(condition)
  87. #define TrkVerify(condition) condition
  88. #define TrkLog( _x_)
  89. #define TrkLogRuntimeList( _x_)
  90. #define TrkLogTimeout( _x_)
  91. #endif // #if DBG == 1 ... #else