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.

401 lines
7.5 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. mupstruc.h
  5. Abstract:
  6. This module defines the data structures that make up the major internal
  7. part of the MUP.
  8. Author:
  9. Manny Weiser (mannyw) 16-Dec-1991
  10. Revision History:
  11. --*/
  12. #ifndef _MUPSTRUC_
  13. #define _MUPSTRUC_
  14. typedef enum _BLOCK_TYPE {
  15. BlockTypeUndefined,
  16. BlockTypeVcb,
  17. BlockTypeUncProvider,
  18. BlockTypeKnownPrefix,
  19. BlockTypeFcb,
  20. BlockTypeCcb,
  21. BlockTypeMasterIoContext,
  22. BlockTypeIoContext,
  23. BlockTypeMasterQueryContext,
  24. BlockTypeQueryContext,
  25. BlockTypeBuffer
  26. } BLOCK_TYPE;
  27. typedef enum _BLOCK_STATE {
  28. BlockStateUnknown,
  29. BlockStateActive,
  30. BlockStateClosing
  31. } BLOCK_STATE;
  32. //
  33. // A block header starts every block
  34. //
  35. typedef struct _BLOCK_HEADER {
  36. BLOCK_TYPE BlockType;
  37. BLOCK_STATE BlockState;
  38. ULONG ReferenceCount;
  39. ULONG BlockSize;
  40. } BLOCK_HEADER, *PBLOCK_HEADER;
  41. //
  42. // The MUP volume control block. This structure is used to track access
  43. // the the MUP device object.
  44. //
  45. typedef struct _VCB {
  46. BLOCK_HEADER BlockHeader;
  47. //
  48. // The IO share access.
  49. //
  50. SHARE_ACCESS ShareAccess;
  51. } VCB, *PVCB;
  52. //
  53. // The MUP Device Object is an I/O system device object.
  54. //
  55. typedef struct _MUP_DEVICE_OBJECT {
  56. DEVICE_OBJECT DeviceObject;
  57. VCB Vcb;
  58. } MUP_DEVICE_OBJECT, *PMUP_DEVICE_OBJECT;
  59. //
  60. // A UNC provider. A UNC provider block corresponds to a registered UNC
  61. // provider device.
  62. //
  63. typedef struct _UNC_PROVIDER {
  64. BLOCK_HEADER BlockHeader;
  65. LIST_ENTRY ListEntry;
  66. //
  67. // The device name of the provider
  68. //
  69. UNICODE_STRING DeviceName;
  70. //
  71. // Our handle to the UNC device and the associated file and device objects
  72. //
  73. HANDLE Handle;
  74. PDEVICE_OBJECT DeviceObject;
  75. PFILE_OBJECT FileObject;
  76. //
  77. // The priority of the provider.
  78. //
  79. ULONG Priority;
  80. //
  81. // Indicate if the provider supports mailslots.
  82. //
  83. BOOLEAN MailslotsSupported;
  84. //
  85. // Indicate if the provider is currently registered or unregistered
  86. //
  87. BOOLEAN Registered;
  88. } UNC_PROVIDER, *PUNC_PROVIDER;
  89. //
  90. // A known prefix. A known prefix is a path prefix (like \\server\share)
  91. // that is "owned" by a specific UNC provider.
  92. //
  93. typedef struct _KNOWN_PREFIX {
  94. BLOCK_HEADER BlockHeader;
  95. UNICODE_PREFIX_TABLE_ENTRY TableEntry;
  96. //
  97. // The prefix string
  98. //
  99. UNICODE_STRING Prefix;
  100. //
  101. // The time the prefix was last used.
  102. //
  103. LARGE_INTEGER LastUsedTime;
  104. //
  105. // A referenced pointer to the owning UNC Provider
  106. //
  107. PUNC_PROVIDER UncProvider;
  108. //
  109. // If TRUE the Prefix string was allocated separately to this block.
  110. //
  111. BOOLEAN PrefixStringAllocated;
  112. //
  113. // If TRUE the Prefix string has been inserted in the prefix table
  114. //
  115. BOOLEAN InTable;
  116. //
  117. // If Active, the entry either is in the table or had been inserted in the
  118. // table at some point.
  119. BOOLEAN Active;
  120. //
  121. // Links for the linked list of entries
  122. //
  123. LIST_ENTRY ListEntry;
  124. } KNOWN_PREFIX, *PKNOWN_PREFIX;
  125. //
  126. // A File Control Block. The FCB corresponds to an open broadcast file,
  127. // i.e. a mailslot handle. We don't store any information about the FCB,
  128. // we let the various providers handle all of that.
  129. //
  130. typedef struct _FCB {
  131. BLOCK_HEADER BlockHeader;
  132. //
  133. // A pointer to the IO system's file object, that references this FCB.
  134. //
  135. PFILE_OBJECT FileObject;
  136. //
  137. // A list of CCBs for this FCB. The list is protected by MupCcbListLock.
  138. //
  139. LIST_ENTRY CcbList;
  140. } FCB, *PFCB;
  141. //
  142. // A CCB. The CCB is the per provider version of the FCB, all provider
  143. // specific information about an FCB is kept here.
  144. //
  145. typedef struct _CCB {
  146. BLOCK_HEADER BlockHeader;
  147. //
  148. // A referenced pointer to the FCB for this CCB.
  149. //
  150. PFCB Fcb;
  151. //
  152. // A list entry to keep this block on the FCB's CcbList.
  153. //
  154. LIST_ENTRY ListEntry;
  155. //
  156. // The file and device objects for this open file.
  157. //
  158. PDEVICE_OBJECT DeviceObject;
  159. PFILE_OBJECT FileObject;
  160. } CCB, *PCCB;
  161. //
  162. // The master and slave forward i/o context blocks are used to track
  163. // forward IRPs. Each forwarded IRP is tracked by the
  164. // Master Forwarded Io Context (which corresponds to our FCB) and a per
  165. // provider Io Context (which corresponse to our CCB).
  166. //
  167. // Since the Forwarded Io Context is never referenced or dereferenced it
  168. // doesn't get a block header.
  169. //
  170. typedef struct _MASTER_FORWARDED_IO_CONTEXT {
  171. BLOCK_HEADER BlockHeader;
  172. //
  173. // The original IRP (i.e. the one sent to the MUP) that is being handled.
  174. //
  175. PIRP OriginalIrp;
  176. //
  177. // The status that will be used to complete the Irp. If all the mailslot
  178. // writes fail (eg. a portable not in its docking station) then the status
  179. // from the last write will be returned. If one works then STATUS_SUCCESS.
  180. //
  181. //
  182. NTSTATUS SuccessStatus;
  183. NTSTATUS ErrorStatus;
  184. //
  185. // A referenced pointer to the FCB for this i/o.
  186. //
  187. PFCB Fcb;
  188. } MASTER_FORWARDED_IO_CONTEXT, *PMASTER_FORWARDED_IO_CONTEXT;
  189. typedef struct _FORWARDED_IO_CONTEXT {
  190. //
  191. // A referenced pointer to the CCB.
  192. //
  193. PCCB Ccb;
  194. //
  195. // A referenced pointer to the Master Context.
  196. //
  197. PMASTER_FORWARDED_IO_CONTEXT MasterContext;
  198. //
  199. // These structures are used for posting to the Ex worker threads.
  200. //
  201. WORK_QUEUE_ITEM WorkQueueItem;
  202. PDEVICE_OBJECT DeviceObject;
  203. PIRP pIrp;
  204. } FORWARDED_IO_CONTEXT, *PFORWARDED_IO_CONTEXT;
  205. //
  206. // The master and slave query path context blocks are used to track
  207. // create IRPs. Each forwarded IRP is tracked by the
  208. // Master query Path Context (which corresponds to our FCB) and a per
  209. // provider query path (which corresponse to our CCB).
  210. //
  211. // Since the query path context is never referenced or dereferenced it
  212. // doesn't get a block header.
  213. //
  214. typedef struct _MASTER_QUERY_PATH_CONTEXT {
  215. BLOCK_HEADER BlockHeader;
  216. //
  217. // A pointer to the original create IRP.
  218. //
  219. PIRP OriginalIrp;
  220. //
  221. // A pointer to the FileObject in the original create IRP.
  222. //
  223. PFILE_OBJECT FileObject;
  224. //
  225. // This is used to track the identity of the provider that will
  226. // receive the Create IRP.
  227. //
  228. PUNC_PROVIDER Provider;
  229. //
  230. // A lock to protect access to Provider
  231. //
  232. MUP_LOCK Lock;
  233. //
  234. // An unreferenced pointer to the newly allocated known prefix block.
  235. //
  236. PKNOWN_PREFIX KnownPrefix;
  237. //
  238. // The status code to be returned from this operation
  239. //
  240. NTSTATUS ErrorStatus;
  241. //
  242. // A list of QUERY_PATH_CONTEXTs outstadning for this MasterContext
  243. //
  244. LIST_ENTRY QueryList;
  245. //
  246. // The entry for this master context in the global list MupMasterQueryList
  247. //
  248. LIST_ENTRY MasterQueryList;
  249. } MASTER_QUERY_PATH_CONTEXT, *PMASTER_QUERY_PATH_CONTEXT;
  250. typedef struct _QUERY_PATH_CONTEXT {
  251. //
  252. // A referenced poitner to the master query path context block.
  253. //
  254. PMASTER_QUERY_PATH_CONTEXT MasterContext;
  255. //
  256. // A referenced pointer to the UNC provider we are querying.
  257. //
  258. PUNC_PROVIDER Provider;
  259. //
  260. // A pointer to the Device Io Control buffer we allocated to query
  261. // the above provider.
  262. //
  263. PVOID Buffer;
  264. //
  265. // The entry for this context in the MasterContext's QueryList
  266. //
  267. LIST_ENTRY QueryList;
  268. //
  269. // The IRP associated with this query context (i.e., the IRP sent to the UNC_PROVIDER)
  270. //
  271. PIRP QueryIrp;
  272. } QUERY_PATH_CONTEXT, *PQUERY_PATH_CONTEXT;
  273. #endif // _MUPSTRUC_