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.7 KiB

  1. /* File: avUtil.h (was debug.h + runtime.h)
  2. Used by NAC.dll and H323CC.dll, and QOS.LIB
  3. */
  4. #ifndef _AVUTIL_H
  5. #define _AVUTIL_H
  6. #include <nmutil.h>
  7. #include <pshpack8.h> /* Assume 8 byte packing throughout */
  8. /***********************************************************************
  9. *
  10. * Registry access easy-wrapper functions prototypes
  11. *
  12. ***********************************************************************/
  13. UINT NMINTERNAL RegistryGetInt(HKEY hPDKey, LPCTSTR lpszSection, LPCTSTR lpszKey, INT dwDefault,
  14. LPCTSTR lpszFile);
  15. DWORD NMINTERNAL RegistryGetString(HKEY hPDKey, LPCTSTR lpszSection, LPCTSTR lpszKey,
  16. LPCTSTR lpszDefault, LPTSTR lpszReturnBuffer, DWORD cchReturnBuffer,
  17. LPCTSTR lpszFile);
  18. BOOL NMINTERNAL RegistrySetString(HKEY hPDKey, LPCTSTR lpszSection, LPCTSTR lpszKey,
  19. LPCTSTR lpszString, LPCTSTR lpszFile);
  20. BOOL NMINTERNAL RegistrySetInt(HKEY hPDKey, LPCTSTR lpszSection, LPCTSTR lpszKey,
  21. DWORD i, LPCTSTR lpszFile);
  22. DWORD NMINTERNAL RegistryGetBinData(HKEY hPDKey, LPCTSTR lpszSection, LPCTSTR lpszKey,
  23. LPVOID lpvDefault, DWORD cchDefault, LPVOID lpvReturnBuffer, DWORD cchReturnBuffer,
  24. LPCTSTR lpszFile);
  25. BOOL NMINTERNAL RegistrySetBinData(HKEY hPDKey, LPCTSTR lpszSection, LPCTSTR lpszKey,
  26. LPVOID lpvBinData, DWORD cchBinData, LPCTSTR lpszFile);
  27. /**********************************************************************
  28. *
  29. * Debug Macros
  30. **********************************************************************/
  31. /*
  32. * Debug message types
  33. */
  34. #define AVERROR 0
  35. #define AVTRACE 1
  36. #define AVTRACEMEM 2
  37. #define AVTESTTRACE 3
  38. //****** Retail
  39. // MACRO: RETAILMSG(message-to-print)
  40. // PURPOSE: Prints a message to the debug output
  41. // NOTE: available in all builds, depends on the registry flag
  42. #define RETAILMSG(x) RetailPrintfTrace x
  43. VOID WINAPI RetailPrintfTrace(LPCSTR lpszFormat, ...);
  44. //****** Test and Debug
  45. // in test and debug build, doesnt depent on the registry flag
  46. #if defined(TEST) || defined(DEBUG)
  47. #define TESTMSG(x) TestPrintfTrace x
  48. void __cdecl TestPrintfTrace(LPCSTR lpszFormat, ...);
  49. #define ERRORMSG(x) ERROR_OUT(x)
  50. #else
  51. #define ERRORMSG(x)
  52. #define TESTMSG(x)
  53. #endif
  54. //****** Debug only
  55. #if defined(DEBUG)
  56. // MACRO: DebugTrap(void)
  57. // PURPOSE: Executes a debug break (like 'int 3' on x86)
  58. #define DebugTrap DebugTrapFn()
  59. #define DEBUGCHK(e) if(!(e)) DebugTrap
  60. /*
  61. * MACRO: DebugPrintError(LPCSTR)
  62. *
  63. * PURPOSE: Prints an error string to the debug output terminal
  64. *
  65. * PARAMETERS:
  66. * lpszFormat - a printf-style format
  67. *
  68. * RETURN VALUE:
  69. * none
  70. *
  71. * COMMENTS:
  72. * This macro calls the generic debug print macro, specifying
  73. * that this is an error message
  74. *
  75. */
  76. #define DebugPrintError(x) ERROR_OUT(x)
  77. /*
  78. * MACRO: DebugPrintErrorFileLine(DWORD, LPSTR)
  79. *
  80. * PURPOSE: Pretty print an error to the debugging output.
  81. *
  82. * PARAMETERS:
  83. * dwError - Actual error code
  84. * pszPrefix - String to prepend to the printed message.
  85. *
  86. * RETURN VALUE:
  87. * none
  88. *
  89. * COMMENTS:
  90. * It will take the error, turn it into a human
  91. * readable string, prepend pszPrefix (so you
  92. * can tag your errors), append __FILE__ and __LINE__
  93. * and print it to the debugging output.
  94. *
  95. * This macro is just a wrapper around OutputDebugLineErrorFileLine
  96. * that is necessary to get proper values for __FILE__ and __LINE__.
  97. *
  98. */
  99. #define DebugPrintErrorFileLine(dwError, pszPrefix) \
  100. DebugPrintFileLine(dwError, pszPrefix,\
  101. __FILE__, __LINE__)
  102. /*
  103. * MACRO: DebugPrintTraceFileLine(DWORD, LPSTR)
  104. *
  105. * PURPOSE: Pretty print a trace message to the debugging output.
  106. *
  107. * PARAMETERS:
  108. * dwParam- A paramter to trace
  109. * pszPrefix - String to prepend to the printed message.
  110. *
  111. * RETURN VALUE:
  112. * none
  113. *
  114. * COMMENTS:
  115. * Takes a parameter, prepend pszPrefix (so you
  116. * can tag your traces), append __FILE__ and __LINE__
  117. * and print it to the debugging output.
  118. *
  119. * This macro is just a wrapper around OutputDebugLineErrorFileLine
  120. * that is necessary to get proper values for __FILE__ and __LINE__.
  121. *
  122. */
  123. #define DebugPrintTraceFileLine(dwParam, pszPrefix) \
  124. DebugPrintFileLine(dwParam, pszPrefix,\
  125. __FILE__, __LINE__)
  126. void DebugPrintFileLine(
  127. DWORD dwError, LPSTR szPrefix,
  128. LPSTR szFileName, DWORD nLineNumber);
  129. VOID NMINTERNAL DebugTrapFn(void);
  130. #else // not DEBUG
  131. #define DEBUGMSG(z,s)
  132. #define DebugTrap
  133. #define DebugPrintError(x)
  134. #define DebugPrintTrace(x)
  135. #define DebugPrintTraceFileLine(dwParam, pszPrefix)
  136. #define DEBUGCHK(e)
  137. #endif
  138. #define GETMASK(hDbgZone) \
  139. ((hDbgZone) ? (((PZONEINFO)(hDbgZone))->ulZoneMask) : (0))
  140. #include <poppack.h> /* End byte packing */
  141. #endif //#ifndef _AVUTIL_H