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.

464 lines
10 KiB

  1. /*++
  2. Copyright (c) 1989 - 1999 Microsoft Corporation
  3. Module Name:
  4. mrxglobs.h
  5. Abstract:
  6. The global include file for NULMRX mini-redirector
  7. --*/
  8. #ifndef _MRXGLOBS_H_
  9. #define _MRXGLOBS_H_
  10. extern PRDBSS_DEVICE_OBJECT NulMRxDeviceObject;
  11. #define RxNetNameTable (*(*___MINIRDR_IMPORTS_NAME).pRxNetNameTable)
  12. // The following enum type defines the various states associated with the null
  13. // mini redirector. This is used during initialization
  14. typedef enum _NULMRX_STATE_ {
  15. NULMRX_STARTABLE,
  16. NULMRX_START_IN_PROGRESS,
  17. NULMRX_STARTED
  18. } NULMRX_STATE,*PNULMRX_STATE;
  19. extern NULMRX_STATE NulMRxState;
  20. extern ULONG LogRate;
  21. extern ULONG NulMRxVersion;
  22. //
  23. // Reg keys
  24. //
  25. #define NULL_MINIRDR_PARAMETERS \
  26. L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\NulMRx\\Parameters"
  27. //
  28. // Use the RxDefineObj and RxCheckObj macros
  29. // to enforce signed structs.
  30. //
  31. #define RxDefineObj( type, var ) \
  32. var.Signature = type##_SIGNATURE;
  33. #define RxCheckObj( type, var ) \
  34. ASSERT( (var).Signature == type##_SIGNATURE );
  35. //
  36. // Use the RxDefineNode and RxCheckNode macros
  37. // to enforce node signatures and sizes.
  38. //
  39. #define RxDefineNode( node, type ) \
  40. node->NodeTypeCode = NTC_##type; \
  41. node->NodeByteSize = sizeof(type);
  42. #define RxCheckNode( node, type ) \
  43. ASSERT( NodeType(node) == NTC_##type );
  44. //
  45. // struct node types - start from 0xFF00
  46. //
  47. typedef enum _NULMRX_STORAGE_TYPE_CODES {
  48. NTC_NULMRX_DEVICE_EXTENSION = (NODE_TYPE_CODE)0xFF00,
  49. NTC_NULMRX_SRVCALL_EXTENSION = (NODE_TYPE_CODE)0xFF01,
  50. NTC_NULMRX_NETROOT_EXTENSION = (NODE_TYPE_CODE)0xFF02,
  51. NTC_NULMRX_FCB_EXTENSION = (NODE_TYPE_CODE)0xFF03
  52. } NULMRX_STORAGE_TYPE_CODES;
  53. //
  54. // typedef our device extension - stores state global to the driver
  55. //
  56. typedef struct _NULMRX_DEVICE_EXTENSION {
  57. //
  58. // Node type code and size
  59. //
  60. NODE_TYPE_CODE NodeTypeCode;
  61. NODE_BYTE_SIZE NodeByteSize;
  62. //
  63. // Back-pointer to owning device object
  64. //
  65. PRDBSS_DEVICE_OBJECT DeviceObject;
  66. //
  67. // Count of active nodes
  68. // Driver can be unloaded iff ActiveNodes == 0
  69. //
  70. ULONG ActiveNodes;
  71. // Keep a list of local connections used
  72. CHAR LocalConnections[26];
  73. FAST_MUTEX LCMutex;
  74. } NULMRX_DEVICE_EXTENSION, *PNULMRX_DEVICE_EXTENSION;
  75. //
  76. // typedef our srv-call extension - stores state global to a node
  77. // NYI since wrapper does not allocate space for this..........!
  78. //
  79. typedef struct _NULMRX_SRVCALL_EXTENSION {
  80. //
  81. // Node type code and size
  82. //
  83. NODE_TYPE_CODE NodeTypeCode;
  84. NODE_BYTE_SIZE NodeByteSize;
  85. } NULMRX_SRVCALL_EXTENSION, *PNULMRX_SRVCALL_EXTENSION;
  86. //
  87. // NET_ROOT extension - stores state global to a root
  88. //
  89. typedef struct _NULMRX_NETROOT_EXTENSION {
  90. //
  91. // Node type code and size
  92. //
  93. NODE_TYPE_CODE NodeTypeCode;
  94. NODE_BYTE_SIZE NodeByteSize;
  95. } NULMRX_NETROOT_EXTENSION, *PNULMRX_NETROOT_EXTENSION;
  96. //
  97. // reinitialize netroot data
  98. //
  99. #define RxResetNetRootExtension(pNetRootExtension) \
  100. RxDefineNode(pNetRootExtension,NULMRX_NETROOT_EXTENSION);
  101. //
  102. // typedef our FCB extension
  103. // the FCB uniquely represents an IFS stream
  104. // NOTE: Since we are not a paging file, this mem is paged !!!
  105. //
  106. typedef struct _NULMRX_FCB_EXTENSION_ {
  107. //
  108. // Node type code and size
  109. //
  110. NODE_TYPE_CODE NodeTypeCode;
  111. NODE_BYTE_SIZE NodeByteSize;
  112. } NULMRX_FCB_EXTENSION, *PNULMRX_FCB_EXTENSION;
  113. //
  114. // Macros to get & validate extensions
  115. //
  116. #define NulMRxGetDeviceExtension(RxContext,pExt) \
  117. PNULMRX_DEVICE_EXTENSION pExt = (PNULMRX_DEVICE_EXTENSION)((PBYTE)(RxContext->RxDeviceObject) + sizeof(RDBSS_DEVICE_OBJECT))
  118. #define NulMRxGetSrvCallExtension(pSrvCall, pExt) \
  119. PNULMRX_SRVCALL_EXTENSION pExt = (((pSrvCall) == NULL) ? NULL : (PNULMRX_SRVCALL_EXTENSION)((pSrvCall)->Context))
  120. #define NulMRxGetNetRootExtension(pNetRoot,pExt) \
  121. PNULMRX_NETROOT_EXTENSION pExt = (((pNetRoot) == NULL) ? NULL : (PNULMRX_NETROOT_EXTENSION)((pNetRoot)->Context))
  122. #define NulMRxGetFcbExtension(pFcb,pExt) \
  123. PNULMRX_FCB_EXTENSION pExt = (((pFcb) == NULL) ? NULL : (PNULMRX_FCB_EXTENSION)((pFcb)->Context))
  124. //
  125. // forward declarations for all dispatch vector methods.
  126. //
  127. extern NTSTATUS
  128. NulMRxStart (
  129. IN OUT struct _RX_CONTEXT * RxContext,
  130. IN OUT PRDBSS_DEVICE_OBJECT RxDeviceObject
  131. );
  132. extern NTSTATUS
  133. NulMRxStop (
  134. IN OUT struct _RX_CONTEXT * RxContext,
  135. IN OUT PRDBSS_DEVICE_OBJECT RxDeviceObject
  136. );
  137. extern NTSTATUS
  138. NulMRxMinirdrControl (
  139. IN OUT PRX_CONTEXT RxContext,
  140. IN OUT PVOID pContext,
  141. IN OUT PUCHAR SharedBuffer,
  142. IN ULONG InputBufferLength,
  143. IN ULONG OutputBufferLength,
  144. OUT PULONG CopyBackLength
  145. );
  146. extern NTSTATUS
  147. NulMRxDevFcb (
  148. IN OUT PRX_CONTEXT RxContext
  149. );
  150. extern NTSTATUS
  151. NulMRxDevFcbXXXControlFile (
  152. IN OUT PRX_CONTEXT RxContext
  153. );
  154. extern NTSTATUS
  155. NulMRxCreate (
  156. IN OUT PRX_CONTEXT RxContext
  157. );
  158. extern NTSTATUS
  159. NulMRxCollapseOpen (
  160. IN OUT PRX_CONTEXT RxContext
  161. );
  162. extern NTSTATUS
  163. NulMRxShouldTryToCollapseThisOpen (
  164. IN OUT PRX_CONTEXT RxContext
  165. );
  166. extern NTSTATUS
  167. NulMRxRead (
  168. IN OUT PRX_CONTEXT RxContext
  169. );
  170. extern NTSTATUS
  171. NulMRxWrite (
  172. IN OUT PRX_CONTEXT RxContext
  173. );
  174. extern NTSTATUS
  175. NulMRxLocks(
  176. IN OUT PRX_CONTEXT RxContext
  177. );
  178. extern NTSTATUS
  179. NulMRxFlush(
  180. IN OUT PRX_CONTEXT RxContext
  181. );
  182. extern NTSTATUS
  183. NulMRxFsCtl(
  184. IN OUT PRX_CONTEXT RxContext
  185. );
  186. NTSTATUS
  187. NulMRxIoCtl(
  188. IN OUT PRX_CONTEXT RxContext
  189. );
  190. extern NTSTATUS
  191. NulMRxNotifyChangeDirectory(
  192. IN OUT PRX_CONTEXT RxContext
  193. );
  194. extern NTSTATUS
  195. NulMRxComputeNewBufferingState(
  196. IN OUT PMRX_SRV_OPEN pSrvOpen,
  197. IN PVOID pMRxContext,
  198. OUT ULONG *pNewBufferingState);
  199. extern NTSTATUS
  200. NulMRxFlush (
  201. IN OUT PRX_CONTEXT RxContext
  202. );
  203. extern NTSTATUS
  204. NulMRxCloseWithDelete (
  205. IN OUT PRX_CONTEXT RxContext
  206. );
  207. extern NTSTATUS
  208. NulMRxZeroExtend (
  209. IN OUT PRX_CONTEXT RxContext
  210. );
  211. extern NTSTATUS
  212. NulMRxTruncate (
  213. IN OUT PRX_CONTEXT RxContext
  214. );
  215. extern NTSTATUS
  216. NulMRxCleanupFobx (
  217. IN OUT PRX_CONTEXT RxContext
  218. );
  219. extern NTSTATUS
  220. NulMRxCloseSrvOpen (
  221. IN OUT PRX_CONTEXT RxContext
  222. );
  223. extern NTSTATUS
  224. NulMRxClosedSrvOpenTimeOut (
  225. IN OUT PRX_CONTEXT RxContext
  226. );
  227. extern NTSTATUS
  228. NulMRxQueryDirectory (
  229. IN OUT PRX_CONTEXT RxContext
  230. );
  231. extern NTSTATUS
  232. NulMRxQueryEaInformation (
  233. IN OUT PRX_CONTEXT RxContext
  234. );
  235. extern NTSTATUS
  236. NulMRxSetEaInformation (
  237. IN OUT struct _RX_CONTEXT * RxContext
  238. );
  239. extern NTSTATUS
  240. NulMRxQuerySecurityInformation (
  241. IN OUT PRX_CONTEXT RxContext
  242. );
  243. extern NTSTATUS
  244. NulMRxSetSecurityInformation (
  245. IN OUT struct _RX_CONTEXT * RxContext
  246. );
  247. extern NTSTATUS
  248. NulMRxQueryVolumeInformation (
  249. IN OUT PRX_CONTEXT RxContext
  250. );
  251. extern NTSTATUS
  252. NulMRxSetVolumeInformation (
  253. IN OUT PRX_CONTEXT RxContext
  254. );
  255. extern NTSTATUS
  256. NulMRxLowIOSubmit (
  257. IN OUT PRX_CONTEXT RxContext
  258. );
  259. extern NTSTATUS
  260. NulMRxCreateVNetRoot(
  261. IN OUT PMRX_CREATENETROOT_CONTEXT pContext
  262. );
  263. extern NTSTATUS
  264. NulMRxFinalizeVNetRoot(
  265. IN OUT PMRX_V_NET_ROOT pVirtualNetRoot,
  266. IN PBOOLEAN ForceDisconnect);
  267. extern NTSTATUS
  268. NulMRxFinalizeNetRoot(
  269. IN OUT PMRX_NET_ROOT pNetRoot,
  270. IN PBOOLEAN ForceDisconnect);
  271. extern NTSTATUS
  272. NulMRxUpdateNetRootState(
  273. IN PMRX_NET_ROOT pNetRoot);
  274. VOID
  275. NulMRxExtractNetRootName(
  276. IN PUNICODE_STRING FilePathName,
  277. IN PMRX_SRV_CALL SrvCall,
  278. OUT PUNICODE_STRING NetRootName,
  279. OUT PUNICODE_STRING RestOfName OPTIONAL
  280. );
  281. extern NTSTATUS
  282. NulMRxCreateSrvCall(
  283. PMRX_SRV_CALL pSrvCall,
  284. PMRX_SRVCALL_CALLBACK_CONTEXT pCallbackContext);
  285. extern NTSTATUS
  286. NulMRxFinalizeSrvCall(
  287. PMRX_SRV_CALL pSrvCall,
  288. BOOLEAN Force);
  289. extern NTSTATUS
  290. NulMRxSrvCallWinnerNotify(
  291. IN OUT PMRX_SRV_CALL pSrvCall,
  292. IN BOOLEAN ThisMinirdrIsTheWinner,
  293. IN OUT PVOID pSrvCallContext);
  294. extern NTSTATUS
  295. NulMRxQueryFileInformation (
  296. IN OUT PRX_CONTEXT RxContext
  297. );
  298. extern NTSTATUS
  299. NulMRxQueryNamedPipeInformation (
  300. IN OUT PRX_CONTEXT RxContext,
  301. IN FILE_INFORMATION_CLASS FileInformationClass,
  302. IN OUT PVOID Buffer,
  303. IN OUT PULONG pLengthRemaining
  304. );
  305. extern NTSTATUS
  306. NulMRxSetFileInformation (
  307. IN OUT PRX_CONTEXT RxContext
  308. );
  309. extern NTSTATUS
  310. NulMRxSetNamedPipeInformation (
  311. IN OUT PRX_CONTEXT RxContext,
  312. IN FILE_INFORMATION_CLASS FileInformationClass,
  313. IN PVOID pBuffer,
  314. IN ULONG BufferLength
  315. );
  316. NTSTATUS
  317. NulMRxSetFileInformationAtCleanup(
  318. IN OUT PRX_CONTEXT RxContext
  319. );
  320. NTSTATUS
  321. NulMRxDeallocateForFcb (
  322. IN OUT PMRX_FCB pFcb
  323. );
  324. NTSTATUS
  325. NulMRxDeallocateForFobx (
  326. IN OUT PMRX_FOBX pFobx
  327. );
  328. extern NTSTATUS
  329. NulMRxForcedClose (
  330. IN OUT PMRX_SRV_OPEN SrvOpen
  331. );
  332. extern NTSTATUS
  333. NulMRxExtendFile (
  334. IN OUT struct _RX_CONTEXT * RxContext,
  335. IN OUT PLARGE_INTEGER pNewFileSize,
  336. OUT PLARGE_INTEGER pNewAllocationSize
  337. );
  338. extern NTSTATUS
  339. NulMRxTruncateFile (
  340. IN OUT struct _RX_CONTEXT * RxContext,
  341. IN OUT PLARGE_INTEGER pNewFileSize,
  342. OUT PLARGE_INTEGER pNewAllocationSize
  343. );
  344. extern NTSTATUS
  345. NulMRxCompleteBufferingStateChangeRequest (
  346. IN OUT PRX_CONTEXT RxContext,
  347. IN OUT PMRX_SRV_OPEN SrvOpen,
  348. IN PVOID pContext
  349. );
  350. extern NTSTATUS
  351. NulMRxExtendForCache (
  352. IN OUT PRX_CONTEXT RxContext,
  353. IN OUT PFCB Fcb,
  354. OUT PLONGLONG pNewFileSize
  355. );
  356. extern
  357. NTSTATUS
  358. NulMRxInitializeTransport(VOID);
  359. extern
  360. NTSTATUS
  361. NulMRxUninitializeTransport(VOID);
  362. #define NulMRxMakeSrvOpenKey(Tid,Fid) \
  363. (PVOID)(((ULONG)(Tid) << 16) | (ULONG)(Fid))
  364. #include "mrxprocs.h" // crossreferenced routines
  365. #endif _MRXGLOBS_H_