Ioallocatemdl
IoallocatemdlFunction allocation is sufficient to map a piece of cached MDL to give the starting address and length of the cache.
Pmdl
Ioallocatemdl (
_ In_opt pvoid Virtualaddress,
_ In ulong Length,
_ In Boolean Secondarybuffer,
_ In Boolean Chargequota,
_ Inout_opt pirp IRP Optional
);
The driver can useIoallocatemdlFunction to achieve the purpose of large cache shards, map a small part of the cache through an independent MDL, or map the memory allocated by the driver. The driver will callMmbuildmdlfornonpagedpoolTo set the MDL memory so that the MDL describes that the cache allocated by the driver is not replaceable.
LengthThe parameter specifies the size of the cache to which MDL points. In Windows Server 2003, Windows XP, and Windows 2000, the maximum number of cache bytes that can be allocated is page_size * (65535-Sizeof(MDL ))/Sizeof(Ulong_ptr ). In Windows Vista and Windows Server 2008, the maximum number of cached bytes is (2 GB-page_size ). in Windows 7 and Windows Server 2008 R2, the maximum number of cached bytes is (4 GB-page_size ).
IfSecondarybufferThe parameter is false. This function is updated.IRP->MdladdressLet it point to a new MDL, that is, let it support large cache fragments. IfSecondarybufferTrue. This function adds MDLIRP->MdladdressAfter the link.