Source code of Windows XP (NT5)
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.

207 lines
6.0 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. NpData.c
  5. Abstract:
  6. This module declares the global data used by the Named Pipe file system.
  7. Author:
  8. Gary Kimura [GaryKi] 20-Aug-1990
  9. Revision History:
  10. --*/
  11. #ifndef _NPDATA_
  12. #define _NPDATA_
  13. extern PVCB NpVcb;
  14. //
  15. // The global structure used to contain our fast I/O callbacks
  16. //
  17. extern FAST_IO_DISPATCH NpFastIoDispatch;
  18. //
  19. // Lists of pipe name aliases.
  20. //
  21. #define MIN_LENGTH_ALIAS_ARRAY (5 * sizeof(WCHAR)) // includes '\'
  22. #define MAX_LENGTH_ALIAS_ARRAY (9 * sizeof(WCHAR))
  23. extern SINGLE_LIST_ENTRY NpAliasListByLength[(MAX_LENGTH_ALIAS_ARRAY-MIN_LENGTH_ALIAS_ARRAY)/sizeof(WCHAR)+1];
  24. extern SINGLE_LIST_ENTRY NpAliasList;
  25. extern PVOID NpAliases; // single allocation containing all aliases
  26. //
  27. // The global Named Pipe debug level variable, its values are:
  28. //
  29. // 0x00000000 Always gets printed (used when about to bug check)
  30. //
  31. // 0x00000001
  32. // 0x00000002
  33. // 0x00000004
  34. // 0x00000008
  35. //
  36. // 0x00000010
  37. // 0x00000020
  38. // 0x00000040
  39. // 0x00000080
  40. //
  41. // 0x00000100
  42. // 0x00000200
  43. // 0x00000400
  44. // 0x00000800
  45. //
  46. // 0x00001000
  47. // 0x00002000
  48. // 0x00004000
  49. // 0x00008000
  50. //
  51. // 0x00010000
  52. // 0x00020000
  53. // 0x00040000
  54. // 0x00080000
  55. //
  56. // 0x00100000
  57. // 0x00200000
  58. // 0x00400000
  59. // 0x00800000
  60. //
  61. // 0x01000000
  62. // 0x02000000
  63. // 0x04000000
  64. // 0x08000000
  65. //
  66. // 0x10000000
  67. // 0x20000000
  68. // 0x40000000
  69. // 0x80000000
  70. //
  71. #ifdef NPDBG
  72. #define DEBUG_TRACE_ERROR (0x00000001)
  73. #define DEBUG_TRACE_DEBUG_HOOKS (0x00000002)
  74. #define DEBUG_TRACE_CATCH_EXCEPTIONS (0x00000004)
  75. #define DEBUG_TRACE_CREATE (0x00000008)
  76. #define DEBUG_TRACE_CLOSE (0x00000010)
  77. #define DEBUG_TRACE_READ (0x00000020)
  78. #define DEBUG_TRACE_WRITE (0x00000040)
  79. #define DEBUG_TRACE_FILEINFO (0x00000080)
  80. #define DEBUG_TRACE_CLEANUP (0x00000100)
  81. #define DEBUG_TRACE_DIR (0x00000200)
  82. #define DEBUG_TRACE_FSCONTRL (0x00000400)
  83. #define DEBUG_TRACE_CREATE_NAMED_PIPE (0x00000800)
  84. #define DEBUG_TRACE_FLUSH_BUFFERS (0x00001000)
  85. #define DEBUG_TRACE_VOLINFO (0x00002000)
  86. #define DEBUG_TRACE_SEINFO (0x00004000)
  87. #define DEBUG_TRACE_0x00008000 (0x00008000)
  88. #define DEBUG_TRACE_0x00010000 (0x00010000)
  89. #define DEBUG_TRACE_SECURSUP (0x00020000)
  90. #define DEBUG_TRACE_DEVIOSUP (0x00040000)
  91. #define DEBUG_TRACE_RESRCSUP (0x00080000)
  92. #define DEBUG_TRACE_READSUP (0x00100000)
  93. #define DEBUG_TRACE_WRITESUP (0x00200000)
  94. #define DEBUG_TRACE_STATESUP (0x00400000)
  95. #define DEBUG_TRACE_FILOBSUP (0x00800000)
  96. #define DEBUG_TRACE_PREFXSUP (0x01000000)
  97. #define DEBUG_TRACE_CNTXTSUP (0x02000000)
  98. #define DEBUG_TRACE_DATASUP (0x04000000)
  99. #define DEBUG_TRACE_WAITSUP (0x08000000)
  100. #define DEBUG_TRACE_EVENTSUP (0x10000000)
  101. #define DEBUG_TRACE_STRUCSUP (0x20000000)
  102. extern LONG NpDebugTraceLevel;
  103. extern LONG NpDebugTraceIndent;
  104. #define DebugTrace(INDENT,LEVEL,X,Y) { \
  105. LONG _i; \
  106. if (((LEVEL) == 0) || (NpDebugTraceLevel & (LEVEL))) { \
  107. DbgPrint("%p:",PsGetCurrentThread()); \
  108. if ((INDENT) < 0) { \
  109. NpDebugTraceIndent += (INDENT); \
  110. } \
  111. if (NpDebugTraceIndent < 0) { \
  112. NpDebugTraceIndent = 0; \
  113. } \
  114. for (_i=0; _i<NpDebugTraceIndent; _i+=1) { \
  115. DbgPrint(" "); \
  116. } \
  117. DbgPrint(X,Y); \
  118. if ((INDENT) > 0) { \
  119. NpDebugTraceIndent += (INDENT); \
  120. } \
  121. } \
  122. }
  123. #define DebugDump(STR,LEVEL,PTR) { \
  124. VOID NpDump(PVOID Ptr); \
  125. if (((LEVEL) == 0) || (NpDebugTraceLevel & (LEVEL))) { \
  126. DbgPrint("%p:",PsGetCurrentThread()); \
  127. DbgPrint(STR); \
  128. if (PTR != NULL) {NpDump(PTR);} \
  129. DbgBreakPoint(); \
  130. } \
  131. }
  132. #else
  133. #define DebugTrace(INDENT,LEVEL,X,Y) {NOTHING;}
  134. #define DebugDump(STR,LEVEL,PTR) {NOTHING;}
  135. #endif // NPDBG
  136. //
  137. // The following macro is for all people who compile with the DBG switch
  138. // set, not just fastfat dbg users
  139. //
  140. #if DBG
  141. #define DbgDoit(X) {X;}
  142. #else
  143. #define DbgDoit(X) {NOTHING;}
  144. #endif // DBG
  145. //
  146. // Some global debug routines to verify the shape and consistency of various
  147. // data structures.
  148. //
  149. #ifdef DBG
  150. _inline VOID
  151. NpfsVerifyCcb( IN PCHAR FileName, IN ULONG Line, IN PCCB Ccb ) {
  152. PFILE_OBJECT FileObject;
  153. if ((FileObject = Ccb->FileObject[ FILE_PIPE_CLIENT_END ]) != NULL) {
  154. if ((ULONG_PTR)FileObject->FsContext != (ULONG_PTR)Ccb) {
  155. DbgPrint("%s(%d) Ccb @ %p with bad client\n", FileName, Line, Ccb );
  156. DbgBreakPoint();
  157. }
  158. }
  159. if ((FileObject = Ccb->FileObject[ FILE_PIPE_SERVER_END ]) != NULL) {
  160. if (((ULONG_PTR)FileObject->FsContext & ~0x00000001) != (ULONG_PTR)Ccb) {
  161. DbgPrint("%s(%d) Ccb @ %p with bad server\n", FileName, Line, Ccb );
  162. DbgBreakPoint();
  163. }
  164. }
  165. }
  166. #else
  167. #define NpfsVerifyCcb( IN PCHAR FileName, IN ULONG Line, IN PCCB Ccb )
  168. #endif
  169. #endif // _NPDATA_