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.

168 lines
5.0 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Module: debug.h
  4. //
  5. // Description:
  6. //
  7. //
  8. //@@BEGIN_MSINTERNAL
  9. // Development Team:
  10. // Mike McLaughlin
  11. //
  12. // History: Date Author Comment
  13. //
  14. //@@END_MSINTERNAL
  15. //---------------------------------------------------------------------------
  16. //
  17. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  18. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  19. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  20. // PURPOSE.
  21. //
  22. // Copyright (c) 1996-1999 Microsoft Corporation. All Rights Reserved.
  23. //
  24. //---------------------------------------------------------------------------
  25. //---------------------------------------------------------------------------
  26. // Constants and Macros
  27. //---------------------------------------------------------------------------
  28. #ifdef DEBUG
  29. #define STR_MODULENAME "sysaudio: "
  30. #endif
  31. #if defined(DEBUG) && defined(_X86_)
  32. #define Trap() {_asm {_emit 0xcc}}
  33. #else
  34. #define Trap()
  35. #endif
  36. #define AssertAligned(p) ASSERT((PtrToUlong(p) & 7) == 0)
  37. #define DBG_IOCTL_LOG 105
  38. #define DBG_IOCTL_FAIL 5
  39. #ifdef DEBUG
  40. typedef struct _OBJECT_HEADER {
  41. union {
  42. struct {
  43. LONG PointerCount;
  44. LONG HandleCount;
  45. };
  46. LIST_ENTRY Entry;
  47. };
  48. POBJECT_TYPE Type;
  49. UCHAR NameInfoOffset;
  50. UCHAR HandleInfoOffset;
  51. UCHAR QuotaInfoOffset;
  52. UCHAR Flags;
  53. union {
  54. //POBJECT_CREATE_INFORMATION ObjectCreateInfo;
  55. PVOID QuotaBlockCharged;
  56. };
  57. PSECURITY_DESCRIPTOR SecurityDescriptor;
  58. QUAD Body;
  59. } OBJECT_HEADER, *POBJECT_HEADER;
  60. #define OBJECT_TO_OBJECT_HEADER( o ) \
  61. CONTAINING_RECORD( (o), OBJECT_HEADER, Body )
  62. extern "C" PEPROCESS KernelProcess;
  63. extern "C" int SYSAUDIOTraceLevel;
  64. #define DPF(n,sz) (n == MAXULONG ? dprintf(sz "\n") : (n <= SYSAUDIOTraceLevel ? DbgPrint(STR_MODULENAME sz "\n") : 0))
  65. #define DPF1(n,sz,a) (n == MAXULONG ? dprintf(sz "\n", a) : (n <= SYSAUDIOTraceLevel ? DbgPrint(STR_MODULENAME sz "\n", a) : 0))
  66. #define DPF2(n,sz,a,b) (n == MAXULONG ? dprintf(sz "\n", a,b) : (n <= SYSAUDIOTraceLevel ? DbgPrint(STR_MODULENAME sz "\n", a,b) : 0))
  67. #define DPF3(n,sz,a,b,c) (n == MAXULONG ? dprintf(sz "\n", a,b,c) : (n <= SYSAUDIOTraceLevel ? DbgPrint(STR_MODULENAME sz "\n", a,b,c) : 0))
  68. #define DPF4(n,sz,a,b,c,d) (n == MAXULONG ? dprintf(sz "\n", a,b,c,d) : (n <= SYSAUDIOTraceLevel ? DbgPrint(STR_MODULENAME sz "\n",a,b,c,d) : 0))
  69. #define DPF5(n,sz,a,b,c,d,e) (n == MAXULONG ? dprintf(sz "\n", a,b,c,d,e) : (n <= SYSAUDIOTraceLevel ? DbgPrint(STR_MODULENAME sz "\n", a,b,c,d,e) : 0))
  70. #define DPF6(n,sz,a,b,c,d,e,f) (n == MAXULONG ? dprintf(sz "\n", a,b,c,d,e,f) : (n <= SYSAUDIOTraceLevel ? DbgPrint(STR_MODULENAME sz "\n", a,b,c,d,e,f) : 0))
  71. #define DPF7(n,sz,a,b,c,d,e,f,g) (n == MAXULONG ? dprintf(sz "\n", a,b,c,d,e,f,g) : (n <= SYSAUDIOTraceLevel ? DbgPrint(STR_MODULENAME sz "\n", a,b,c,d,e,f,g) : 0))
  72. #define DPF8(n,sz,a,b,c,d,e,f,g,h) (n == MAXULONG ? dprintf(sz "\n", a,b,c,d,e,f,g,h) : (n <= SYSAUDIOTraceLevel ? DbgPrint(STR_MODULENAME sz "\n", a,b,c,d,e,f,g,h) : 0))
  73. #define DPF9(n,sz,a,b,c,d,e,f,g,h,i) (n == MAXULONG ? dprintf(sz "\n", a,b,c,d,e,f,g,h,i) : (n <= SYSAUDIOTraceLevel ? DbgPrint(STR_MODULENAME sz "\n",a,b,c,d,e,f,g,h,i) : 0))
  74. #define AssertStatus(f) ASSERT(f == STATUS_SUCCESS)
  75. #define AssertFileObject(pfo) \
  76. ASSERT((pfo)->FsContext != NULL); \
  77. ASSERT(OBJECT_TO_OBJECT_HEADER(pfo)->PointerCount > 0);
  78. // Debug Levels
  79. //
  80. #define DBG_STATE 20
  81. #else
  82. #define DPF(n,sz)
  83. #define DPF1(n,sz,a)
  84. #define DPF2(n,sz,a,b)
  85. #define DPF3(n,sz,a,b,c)
  86. #define DPF4(n,sz,a,b,c,d)
  87. #define DPF5(n,sz,a,b,c,d,e)
  88. #define DPF6(n,sz,a,b,c,d,e,f)
  89. #define DPF7(n,sz,a,b,c,d,e,f,g)
  90. #define DPF8(n,sz,a,b,c,d,e,f,g,h)
  91. #define DPF9(n,sz,a,b,c,d,e,f,g,h,i)
  92. #define AssertKernelProcess
  93. #define AssertStatus(f) f
  94. #define AssertFileObject(pfo)
  95. #endif
  96. #ifdef DEBUG
  97. #define Assert(p) \
  98. (p)->m_Signature.DebugAssert()
  99. #define DefineSignature(s) \
  100. class CSignature \
  101. { \
  102. public: \
  103. CSignature() \
  104. { \
  105. m_dwSignature = s; \
  106. }; \
  107. ~CSignature() \
  108. { \
  109. m_dwSignature = 0x44414544; \
  110. }; \
  111. BOOL IsAssert() \
  112. { \
  113. return(m_dwSignature == s); \
  114. } \
  115. VOID DebugAssert() \
  116. { \
  117. ASSERT(IsAssert()); \
  118. }; \
  119. private: \
  120. ULONG m_dwSignature; \
  121. } m_Signature;
  122. #define DestroySignature() \
  123. m_Signature.~CSignature()
  124. #else
  125. #define Assert(p)
  126. #define DefineSignature(s)
  127. #define DestroySignature()
  128. #endif
  129. #ifdef DEBUG
  130. #ifndef _X86_
  131. #define dprintf DbgPrint
  132. #endif // _X86_
  133. #endif // DEBUG
  134. //---------------------------------------------------------------------------
  135. // End of File: debug.h
  136. //---------------------------------------------------------------------------