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.

126 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. debug.h
  5. Abstract:
  6. Contains data definitions for debug code.
  7. Author:
  8. Madan Appiah (madana) 15-Nov-1994
  9. Environment:
  10. User Mode - Win32
  11. Revision History:
  12. --*/
  13. #ifndef _DEBUG_
  14. #define _DEBUG_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. // Event tracking macros...
  19. #define EVENTWRAP(API, h) {\
  20. BOOL ret = API(h);\
  21. if (ret) \
  22. TcpsvcsDbgPrint((DEBUG_APIS, #API "(" #h "=%d)\n", h)); \
  23. else { \
  24. TcpsvcsDbgPrint((DEBUG_APIS, #API "(" #h "=%d) failed err=%d\n",\
  25. h, GetLastError())); \
  26. TcpsvcsDbgAssert( FALSE ); \
  27. } \
  28. }\
  29. #define SETEVENT(h) EVENTWRAP(SetEvent, h)
  30. #define RESETEVENT(h) EVENTWRAP(ResetEvent, h)
  31. #define CLOSEHANDLE(h) EVENTWRAP(CloseHandle, h)
  32. //
  33. // LOW WORD bit mask (0x0000FFFF) for low frequency debug output.
  34. //
  35. #define DEBUG_ERRORS 0x00000001 // hard errors.
  36. #define DEBUG_REGISTRY 0x00000002 // debug registry calls
  37. #define DEBUG_MISC 0x00000004 // misc info.
  38. #define DEBUG_SCAVENGER 0x00000008 // scavenger debug info.
  39. #define DEBUG_SORT 0x00000010 // debug B-TREE functions
  40. #define DEBUG_CONTAINER 0x00000020 // debug container
  41. #define DEBUG_APIS 0x00000040 // debug tcpsvcs apis
  42. #define DEBUG_FILE_VALIDATE 0x00000080 // validate file map file
  43. #define DEBUG_SVCLOC_MESSAGE 0x00000100 // discovery messages
  44. //
  45. // HIGH WORD bit mask (0x0000FFFF) for high frequency debug output.
  46. // ie more verbose.
  47. //
  48. #define DEBUG_TIMESTAMP 0x00010000 // print time stamps
  49. #define DEBUG_MEM_ALLOC 0x00020000 // memory alloc
  50. #define DEBUG_STARTUP_BRK 0x40000000 // breakin debugger during startup.
  51. #define ENTER_CACHE_API(paramlist) \
  52. { DEBUG_ONLY(LPINTERNET_THREAD_INFO lpThreadInfo = InternetGetThreadInfo();) \
  53. DEBUG_ENTER_API(paramlist); \
  54. }
  55. #define LEAVE_CACHE_API() \
  56. Cleanup: \
  57. if (Error != ERROR_SUCCESS) \
  58. { \
  59. SetLastError( Error ); \
  60. DEBUG_ERROR(INET, Error); \
  61. } \
  62. DEBUG_LEAVE_API (Error==ERROR_SUCCESS); \
  63. return (Error==ERROR_SUCCESS); \
  64. #if DBG
  65. ///#define DEBUG_PRINT OutputDebugString
  66. //
  67. // debug functions.
  68. //
  69. #define TcpsvcsDbgPrint(_x_) TcpsvcsDbgPrintRoutine _x_
  70. VOID
  71. TcpsvcsDbgPrintRoutine(
  72. IN DWORD DebugFlag,
  73. IN LPSTR Format,
  74. ...
  75. );
  76. #define TcpsvcsDbgAssert(Predicate) INET_ASSERT(Predicate)
  77. #else
  78. ///#define IF_DEBUG(flag) if (FALSE)
  79. #define TcpsvcsDbgPrint(_x_)
  80. #define TcpsvcsDbgAssert(_x_)
  81. #endif // DBG
  82. #if DBG
  83. #define INLINE
  84. #else
  85. #define INLINE inline
  86. #endif
  87. #ifdef __cplusplus
  88. }
  89. #endif
  90. #endif // _DEBUG_