Поделиться через


NdisAdjustBufferLength function

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

NdisAdjustBufferLength modifies the length specified in a buffer descriptor allocated or copied by the caller.

Syntax

VOID NdisAdjustBufferLength(
  _In_ PNDIS_BUFFER Buffer,
  _In_ UINT         Length
);

Parameters

  • Buffer [in]
    Pointer to the buffer descriptor, previously allocated with NdisAllocateBuffer or NdisCopyBuffer.

  • Length [in]
    Specifies the new length in bytes to be set in the buffer descriptor.

Return value

None

Remarks

The caller of NdisAdjustBufferLength can pass only a buffer descriptor that was allocated by the caller. It cannot pass a buffer descriptor that was allocated by another driver.

For example, the driver of a bus-master DMA NIC calls this function with buffer descriptors that it allocated to specify receive buffers in its shared memory block. Before such a driver indicates received data, it calls NdisAdjustBufferLength to make the buffer 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. When a receive packet with such an adjusted buffer descriptor has been consumed and returned to the miniport driver, the driver again calls NdisAdjustBufferLength to make the buffer descriptor match the actual size of its receive buffer again.

The Length passed to NdisAdjustBufferLength cannot be larger than the Length that was passed to NdisAllocateBuffer or NdisCopyBuffer when the buffer descriptor was allocated.

The caller of NdisAdjustBufferLength must restore the length to its original value before it frees the buffer descriptor with NdisFreeBuffer.

The driver must release any spin lock it is currently holding before calling NdisAdjustBufferLength.

Requirements

Target platform

Universal

Version

Not supported for NDIS 6.0 drivers in Windows Vista. Supported for NDIS 5.1 drivers in Windows Vista and Windows XP.

Header

Ndis.h (include Ndis.h)

Library

Ndis.lib

IRQL

Any level (but typically run at IRQL <= DISPATCH_LEVEL)

See also

NdisAllocateBuffer

NdisCopyBuffer

NdisFreeBuffer

NdisReleaseSpinLock

 

 

Send comments about this topic to Microsoft