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.
NDIS_OOB_DATA_FROM_PACKET returns a pointer to the out-of-band data block associated with a given packet descriptor.
- Packet [in]
Pointer to a packet descriptor.
NDIS_OOB_DATA_FROM_PACKET returns a pointer to the out-of-band data block associated with the given packet descriptor, or it returns NULL if there is no out-of-band information for the packet.
Lower-level NDIS drivers that supply out-of-band information with the packet descriptors they allocate for indications can use NDIS_OOB_DATA_FROM_PACKET to gain access to the out-of-band block associated with a driver-allocated packet descriptor. Such a driver would then set up out-of-band information before indicating a receive packet.
For example, an NDIS intermediate driver might copy the out-of-band information from a received packet into a fresh packet descriptor with NdisMoveMemory before forwarding the indication up to bound protocols. In these circumstances, the intermediate driver calls NdisMoveMemory with the pointers returned by NDIS_OOB_DATA_FROM_PACKET as the Source and Destination pointers and sizeof(NDIS_PACKET_OOB_DATA) as the Length.
Lower-level NDIS drivers also might use this macro when the Status of an indicated packet is returned from NdisMIndicateReceivePacket with NDIS_STATUS_SUCCESS or when MiniportReturnPacket is called with a packet descriptor to be reinitialized for reuse. In these circumstances, the driver can call NdisZeroMemory with the pointer returned by NDIS_OOB_DATA_FROM_PACKET and sizeof(NDIS_PACKET_OOB_DATA) to clear the out-of-band data block associated with the packet descriptor. Alternatively, such a driver can use the appropriate NDIS_SET_PACKET_XXX macros to reinitialize specific members in the out-of-band data block for subsequent indications with the returned packet descriptor.
Higher-level NDIS drivers can use NDIS_OOB_DATA_FROM_PACKET to reinitialize the out-of-band data block associated with the packet descriptors they allocate to specify sends when such a packet descriptor has been returned to the ProtocolSendComplete function. Consequently, drivers underlying such a protocol might use NDIS_OOB_DATA_FROM_PACKET to read the out-of-band information for an incoming send packet.
A driver should never pass a packet descriptor to NdisZeroMemory in an attempt to clear the out-of-band data block associated with a packet descriptor. Doing this destroys the given packet descriptor, renders it useless for subsequent indications or sends, and causes a memory leak. A driver must pass the pointer returned by NDIS_OOB_DATA_FROM_PACKET to zero-(re)initialize the out-of-band data block associated with a driver-allocated packet descriptor.