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.

200 lines
4.2 KiB

  1. /*
  2. - debug.h
  3. -
  4. * Microsoft Internet Phone
  5. * Debug functions prototypes and macros
  6. *
  7. * Revision History:
  8. *
  9. * When Who What
  10. * -------- ------------------ ---------------------------------------
  11. * 11.16.95 Yoram Yaacovi Created
  12. *
  13. */
  14. #ifndef _DEBUG_H
  15. #define _DEBUG_H
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /*
  20. * Debug message types
  21. */
  22. #define AVERROR 0
  23. #define AVTRACE 1
  24. #define AVTRACEMEM 2
  25. #if defined(DEBUG) || defined(TEST)
  26. /*
  27. * MACRO: DebugTrap(void)
  28. *
  29. * PURPOSE: Executes a debug break (like 'int 3' on x86)
  30. *
  31. * PARAMETERS:
  32. * none
  33. *
  34. * RETURN VALUE:
  35. * none
  36. *
  37. * COMMENTS:
  38. *
  39. */
  40. #ifdef OLD_STUFF
  41. #define DebugTrap DebugTrapFn()
  42. #endif
  43. #define DEBUGCHK(e) if(!(e)) DebugTrap
  44. /*
  45. * MACRO: DebugPrintError(LPTSTR)
  46. *
  47. * PURPOSE: Prints an error string to the debug output terminal
  48. *
  49. * PARAMETERS:
  50. * lpszFormat - a printf-style format
  51. *
  52. * RETURN VALUE:
  53. * none
  54. *
  55. * COMMENTS:
  56. * This macro calls the generic debug print macro, specifying
  57. * that this is an error message
  58. *
  59. */
  60. #define DebugPrintError(x) DebugPrintfError x
  61. /*
  62. * MACRO: DebugPrintTrace(LPTSTR)
  63. *
  64. * PURPOSE: Prints a trace string to the debug output terminal
  65. *
  66. * PARAMETERS:
  67. * lpszFormat - a printf-style format
  68. *
  69. * RETURN VALUE:
  70. * none
  71. *
  72. * COMMENTS:
  73. * This macro calls the generic debug print macro, specifying
  74. * that this is an error message
  75. *
  76. */
  77. #define DebugPrintTrace(x) DebugPrintfTrace x
  78. /*
  79. * MACRO: DebugPrintErrorFileLine(DWORD, LPTSTR)
  80. *
  81. * PURPOSE: Pretty print an error to the debugging output.
  82. *
  83. * PARAMETERS:
  84. * dwError - Actual error code
  85. * pszPrefix - String to prepend to the printed message.
  86. *
  87. * RETURN VALUE:
  88. * none
  89. *
  90. * COMMENTS:
  91. * It will take the error, turn it into a human
  92. * readable string, prepend pszPrefix (so you
  93. * can tag your errors), append __FILE__ and __LINE__
  94. * and print it to the debugging output.
  95. *
  96. * This macro is just a wrapper around OutputDebugLineErrorFileLine
  97. * that is necessary to get proper values for __FILE__ and __LINE__.
  98. *
  99. */
  100. #define DebugPrintErrorFileLine(dwError, pszPrefix) \
  101. DebugPrintFileLine(dwError, pszPrefix,\
  102. __FILE__, __LINE__)
  103. /*
  104. * MACRO: DebugPrintTraceFileLine(DWORD, LPTSTR)
  105. *
  106. * PURPOSE: Pretty print a trace message to the debugging output.
  107. *
  108. * PARAMETERS:
  109. * dwParam- A paramter to trace
  110. * pszPrefix - String to prepend to the printed message.
  111. *
  112. * RETURN VALUE:
  113. * none
  114. *
  115. * COMMENTS:
  116. * Takes a parameter, prepend pszPrefix (so you
  117. * can tag your traces), append __FILE__ and __LINE__
  118. * and print it to the debugging output.
  119. *
  120. * This macro is just a wrapper around OutputDebugLineErrorFileLine
  121. * that is necessary to get proper values for __FILE__ and __LINE__.
  122. *
  123. */
  124. #define DebugPrintTraceFileLine(dwParam, pszPrefix) \
  125. DebugPrintFileLine(dwParam, pszPrefix,\
  126. __FILE__, __LINE__)
  127. void DebugPrintFileLine(
  128. DWORD dwError, LPTSTR szPrefix,
  129. LPTSTR szFileName, DWORD nLineNumber);
  130. void __cdecl DebugPrintf(ULONG ulFlags, LPTSTR lpszFormat, ...);
  131. void __cdecl DebugPrintfError(LPTSTR lpszFormat, ...);
  132. void __cdecl DebugPrintfTrace(LPTSTR lpszFormat, ...);
  133. #ifdef OLD_STUFF
  134. void DebugTrapFn(void);
  135. #endif
  136. LPTSTR FormatError(DWORD dwError,
  137. LPTSTR szOutputBuffer, DWORD dwSizeofOutputBuffer);
  138. #else // not DEBUG or TEST
  139. #define DebugTrap
  140. #define DebugPrintError(x)
  141. #define DebugPrintTrace(x)
  142. #define DebugPrintTraceFileLine(dwParam, pszPrefix)
  143. #define DEBUGCHK(e)
  144. #endif
  145. #ifdef MEMORY_TRACKING
  146. /*
  147. * MACRO: DebugPrintTraceMem(LPTSTR)
  148. *
  149. * PURPOSE: Prints a memory tracking trace string to the debug
  150. * output terminal
  151. *
  152. * PARAMETERS:
  153. * lpszFormat - a printf-style format
  154. *
  155. * RETURN VALUE:
  156. * none
  157. *
  158. * COMMENTS:
  159. * This macro calls the generic debug print macro, specifying
  160. * that this is an error message
  161. *
  162. */
  163. #define DebugPrintTraceMem(x) DebugPrintf(AVTRACEMEM, x)
  164. #else // no MEMORY_TRACKING
  165. #define DebugPrintTraceMem(x)
  166. #endif
  167. #ifdef __cplusplus
  168. }
  169. #endif
  170. #endif //#ifndef _DEBUG_H