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.

186 lines
5.5 KiB

  1. //==========================================================================;
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. // PURPOSE.
  7. //
  8. // Copyright (c) 1992, 1993 Microsoft Corporation. All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11. //
  12. // debug.h
  13. //
  14. // Description:
  15. //
  16. //
  17. //
  18. //==========================================================================;
  19. #ifndef _INC_DEBUG
  20. #define _INC_DEBUG
  21. #ifdef __cplusplus
  22. extern "C"
  23. {
  24. #endif
  25. #ifndef _WIN32
  26. #ifndef LPCTSTR
  27. #define LPCTSTR LPCSTR
  28. #endif
  29. #ifndef TCHAR
  30. #define TCHAR char
  31. #endif
  32. #endif
  33. //--------------------------------------------------------------------------;
  34. //
  35. // The following is the only stuff that should need to be changed when
  36. // moving this debug code from one project component to another.
  37. //
  38. //--------------------------------------------------------------------------;
  39. //
  40. // DEBUG_MODULE_NAME is the module name of the component you are
  41. // building. In the [debug] section of WIN.INI you can add
  42. // an entry MYMODULE=n to set the debug level for you module.
  43. // You can use debug statements like:
  44. // DPF(2, "My debug string");
  45. // This output would appear only if MYMODULE=n appears in WIN.INI
  46. // and n>=2.
  47. //
  48. #ifdef _WIN32
  49. #define DEBUG_MODULE_NAME "MSVFW32" // key name and prefix for output
  50. #else
  51. #define DEBUG_MODULE_NAME "MSVIDEO" // key name and prefix for output
  52. #endif
  53. //
  54. // You can also specify certain types of debug information. For example,
  55. // you may have much debug output that is associated only with initialization.
  56. // By adding an entry to the following enumeration, and then adding the
  57. // corresponding string to the following array of strings, you can specify
  58. // a debug level for different types of debug information. Using the
  59. // initialization example, you can add an entry like "MYMODULENAME_dbgInit=n"
  60. // to the [debug] section to set a debug level for debug information
  61. // associated only with initialization. You would use debug statements like:
  62. // DPFS(dbgInit, 3, "My debug string");
  63. // This output would appear only if MYMODULENAME_dbgInit=n appears in WIN.INI
  64. // and n>=3. This would be usefull when you only want to debug the logic
  65. // associated only with a certain part of you program.
  66. //
  67. // DO NOT CHANGE the first entry in the enum and the aszDbgSpecs.
  68. //
  69. enum {
  70. dbgNone=0,
  71. dbgInit,
  72. dbgThunks
  73. };
  74. #ifdef _INC_DEBUG_CODE
  75. LPCSTR aszDbgSpecs[] = {
  76. "\0",
  77. "_dbgInit",
  78. "_dbgThunks"
  79. };
  80. #endif
  81. //--------------------------------------------------------------------------;
  82. //
  83. // You should NOT need to modify anthing below here when
  84. // moving this debug code from one project component to another.
  85. //
  86. //--------------------------------------------------------------------------;
  87. //
  88. //
  89. //
  90. #ifdef DEBUG
  91. #define DEBUG_SECTION "Debug" // section name for
  92. #define DEBUG_MAX_LINE_LEN 255 // max line length (bytes!)
  93. #endif
  94. //
  95. // based code makes since only in win 16 (to try and keep stuff out of
  96. // [fixed] data segments, etc)...
  97. //
  98. #ifndef BCODE
  99. #ifdef _WIN32
  100. #define BCODE
  101. #else
  102. #define BCODE _based(_segname("_CODE"))
  103. #endif
  104. #endif
  105. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  106. //
  107. //
  108. //
  109. // #pragma message(REMIND("this is a reminder"))
  110. //
  111. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  112. #define DEBUG_QUOTE(x) #x
  113. #define DEBUG_QQUOTE(y) DEBUG_QUOTE(y)
  114. #define REMIND(sz) __FILE__ "(" DEBUG_QQUOTE(__LINE__) ") : " sz
  115. #ifdef DEBUG
  116. BOOL WINAPI DbgEnable(UINT uDbgSpec, BOOL fEnable);
  117. UINT WINAPI DbgGetLevel(UINT uDbgSpec);
  118. UINT WINAPI DbgSetLevel(UINT uDbgSpec, UINT uLevel);
  119. VOID WINAPI DbgInitialize(BOOL fEnable);
  120. void WINAPI _Assert( char * szFile, int iLine );
  121. void FAR CDECL dprintfS(UINT uDbgSpec, UINT uDbgLevel, LPSTR szFmt, ...);
  122. void FAR CDECL dprintf(UINT uDbgLevel, LPSTR szFmt, ...);
  123. #define D(x) {x;}
  124. #define DPFS dprintfS
  125. #define DPF dprintf
  126. #define DPI(sz) {static char BCODE ach[] = sz; OutputDebugStr(ach);}
  127. #define ASSERT(x) if( !(x) ) _Assert( __FILE__, __LINE__)
  128. #else
  129. #define DbgEnable(x) FALSE
  130. #define DbgGetLevel() 0
  131. #define DbgSetLevel(x) 0
  132. #define DbgInitialize(x)
  133. #ifdef _MSC_VER
  134. #pragma warning(disable:4002)
  135. #endif
  136. #define D(x)
  137. #define DPFS()
  138. #define DPF()
  139. #define DPI(sz)
  140. #define ASSERT(x)
  141. #endif
  142. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  143. //
  144. //
  145. //
  146. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  147. #ifdef RDEBUG
  148. #define DebugErr(flags, sz) {static char BCODE szx[] = DEBUG_MODULE_NAME ": " sz; DebugOutput((flags) | DBF_MMSYSTEM, szx);}
  149. #define DebugErr1(flags, sz, a) {static char BCODE szx[] = DEBUG_MODULE_NAME ": " sz; DebugOutput((flags) | DBF_MMSYSTEM, szx, a);}
  150. #define DebugErr2(flags, sz, a, b) {static char BCODE szx[] = DEBUG_MODULE_NAME ": " sz; DebugOutput((flags) | DBF_MMSYSTEM, szx, a, b);}
  151. #else
  152. #define DebugErr(flags, sz)
  153. #define DebugErr1(flags, sz, a)
  154. #define DebugErr2(flags, sz, a, b)
  155. #endif
  156. #ifdef __cplusplus
  157. }
  158. #endif
  159. #endif // _INC_DEBUG