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.

126 lines
2.9 KiB

  1. //
  2. // Microsoft Corporation - Copyright 1997
  3. //
  4. //
  5. // DEBUG.H - Debugging header
  6. //
  7. #ifndef _DEBUG_H_
  8. #define _DEBUG_H_
  9. // structures
  10. typedef struct {
  11. LPBYTE lpAddr; // Address
  12. DWORD dwColor; // Color to use
  13. LPSTR lpszComment; // Comment to show
  14. } DUMPTABLE, *LPDUMPTABLE;
  15. #pragma warning(disable:4200)
  16. typedef struct {
  17. DWORD dwCount;
  18. struct {
  19. DWORD dwCode;
  20. LPSTR lpDesc;
  21. } ids[];
  22. } CODETOSTR, *LPCODETOSTR;
  23. #pragma warning(default:4200)
  24. // globals
  25. extern const char g_szTrue[];
  26. extern const char g_szFalse[];
  27. extern CODETOSTR HRtoStr;
  28. extern CODETOSTR HSEtoStr;
  29. extern CODETOSTR ErrtoStr;
  30. // macros
  31. #define BOOLTOSTRING( _f ) ( _f ? g_szTrue : g_szFalse )
  32. // constants
  33. // Maximum number of dump table entries
  34. #define MAX_DT 400
  35. // debug flags
  36. #define TF_ALWAYS 0xFFFFffff
  37. #define TF_FUNC 0x80000000 // Trace with function calls
  38. #define TF_DLL 0x00000001 // DLL entry points
  39. #define TF_RESPONSE 0x00000002 // Responses
  40. #define TF_READDATA 0x00000004 // Data reading functions
  41. #define TF_PARSE 0x00000008 // Parsing
  42. #define TF_SERVER 0x00000010 // Call to server callbacks
  43. #define TF_LEX 0x00000020 // Lex
  44. #ifdef DEBUG
  45. // Globals
  46. extern DWORD g_dwTraceFlag;
  47. // macros
  48. #define DEBUG_BREAK do { _try { _asm int 3 } _except (EXCEPTION_EXECUTE_HANDLER) {;} } while (0)
  49. #define DEBUGTEXT(sz, msg) /* ;Internal */ \
  50. static const TCHAR sz[] = msg;
  51. #define Assert(f) \
  52. { \
  53. DEBUGTEXT(szFile, TEXT(__FILE__)); \
  54. if (!(f) && AssertMsg(0, szFile, __LINE__, TEXT(#f) )) \
  55. DEBUG_BREAK; \
  56. }
  57. // functions
  58. BOOL CDECL AssertMsg(
  59. BOOL fShouldBeTrue,
  60. LPCSTR pszFile,
  61. DWORD dwLine,
  62. LPCSTR pszStatement );
  63. void CDECL TraceMsg(
  64. DWORD mask,
  65. LPCSTR pszMsg,
  66. ... );
  67. void CDECL TraceMsgResult(
  68. DWORD mask,
  69. LPCODETOSTR lpCodeToStr,
  70. DWORD dwResult,
  71. LPCSTR pszMsg,
  72. ... );
  73. #else // DEBUG
  74. #define DEBUG_BREAK
  75. #define AssertMsg 1 ? (void)0 : (void)
  76. #define TraceMsg 1 ? (void)0 : (void)
  77. #define TraceMsgResult 1 ? (void)0 : (void)
  78. #endif // DEBUG
  79. // HTML output debugging messages
  80. void CDECL DebugMsg(
  81. LPSTR lpszOut,
  82. LPCSTR pszMsg,
  83. ... );
  84. void CDECL DebugMsgResult(
  85. LPSTR lpszOut,
  86. LPCODETOSTR lpCodeToStr,
  87. DWORD dwResult,
  88. LPCSTR pszMsg,
  89. ... );
  90. //
  91. // These are for users of BOTH RETAIL and DEBUG. They only echo to the
  92. // logfile and to the debug output (if process attached to IIS).
  93. //
  94. void CDECL LogMsgResult(
  95. LPSTR lpszLog,
  96. LPSTR lpStr,
  97. LPCODETOSTR lpCodeToStr,
  98. DWORD dwResult,
  99. LPCSTR pszMsg,
  100. ... );
  101. void CDECL LogMsg(
  102. LPSTR lpszLog,
  103. LPSTR lpStr,
  104. LPCSTR pszMsg,
  105. ... );
  106. #endif // _DEBUG_H_