Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Driver Kit
Network
Reference
 NdisGetDataBuffer

  Switch on low bandwidth view
Windows Driver Kit: Network Devices and Protocols
NdisGetDataBuffer

Call the NdisGetDataBuffer function to gain access to a contiguous block of data from a NET_BUFFER structure.

PVOID
  NdisGetDataBuffer(
    IN PNET_BUFFER  NetBuffer,
    IN ULONG  BytesNeeded,
    IN PVOID  Storage,
    IN UINT   AlignMultiple,
    IN UINT   AlignOffset
    ); 

Parameters

NetBuffer
A pointer to a NET_BUFFER structure.
BytesNeeded
The number of contiguous bytes of data requested.
Storage
A pointer to a buffer, or NULL if no buffer is provided by the caller. The buffer must be greater than or equal in size to the number of bytes specified in BytesNeeded. If this value is non-NULL, and the data requested is not contiguous, NDIS copies the requested data to the area indicated by Storage.
AlignMultiple
The alignment multiple expressed in power of two. For example, 2, 4, 8, 16, and so forth. If AlignMultiple is 1, then there is no alignment requirement.
AlignOffset
The offset, in bytes, from the alignment multiple.

Return Value

NdisGetDataBuffer returns a pointer to the start of the contiguous data or it returns NULL.

If the DataLength member of the NET_BUFFER_DATA structure in the NET_BUFFER structure that the NetBuffer parameter points to is less than the value in the BytesNeeded parameter, the return value is NULL.

If the requested data in the buffer is contiguous, this return value is a pointer to a location that NDIS provides. If the data is not contiguous, NDIS uses the Storage parameter as follows:

  • If the Storage parameter is non-NULL, NDIS copies the data to the buffer at Storage. This return value is the pointer passed to the Storage parameter.
  • If the Storage parameter is NULL, this return value is NULL.

Comments

Call this function to get a pointer to a network data header contained in the NET_BUFFER structure. You can easily parse the header stored in the contiguous data block that this function returns.

The requested alignment requirement is expressed as a power-of-two multiple plus an offset. For example, if AlignMultiple is 4 and AlignOffset is 3 then the data address should be a multiple of 4 plus 3. If necessary, NDIS will allocate memory to satisfy the alignment requirement.

Requirements

Versions: Supported for NDIS 6.0 drivers in Windows Vista.

IRQL: <= DISPATCH_LEVEL

Headers: Declared in Ndis.h. Include Ndis.h.

See Also

NET_BUFFER, NET_BUFFER_DATA


Send feedback on this topic
Built on May 31, 2009
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker