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.

907 lines
19 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. msfuncs.h
  5. Abstract:
  6. This module defines all of the globally used procedures in the
  7. mailslot file system. It also defines the functions that are
  8. implemented as macros.
  9. Author:
  10. Manny Weiser (mannyw) 7-Jan-1991
  11. Revision History:
  12. --*/
  13. #ifndef _MSFUNCS_
  14. #define _MSFUNCS_
  15. //
  16. // Internal mailslot data Structure Routines, implemented in strucsup.c.
  17. // These routines maniuplate the in memory data structures.
  18. //
  19. NTSTATUS
  20. MsInitializeData (
  21. VOID
  22. );
  23. VOID
  24. MsUninitializeData(
  25. VOID
  26. );
  27. VOID
  28. MsInitializeVcb (
  29. IN PVCB Vcb
  30. );
  31. VOID
  32. MsDeleteVcb (
  33. IN PVCB Vcb
  34. );
  35. PROOT_DCB
  36. MsCreateRootDcb (
  37. IN PVCB Vcb
  38. );
  39. VOID
  40. MsDeleteRootDcb (
  41. IN PROOT_DCB Dcb
  42. );
  43. NTSTATUS
  44. MsCreateFcb (
  45. IN PVCB Vcb,
  46. IN PDCB ParentDcb,
  47. IN PUNICODE_STRING FileName,
  48. IN PEPROCESS CreatorProcess,
  49. IN ULONG MailslotQuota,
  50. IN ULONG MaximumMessageSize,
  51. OUT PFCB *ppFcb
  52. );
  53. VOID
  54. MsDeleteFcb (
  55. IN PFCB Fcb
  56. );
  57. NTSTATUS
  58. MsCreateCcb (
  59. IN PFCB Fcb,
  60. OUT PCCB *ppCcb
  61. );
  62. PROOT_DCB_CCB
  63. MsCreateRootDcbCcb (
  64. IN PROOT_DCB RootDcb,
  65. IN PVCB Vcb
  66. );
  67. VOID
  68. MsDeleteCcb (
  69. IN PCCB Ccb
  70. );
  71. VOID
  72. MsDereferenceNode (
  73. IN PNODE_HEADER NodeHeader
  74. );
  75. VOID
  76. MsDereferenceVcb (
  77. IN PVCB Vcb
  78. );
  79. VOID
  80. MsReferenceVcb (
  81. IN PVCB Vcb
  82. );
  83. VOID
  84. MsReferenceRootDcb (
  85. IN PROOT_DCB RootDcb
  86. );
  87. VOID
  88. MsDereferenceRootDcb (
  89. IN PROOT_DCB RootDcb
  90. );
  91. VOID
  92. MsDereferenceFcb (
  93. IN PFCB Fcb
  94. );
  95. VOID
  96. MsRemoveFcbName (
  97. IN PFCB Fcb
  98. );
  99. VOID
  100. MsDereferenceCcb (
  101. IN PCCB Ccb
  102. );
  103. //
  104. // Data queue support routines, implemented in DataSup.c
  105. //
  106. NTSTATUS
  107. MsInitializeDataQueue (
  108. IN PDATA_QUEUE DataQueue,
  109. IN PEPROCESS Process,
  110. IN ULONG Quota,
  111. IN ULONG MaximumMessageSize
  112. );
  113. VOID
  114. MsUninitializeDataQueue (
  115. IN PDATA_QUEUE DataQueue,
  116. IN PEPROCESS Process
  117. );
  118. NTSTATUS
  119. MsAddDataQueueEntry (
  120. IN PDATA_QUEUE DataQueue,
  121. IN QUEUE_STATE Who,
  122. IN ULONG DataSize,
  123. IN PIRP Irp,
  124. IN PWORK_CONTEXT WorkContext
  125. );
  126. PIRP
  127. MsRemoveDataQueueEntry (
  128. IN PDATA_QUEUE DataQueue,
  129. IN PDATA_ENTRY DataEntry
  130. );
  131. VOID
  132. MsRemoveDataQueueIrp (
  133. IN PIRP Irp,
  134. IN PDATA_QUEUE DataQueue
  135. );
  136. //
  137. // The follow routines provide common read/write data queue support
  138. // for buffered read/write, and peek
  139. //
  140. IO_STATUS_BLOCK
  141. MsReadDataQueue ( // implemented in ReadSup.c
  142. IN PDATA_QUEUE ReadQueue,
  143. IN ENTRY_TYPE Operation,
  144. IN PUCHAR ReadBuffer,
  145. IN ULONG ReadLength,
  146. OUT PULONG MessageLength
  147. );
  148. NTSTATUS
  149. MsWriteDataQueue ( // implemented in WriteSup.c
  150. IN PDATA_QUEUE WriteQueue,
  151. IN PUCHAR WriteBuffer,
  152. IN ULONG WriteLength
  153. );
  154. extern
  155. PIRP
  156. MsResetCancelRoutine(
  157. IN PIRP Irp
  158. );
  159. //
  160. // Largest matching prefix searching routines, implemented in PrefxSup.c
  161. //
  162. PFCB
  163. MsFindPrefix (
  164. IN PVCB Vcb,
  165. IN PUNICODE_STRING String,
  166. IN BOOLEAN CaseInsensitive,
  167. OUT PUNICODE_STRING RemainingPart
  168. );
  169. NTSTATUS
  170. MsFindRelativePrefix (
  171. IN PDCB Dcb,
  172. IN PUNICODE_STRING String,
  173. IN BOOLEAN CaseInsensitive,
  174. OUT PUNICODE_STRING RemainingPart,
  175. OUT PFCB *Fcb
  176. );
  177. //
  178. // The following routines are used to manipulate the fscontext fields of
  179. // a file object, implemented in FilObSup.c
  180. //
  181. VOID
  182. MsSetFileObject (
  183. IN PFILE_OBJECT FileObject OPTIONAL,
  184. IN PVOID FsContext,
  185. IN PVOID FsContext2
  186. );
  187. NODE_TYPE_CODE
  188. MsDecodeFileObject (
  189. IN PFILE_OBJECT FileObject,
  190. OUT PVOID *FsContext,
  191. OUT PVOID *FsContext2
  192. );
  193. //
  194. // The following routines are used to manipulate the input buffers and are
  195. // implemented in deviosup.c
  196. //
  197. VOID
  198. MsMapUserBuffer (
  199. IN OUT PIRP Irp,
  200. IN KPROCESSOR_MODE AccessMode,
  201. OUT PVOID *UserBuffer
  202. );
  203. //
  204. // Miscellaneous support routines
  205. //
  206. //
  207. // This is function is called at DPC level if a read timer expires.
  208. //
  209. VOID
  210. MsReadTimeoutHandler(
  211. IN PKDPC Dpc,
  212. IN PVOID DeferredContext,
  213. IN PVOID SystemArgument1,
  214. IN PVOID SystemArgument2
  215. );
  216. //
  217. // This macro returns TRUE if a flag in a set of flags is on and FALSE
  218. // otherwise.
  219. //
  220. #ifdef FlagOn
  221. #undef FlagOn
  222. #endif
  223. #define FlagOn(Flags,SingleFlag) ( \
  224. (BOOLEAN)(((Flags) & (SingleFlag)) != 0 ? TRUE : FALSE) \
  225. )
  226. //
  227. // This macro takes a pointer (or ulong) and returns its rounded up word
  228. // value.
  229. //
  230. #define WordAlign(Ptr) ( \
  231. ((((ULONG)(Ptr)) + 1) & 0xfffffffe) \
  232. )
  233. //
  234. // This macro takes a pointer (or ulong) and returns its rounded up longword
  235. // value.
  236. //
  237. #define LongAlign(Ptr) ( \
  238. ((((ULONG)(Ptr)) + 3) & 0xfffffffc) \
  239. )
  240. //
  241. // This macro takes a pointer (or ulong) and returns its rounded up quadword
  242. // value
  243. //
  244. #define QuadAlign(Ptr) ( \
  245. ((((ULONG)(Ptr)) + 7) & 0xfffffff8) \
  246. )
  247. //
  248. // The following types and macros are used to help unpack the packed and
  249. // misaligned fields found in the Bios parameter block
  250. //
  251. typedef union _UCHAR1 {
  252. UCHAR Uchar[1];
  253. UCHAR ForceAlignment;
  254. } UCHAR1, *PUCHAR1;
  255. typedef union _UCHAR2 {
  256. UCHAR Uchar[2];
  257. USHORT ForceAlignment;
  258. } UCHAR2, *PUCHAR2;
  259. typedef union _UCHAR4 {
  260. UCHAR Uchar[4];
  261. ULONG ForceAlignment;
  262. } UCHAR4, *PUCHAR4;
  263. //
  264. // This macro copies an unaligned src byte to an aligned dst byte
  265. //
  266. #define CopyUchar1(Dst,Src) { \
  267. *((UCHAR1 *)(Dst)) = *((UNALIGNED UCHAR1 *)(Src)); \
  268. }
  269. //
  270. // This macro copies an unaligned src word to an aligned dst word
  271. //
  272. #define CopyUchar2(Dst,Src) { \
  273. *((UCHAR2 *)(Dst)) = *((UNALIGNED UCHAR2 *)(Src)); \
  274. }
  275. //
  276. // This macro copies an unaligned src longword to an aligned dsr longword
  277. //
  278. #define CopyUchar4(Dst,Src) { \
  279. *((UCHAR4 *)(Dst)) = *((UNALIGNED UCHAR4 *)(Src)); \
  280. }
  281. //
  282. // The following routines/macros are used for gaining shared and exclusive
  283. // access to the global/vcb data structures. The routines are implemented
  284. // in ResrcSup.c. There is a global resources that everyone tries to take
  285. // out shared to do their work, with the exception of mount/dismount which
  286. // take out the global resource exclusive. All other resources only work
  287. // on their individual item. For example, an Fcb resource does not take out
  288. // a Vcb resource. But the way the file system is structured we know
  289. // that when we are processing an Fcb other threads cannot be trying to remove
  290. // or alter the Fcb, so we do not need to acquire the Vcb.
  291. //
  292. // The procedures/macros are:
  293. //
  294. // Macro Vcb Fcb Ccb Subsequent macros
  295. //
  296. // AcquireExclusiveVcb Read None None ReleaseVcb
  297. // Write
  298. //
  299. // AcquireSharedVcb Read None None ReleaseVcb
  300. //
  301. // AcquireExclusiveFcb None Read None ReleaseFcb
  302. // Write
  303. //
  304. // AcquireSharedFcb None Read None ReleaseFcb
  305. //
  306. // AcquireExclusiveCcb None None Read ReleaseCcb
  307. // Write
  308. //
  309. // AcquireSharedCcb None None Read ReleaseCcb
  310. //
  311. // ReleaseVcb
  312. //
  313. // ReleaseFcb
  314. //
  315. // ReleaseCcb
  316. //
  317. //
  318. // VOID
  319. // MsAcquireExclusiveVcb (
  320. // IN PVCB Vcb
  321. // );
  322. //
  323. // VOID
  324. // MsAcquireSharedVcb (
  325. // IN PVCB Vcb
  326. // );
  327. //
  328. // VOID
  329. // MsAcquireExclusiveFcb (
  330. // IN PFCB Fcb
  331. // );
  332. //
  333. // VOID
  334. // MsAcquireSharedFcb (
  335. // IN PFCB Fcb
  336. // );
  337. //
  338. // VOID
  339. // MsAcquireExclusiveCcb (
  340. // IN PCCB Ccb
  341. // );
  342. //
  343. // VOID
  344. // MsAcquireSharedCcb (
  345. // IN PCCB Ccb
  346. // );
  347. //
  348. // VOID
  349. // MsReleaseVcb (
  350. // IN PVCB Vcb
  351. // );
  352. //
  353. // VOID
  354. // MsReleaseFcb (
  355. // IN PFCB Fcb
  356. // );
  357. //
  358. // VOID
  359. // MsReleaseCcb (
  360. // IN PCCB NonpagedCcb
  361. // );
  362. //
  363. #define MsAcquireGlobalLock() ((VOID) \
  364. ExAcquireResourceExclusiveLite( MsGlobalResource, TRUE ) \
  365. )
  366. #define MsReleaseGlobalLock() ( \
  367. ExReleaseResourceLite( MsGlobalResource ) \
  368. )
  369. #define MsAcquireExclusiveVcb(VCB) ((VOID) \
  370. ExAcquireResourceExclusiveLite( &(VCB)->Resource, TRUE ) \
  371. )
  372. #define MsAcquireSharedVcb(VCB) ((VOID) \
  373. ExAcquireResourceSharedLite( &(VCB)->Resource, TRUE ) \
  374. )
  375. #define MsIsAcquiredExclusiveVcb(VCB) ExIsResourceAcquiredExclusiveLite( &(VCB)->Resource )
  376. #define MsAcquireExclusiveFcb(FCB) ((VOID) \
  377. ExAcquireResourceExclusiveLite( &(FCB)->Resource, TRUE ) \
  378. )
  379. #define MsAcquireSharedFcb(FCB) ((VOID) \
  380. ExAcquireResourceSharedLite( &(FCB)->Resource, TRUE ) \
  381. )
  382. #define MsReleaseVcb(VCB) { \
  383. ExReleaseResourceLite( &((VCB)->Resource) ); \
  384. }
  385. #define MsReleaseFcb(FCB) { \
  386. ExReleaseResourceLite( &((FCB)->Resource) ); \
  387. }
  388. //
  389. // The FSD Level dispatch routines. These routines are called by the
  390. // I/O system via the dispatch table in the Driver Object.
  391. //
  392. // They each accept as input a pointer to a device object (actually most
  393. // expect an msfs device object), and a pointer to the IRP.
  394. //
  395. NTSTATUS
  396. MsFsdCreate ( // implemented in Create.c
  397. IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,
  398. IN PIRP Irp
  399. );
  400. NTSTATUS
  401. MsFsdCreateMailslot ( // implemented in Createms.c
  402. IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,
  403. IN PIRP Irp
  404. );
  405. NTSTATUS
  406. MsFsdClose ( // implemented in Close.c
  407. IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,
  408. IN PIRP Irp
  409. );
  410. NTSTATUS
  411. MsFsdRead ( // implemented in Read.c
  412. IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,
  413. IN PIRP Irp
  414. );
  415. NTSTATUS
  416. MsFsdWrite ( // implemented in Write.c
  417. IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,
  418. IN PIRP Irp
  419. );
  420. NTSTATUS
  421. MsFsdQueryInformation ( // implemented in FileInfo.c
  422. IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,
  423. IN PIRP Irp
  424. );
  425. NTSTATUS
  426. MsFsdSetInformation ( // implemented in FileInfo.c
  427. IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,
  428. IN PIRP Irp
  429. );
  430. NTSTATUS
  431. MsFsdQueryVolumeInformation ( // implemented in VolInfo.c
  432. IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,
  433. IN PIRP Irp
  434. );
  435. NTSTATUS
  436. MsFsdCleanup ( // implemented in Cleanup.c
  437. IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,
  438. IN PIRP Irp
  439. );
  440. VOID
  441. MsCancelTimer ( // implemented in Cleanup.c
  442. IN PDATA_ENTRY DataEntry
  443. );
  444. NTSTATUS
  445. MsFsdDirectoryControl ( // implemented in Dir.c
  446. IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,
  447. IN PIRP Irp
  448. );
  449. NTSTATUS
  450. MsFsdFsControl ( // implemented in FsContrl.c
  451. IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,
  452. IN PIRP Irp
  453. );
  454. NTSTATUS
  455. MsFsdQuerySecurityInfo (
  456. IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,
  457. IN PIRP Irp
  458. );
  459. NTSTATUS
  460. MsFsdSetSecurityInfo (
  461. IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,
  462. IN PIRP Irp
  463. );
  464. //
  465. // The node verification functions. These functions verify that a node
  466. // is still active.
  467. //
  468. NTSTATUS
  469. MsVerifyFcb (
  470. IN PFCB Fcb
  471. );
  472. NTSTATUS
  473. MsVerifyCcb (
  474. IN PCCB Ccb
  475. );
  476. NTSTATUS
  477. MsVerifyDcbCcb (
  478. IN PROOT_DCB_CCB RootDcb
  479. );
  480. //
  481. // Miscellaneous routines.
  482. //
  483. VOID
  484. MsTimeoutRead ( // implemented in readsup.c
  485. IN PDEVICE_OBJECT DeviceObject,
  486. IN PVOID Context
  487. );
  488. VOID
  489. MsCheckForNotify ( // implemented in Dir.c
  490. IN PDCB Dcb,
  491. IN BOOLEAN CheckAllOutstandingIrps,
  492. IN NTSTATUS FinalStatus
  493. );
  494. VOID
  495. MsFlushNotifyForFile ( // implemented in Dir.c
  496. IN PDCB Dcb,
  497. IN PFILE_OBJECT FileObject
  498. );
  499. //
  500. // The following functions are used for MSFS exception handling
  501. //
  502. LONG
  503. MsExceptionFilter (
  504. IN NTSTATUS ExceptionCode
  505. );
  506. NTSTATUS
  507. MsProcessException (
  508. IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,
  509. IN PIRP Irp,
  510. IN NTSTATUS ExceptionCode
  511. );
  512. //
  513. // The following macro is used by the FSP and FSD routines to complete
  514. // an IRP.
  515. //
  516. #define MsCompleteRequest(IRP,STATUS) { \
  517. FsRtlCompleteRequest( (IRP), (STATUS) ); \
  518. }
  519. //
  520. // Reference count macros. These macro can be called only with
  521. // MsGlobalResource held.
  522. //
  523. #define MsReferenceNode( nodeHeader ) (nodeHeader)->ReferenceCount++;
  524. //
  525. // Debugging functions.
  526. //
  527. #ifdef MSDBG
  528. VOID
  529. _DebugTrace(
  530. LONG Indent,
  531. ULONG Level,
  532. PSZ X,
  533. ULONG Y
  534. );
  535. #endif
  536. //
  537. // The following macros are used to establish the semantics needed
  538. // to do a return from within a try-finally clause. As a rule every
  539. // try clause must end with a label call try_exit. For example,
  540. //
  541. // try {
  542. // :
  543. // :
  544. //
  545. // try_exit: NOTHING;
  546. // } finally {
  547. //
  548. // :
  549. // :
  550. // }
  551. //
  552. // Every return statement executed inside of a try clause should use the
  553. // try_return macro. If the compiler fully supports the try-finally construct
  554. // then the macro should be
  555. //
  556. // #define try_return(S) { return(S); }
  557. //
  558. // If the compiler does not support the try-finally construct then the macro
  559. // should be
  560. //
  561. // #define try_return(S) { S; goto try_exit; }
  562. //
  563. #define try_return(S) { S; goto try_exit; }
  564. //
  565. // The following macros queries the state of data queues
  566. //
  567. //
  568. // BOOLEAN
  569. // MsIsDataQueueEmpty (
  570. // IN PDATA_QUEUE DataQueue
  571. // )
  572. //
  573. // Routine Description:
  574. //
  575. // This routine indicates to the caller if the data queue is empty.
  576. //
  577. // Arguments:
  578. //
  579. // DataQueue - Supplies a pointer to the data queue being queried
  580. //
  581. // Return Value:
  582. //
  583. // BOOLEAN - TRUE if the queue is empty and FALSE otherwise.
  584. //
  585. #define MsIsDataQueueEmpty( _dataQueue ) \
  586. ((BOOLEAN) IsListEmpty(&(_dataQueue)->DataEntryList))
  587. //
  588. // BOOLEAN
  589. // MsIsDataQueueReaders (
  590. // IN PDATA_QUEUE DataQueue
  591. // )
  592. //
  593. // Routine Description:
  594. //
  595. // This routine indicates to the caller if the data queue is full of
  596. // read requests.
  597. //
  598. // Arguments:
  599. //
  600. // DataQueue - Supplies a pointer to the data queue being queried
  601. //
  602. // Return Value:
  603. //
  604. // BOOLEAN - TRUE if the queue contains read requests and FALSE otherwise
  605. //
  606. #define MsIsDataQueueReaders( _dataQueue ) \
  607. ((BOOLEAN) ((_dataQueue)->QueueState == ReadEntries))
  608. //
  609. // BOOLEAN
  610. // MsIsDataQueueWriters (
  611. // IN PDATA_QUEUE DataQueue
  612. // )
  613. //
  614. // Routine Description:
  615. //
  616. // This routine indicates to the caller if the data queue is full of
  617. // write requests.
  618. //
  619. // Arguments:
  620. //
  621. // DataQueue - Supplies a pointer to the data queue being queried
  622. //
  623. // Return Value:
  624. //
  625. // BOOLEAN - TRUE if the queue contains write requests and FALSE otherwise
  626. #define MsIsDataQueueWriters( _dataQueue ) \
  627. ((BOOLEAN)((_dataQueue)->QueueState == WriteEntries))
  628. //
  629. // PLIST_ENTRY
  630. // MsGetNextDataQueueEntry (
  631. // IN PDATA_QUEUE DataQueue
  632. // )
  633. //
  634. // Routine Description:
  635. //
  636. // This routine will return a pointer to the next data queue entry in the
  637. // indicated data queue without changing any of the data queue.
  638. //
  639. // Arguments:
  640. //
  641. // DataQueue - Supplies a pointer to the data queue being queried.
  642. //
  643. // Return Value:
  644. //
  645. // PLIST_ENTRY - Returns a pointer to the next data queue entry.
  646. //
  647. #define MsGetNextDataQueueEntry( _dataQueue ) \
  648. (_dataQueue)->DataEntryList.Flink
  649. #define MsIrpDataQueue(Irp) \
  650. ((Irp)->Tail.Overlay.DriverContext[0])
  651. #define MsIrpChargedQuota(Irp) \
  652. ((Irp)->Tail.Overlay.DriverContext[1])
  653. #define MsIrpWorkContext(Irp) \
  654. ((Irp)->Tail.Overlay.DriverContext[2])
  655. //
  656. // PVOID
  657. // MsAllocatePagedPool (
  658. // IN ULONG Size,
  659. // IN ULONG Tag)
  660. // Routine Description:
  661. //
  662. // This routine will return a pointer to paged pool or NULL if no memory exists.
  663. //
  664. // Arguments:
  665. //
  666. // Size - Size of memory to allocate
  667. // Tag - Tag to use for the pool allocation
  668. //
  669. // Return Value:
  670. //
  671. // PVOID - pointer to allocated memory or null
  672. //
  673. #define MsAllocatePagedPool( Size, Tag) \
  674. ExAllocatePoolWithTag( PagedPool, Size, Tag )
  675. #define MsAllocatePagedPoolCold( Size, Tag) \
  676. ExAllocatePoolWithTag( (PagedPool|POOL_COLD_ALLOCATION), Size, Tag )
  677. //
  678. // PVOID
  679. // MsAllocateNonPagedPool (
  680. // IN ULONG Size,
  681. // IN ULONG Tag)
  682. // Routine Description:
  683. //
  684. // This routine will return a pointer to paged pool or NULL if no memory exists.
  685. //
  686. // Arguments:
  687. //
  688. // Size - Size of memory to allocate
  689. // Tag - Tag to use for the pool allocation
  690. //
  691. // Return Value:
  692. //
  693. // PVOID - pointer to allocated memory or null
  694. //
  695. #define MsAllocateNonPagedPool( Size, Tag) \
  696. ExAllocatePoolWithTag( NonPagedPool, Size, Tag )
  697. //
  698. // PVOID
  699. // MsAllocatePagedPoolWithQuota (
  700. // IN ULONG Size,
  701. // IN ULONG Tag)
  702. // Routine Description:
  703. //
  704. // This routine will return a pointer to charged paged pool or NULL if no memory exists.
  705. //
  706. // Arguments:
  707. //
  708. // Size - Size of memory to allocate
  709. // Tag - Tag to use for the pool allocation
  710. //
  711. // Return Value:
  712. //
  713. // PVOID - pointer to allocated memory or null
  714. //
  715. #define MsAllocatePagedPoolWithQuota( Size, Tag) \
  716. ExAllocatePoolWithQuotaTag( PagedPool|POOL_QUOTA_FAIL_INSTEAD_OF_RAISE, Size, Tag )
  717. #define MsAllocatePagedPoolWithQuotaCold( Size, Tag) \
  718. ExAllocatePoolWithQuotaTag( PagedPool|POOL_QUOTA_FAIL_INSTEAD_OF_RAISE|POOL_COLD_ALLOCATION, Size, Tag )
  719. //
  720. // PVOID
  721. // MsAllocateNonPagedPoolWithQuota (
  722. // IN ULONG Size,
  723. // IN ULONG Tag)
  724. // Routine Description:
  725. //
  726. // This routine will return a charged pointer to non-paged pool or NULL if no memory exists.
  727. //
  728. // Arguments:
  729. //
  730. // Size - Size of memory to allocate
  731. // Tag - Tag to use for the pool allocation
  732. //
  733. // Return Value:
  734. //
  735. // PVOID - pointer to allocated memory or null
  736. //
  737. #define MsAllocateNonPagedPoolWithQuota( Size, Tag) \
  738. ExAllocatePoolWithQuotaTag( NonPagedPool|POOL_QUOTA_FAIL_INSTEAD_OF_RAISE, Size, Tag )
  739. //
  740. // VOID
  741. // MsFreePool (
  742. // IN PVOID Mem)
  743. //
  744. // Routine Description:
  745. //
  746. //
  747. //
  748. // Arguments:
  749. //
  750. // Mem - Memory to be freed
  751. //
  752. // Return Value:
  753. //
  754. // None
  755. //
  756. #define MsFreePool(Mem) ExFreePool (Mem)
  757. #endif // _MSFUNCS_
  758.