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.

175 lines
4.1 KiB

  1. //****************************************************************************
  2. //
  3. // Module: IPNATHLP.DLL
  4. // File: debug.h
  5. // Content: This file contains the debug definitions
  6. //
  7. // Revision History:
  8. //
  9. // Date
  10. // -------- ---------- -------------------------------------------------------
  11. // 03/06/01 savasg Created
  12. //
  13. //****************************************************************************
  14. #ifndef _BCON_DBG_H_
  15. #define _BCON_DBG_H_
  16. //
  17. // Name of this overall binary
  18. //
  19. #define SZ_MODULE L"Beacon"
  20. #define TRACE_FLAG_NEUTR ((ULONG)0x08000000 | TRACE_USE_MASK)
  21. #define BUF_SIZE 512
  22. #define is ==
  23. //****************************************************************************
  24. // Typedef's
  25. //****************************************************************************
  26. typedef struct _DEBUG_MODULE_INFO {
  27. ULONG dwModule;
  28. ULONG dwLevel;
  29. TCHAR szModuleName[80];
  30. TCHAR szDebugKey[80];
  31. } DEBUG_MODULE_INFO, *PDEBUG_MODULE_INFO;
  32. //****************************************************************************
  33. // Extern
  34. //****************************************************************************
  35. //
  36. // Trace Modules
  37. //
  38. #define TM_DEFAULT 0
  39. #define TM_STATIC 1
  40. #define TM_INFO 2
  41. #define TM_DYNAMIC 3
  42. //
  43. // Boolean value Module
  44. //
  45. #define TB_FILE 4
  46. //
  47. // Trace Levels
  48. //
  49. #define TL_NONE 0
  50. #define TL_CRIT 1
  51. #define TL_ERROR 2
  52. #define TL_INFO 3
  53. #define TL_TRACE 4
  54. #define TL_DUMP 5
  55. #if DBG // checked build
  56. #ifndef _DEBUG // DEBUG_CRT is not enabled.
  57. #undef _ASSERT
  58. #undef _ASSERTE
  59. #define _ASSERT(expr) \
  60. do \
  61. { \
  62. if (!(expr)) \
  63. { \
  64. TCHAR buf[BUF_SIZE + 1]; \
  65. _sntprintf( \
  66. buf, \
  67. BUF_SIZE, \
  68. _T("UPnP-Nat: Assertion failed (%s:%i)\n"), \
  69. _T(__FILE__), \
  70. __LINE__ \
  71. ); \
  72. buf[BUF_SIZE] = _T('\0'); \
  73. OutputDebugString(buf); \
  74. DebugBreak(); \
  75. } \
  76. } while (0)
  77. #define _ASSERTE(expr) \
  78. do \
  79. { \
  80. if (!(expr)) \
  81. { \
  82. TCHAR buf[BUF_SIZE + 1]; \
  83. _sntprintf( \
  84. buf, \
  85. BUF_SIZE, \
  86. _T("UPnP-Nat: Assertion failed (%s:%i)\n"), \
  87. _T(__FILE__), \
  88. __LINE__ \
  89. ); \
  90. buf[BUF_SIZE] = _T('\0'); \
  91. OutputDebugString(buf); \
  92. DebugBreak(); \
  93. } \
  94. } while (0)
  95. #endif // _DEBUG
  96. #define DBG_SPEW DbgPrintEx
  97. #else // DBG
  98. #define DBG_SPEW DEBUG_DO_NOTHING
  99. #endif // DBG
  100. //************************************************************
  101. // Prototypes
  102. //************************************************************
  103. //void DbgPrintX(LPCSTR pszMsg, ...);
  104. void DbgPrintEx(
  105. ULONG Module,
  106. ULONG ErrorLevel,
  107. LPOLESTR pszMsg,
  108. ...
  109. );
  110. void
  111. DEBUG_DO_NOTHING(
  112. ULONG Module,
  113. ULONG ErrorLevel,
  114. LPOLESTR pszMsg,
  115. ...
  116. );
  117. void InitDebugger( void );
  118. void DestroyDebugger( void );
  119. LPOLESTR
  120. AppendAndAllocateWString(
  121. LPOLESTR oldString,
  122. LPOLESTR newString
  123. );
  124. #endif // _BCON_DBG_H_