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.

120 lines
4.1 KiB

  1. //////////////////////////////////////////////////////////////////
  2. // File : dbg.h
  3. // Purpose : MACRO definition for showing debug message
  4. //
  5. //
  6. // Copyright(c) 1991-1997, Microsoft Corp. All rights reserved
  7. //
  8. //////////////////////////////////////////////////////////////////
  9. #ifndef _DBG_H_
  10. #define _DBG_H_
  11. #define MemAlloc(a) GlobalAlloc(GMEM_FIXED, (a))
  12. #define MemFree(a) GlobalFree((a))
  13. //-------------------------------------------------------
  14. //MACRO function(?) prototype declare
  15. //-------------------------------------------------------
  16. ////////////////////////////////////////////////////////
  17. // Function : DBG
  18. // Type : VOID
  19. // Purpose : Printing ANSI debug message with same usage as printf()
  20. // :
  21. // Args :
  22. // : LPSTR lpstrFuncName
  23. // : ...
  24. // CAUTION : Must use DOUBLE Blaket to remove in Release version!!!
  25. /////////////////////////////////////////////////////////
  26. //VOID DBG((LPSTR lpstrFuncName, ...));
  27. ////////////////////////////////////////////////////////
  28. // Function: DBGW
  29. // Type : VOID
  30. // Purpose : Printing Unicode debug message with same usage as printf()
  31. // Args :
  32. // : LPWSTR lpstrFuncName
  33. // : ...
  34. // CAUTION: Please use DOUBLE Blaket!!!
  35. /////////////////////////////////////////////////////////
  36. //VOID DBGW((LPWSTR lpstrFuncName, ...));
  37. ////////////////////////////////////////////////////////
  38. // Function : DBGMB
  39. // Type : VOID
  40. // Purpose : Show Messagebox for ANSI debug message
  41. // : Same usage as printf()
  42. // Args :
  43. // : LPSTR lpstrFuncName
  44. // : ...
  45. // CAUTION : Must use DOUBLE Blaket to remove in Release version!!!
  46. /////////////////////////////////////////////////////////
  47. //VOID DBGMB((LPSTR lpstrFuncName, ...));
  48. ////////////////////////////////////////////////////////
  49. // Function : DBGShowWindow
  50. // Type : VOID
  51. // Purpose : Invoke debug message window.
  52. // : DBG(), DBGW()'s message is shown here.
  53. // Args : HINSTANCE hInst
  54. // : HWND hwndOwner
  55. /////////////////////////////////////////////////////////
  56. //VOID DBGShowWindow(HINSTANCE hInst, HWND hwndOwner);
  57. #ifdef _DEBUG
  58. extern VOID _plvDbgShowWindow(HINSTANCE hInst, HWND hwndOwner);
  59. #ifndef UNICODE_ONLY
  60. extern VOID _plvDbgA (LPSTR lpstrFile, INT lineNo, LPSTR lpstrMsg);
  61. extern VOID _plvDbgPrintA (LPSTR lpstrMsg, ...);
  62. extern LPSTR _plvDbgVaStrA (LPSTR lpstrFmt, ...);
  63. extern LPWSTR _plvDbgMulti2Wide(LPSTR lpstr);
  64. extern VOID _plvDbgMBA(LPSTR lpstrFile, INT lineNo, LPSTR lpstrMsg);
  65. extern VOID _plvDbgMBW(LPWSTR lpstrFile, INT lineNo, LPWSTR lpstrMsg);
  66. extern VOID _dbg_Assert(LPCTSTR fileName,
  67. INT line,
  68. BOOL flag,
  69. LPCTSTR pszExp);
  70. #endif
  71. #ifndef ANSI_ONLY
  72. extern VOID _plvDbgW(LPWSTR lpstrFile, INT lineNo, LPWSTR lpstrMsg);
  73. extern VOID _plvDbgPrintW(LPWSTR lpstrMsg, ...);
  74. extern LPWSTR _plvDbgVaStrW(LPWSTR lpstrFmt, ...);
  75. #endif
  76. #endif
  77. #if defined(_DEBUG) || (defined(_NDEBUG) && defined(_RELDEBUG))
  78. # define DBGShowWindow(a,b) _plvDbgShowWindow(a,b);
  79. # define DBGW(a) _plvDbgW( _plvDbgMulti2Wide(__FILE__), __LINE__, _plvDbgVaStrW a)
  80. # define DBGA(a) _plvDbgA(__FILE__, __LINE__, _plvDbgVaStrA a)
  81. # define Dbg(a) _plvDbgA(__FILE__, __LINE__, _plvDbgVaStrA a)
  82. # define DBGMB(a) _plvDbgMBA(__FILE__, __LINE__, _plvDbgVaStrA a)
  83. # define DBGMBA(a) _plvDbgMBA(__FILE__, __LINE__, _plvDbgVaStrA a)
  84. # define DBGMBW(a) _plvDbgMBW(_plvDbgMulti2Wide(__FILE__), __LINE__, _plvDbgVaStrW a)
  85. # define DBGASSERT(a) _plvDbgAssert(__FILE__, __LINE__, a, #a);
  86. # define DBGASSERTDO(a) _plvDbgAssert(__FILE__, __LINE__, a, #a);
  87. #else //!_DEBUG //in Release version, these are disapear...
  88. # define DBGShowWindow(a,b)
  89. # define DBGW(a)
  90. # define DBGA(a)
  91. # define Dbg(a)
  92. # define DBGMB(a)
  93. # define DBGMBA(a)
  94. # define DBGMBW(a)
  95. # define DBGASSERT(a)
  96. # define DBGASSERTDO(a) (a)
  97. #endif //_DEBUG
  98. //extern VOID _plvDbgA (LPSTR lpstrFile, INT lineNo, LPSTR lpstrMsg);
  99. //extern VOID _plvDbgPrintA (LPSTR lpstrMsg, ...);
  100. //extern LPSTR _plvDbgVaStrA (LPSTR lpstrFmt, ...);
  101. #define DP(a) //_plvDbgA(__FILE__, __LINE__, _plvDbgVaStrA a)
  102. #endif //_DBG_H_