NdisAdjustMdlLength function

The NdisAdjustMdlLength function modifies the length of the data that is associated with an MDL.


VOID NdisAdjustMdlLength(
  _In_ PMDL Mdl,
  _In_ UINT Length


Mdl [in]

A pointer to a memory descriptor list (MDL).

Length [in]

The number of bytes of data that the MDL describes.

Return value



The NdisAdjustMdlLength function modifies the ByteCount member of an MDL that was allocated by calling the NdisAllocateMdl function.

The caller of NdisAdjustMdlLength can pass only an MDL descriptor that the caller allocated. It cannot pass an MDL descriptor that another driver allocated.

For example, the driver of a bus-master DMA NIC calls NdisAdjustMdlLength with MDL descriptors that it allocated to specify receive MDLs in its shared memory block. Before such a driver indicates received data, it calls NdisAdjustMdlLength to make the MDL descriptor that it will include in the receive indication match the size of the received data if it is less than the size of the NIC's receive buffer.

The length that is passed to NdisAdjustMdlLength cannot be larger than the length that was passed to NdisAllocateMdl when the MDL descriptor was allocated.

The caller of NdisAdjustMdlLength must restore the length to its original value before it frees the MDL descriptor with NdisFreeMdl.

Callers of NdisAdjustMdlLength can run at any IRQL, but typically run at IRQL <= DISPATCH_LEVEL.


Target platform


Supported in NDIS 6.0 and later.


Ndis.h (include Ndis.h)


Any level (see Remarks section)

See also




Send comments about this topic to Microsoft

© 2016 Microsoft