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.

134 lines
3.2 KiB

  1. /*************************************************************************
  2. * Microsoft Windows NT *
  3. * *
  4. * Copyright(c) Microsoft Corp., 1994 *
  5. * *
  6. * Revision History: *
  7. * *
  8. * Jan. 24,94 Koti Created *
  9. * *
  10. * Description: *
  11. * *
  12. * This file contains debug support routines for the LPD Service. *
  13. * This file is based on (in fact, borrowed and then modified) on the *
  14. * debug.h in the ftpsvc module. *
  15. * *
  16. *************************************************************************/
  17. #ifndef _DEBUG_H_
  18. #define _DEBUG_H_
  19. #if DBG
  20. /* #define LPD_DEBUG_OUTPUT_TO_DEBUGGER 0x40000000L */
  21. /* #define LPD_DEBUG_OUTPUT_TO_LOG_FILE 0x80000000L */
  22. #define DBG_MEMALLOC_VERIFY 0x0BEEFCAFE
  23. #define DBG_MAXFILENAME 24
  24. typedef struct {
  25. LIST_ENTRY Linkage; // to keep linked list of allocated blocks
  26. DWORD Verify; // our signature
  27. DWORD ReqSize; // original size as requested by caller
  28. DWORD_PTR Owner[4]; // stack trace: who did the alloc
  29. DWORD dwLine; // where was this block
  30. char szFile[24]; // allocated?
  31. } DbgMemBlkHdr;
  32. //
  33. // Debug output function.
  34. //
  35. VOID LpdPrintf( CHAR * pszFormat, ... );
  36. #define LPD_DEBUG(args) LpdPrintf (args)
  37. //
  38. // Assert & require.
  39. //
  40. VOID LpdAssert( VOID * pAssertion,
  41. VOID * pFileName,
  42. ULONG nLineNumber );
  43. #define LPD_ASSERT(exp) if (!(exp)) LpdAssert( #exp, __FILE__, __LINE__ )
  44. //
  45. // Initialization/Uninitialization
  46. //
  47. VOID DbgInit();
  48. VOID DbgUninit();
  49. #define DBG_INIT() DbgInit()
  50. #define DBG_UNINIT() DbgUninit()
  51. //
  52. // memory allocation tracking
  53. //
  54. VOID DbgDumpLeaks();
  55. #define DBG_DUMPLEAKS() DbgDumpLeaks();
  56. //
  57. // function tracing
  58. //
  59. #ifdef LPD_TRACE
  60. #define DBG_TRACEIN( fn ) LpdPrintf( "Entering %s.\n", fn )
  61. #define DBG_TRACEOUT( fn ) LpdPrintf( "Leaving %s.\n", fn )
  62. #else // LPD_TRACE
  63. #define DBG_TRACEIN( fn )
  64. #define DBG_TRACEOUT( fn )
  65. #endif
  66. #else // !DBG
  67. //
  68. // No debug output.
  69. //
  70. #define LPD_DEBUG(args)
  71. //
  72. // Null assert & require.
  73. //
  74. #define LPD_ASSERT(exp)
  75. //
  76. // Null initialization/Uninitialization
  77. //
  78. #define DBG_INIT()
  79. #define DBG_UNINIT()
  80. //
  81. // memory allocation tracking
  82. //
  83. #define DBG_DUMPLEAKS()
  84. //
  85. // function tracing
  86. //
  87. #define DBG_TRACEIN( fn )
  88. #define DBG_TRACEOUT( fn )
  89. #endif // DBG
  90. #endif // _DEBUG_H_