NDIS_GET_ORIGINAL_PACKET 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.
NDIS_GET_ORIGINAL_PACKET returns a pointer to a packet descriptor that the lowest-level driver in a layered stack of NDIS drivers indicated. The calling driver should access the out-of-band (OOB) data block from this original packet rather than the packet that the driver below the calling driver indicated. If the calling driver is not part of a layered stack, the returned packet descriptor will be identical to the packet that the driver below the calling driver indicated.
PNDIS_PACKET NDIS_GET_ORIGINAL_PACKET(
_In_ PNDIS_PACKET Packet
);
- Packet [in]
Pointer to a packet descriptor that the driver below the calling driver indicated.
NDIS_GET_ORIGINAL_PACKET returns a pointer to the packet descriptor that the lowest-level driver in a layered stack of NDIS drivers indicated, or if the calling driver is not part of a layered stack, NDIS_GET_ORIGINAL_PACKET returns the packet descriptor that the driver below the calling driver indicated.
Typically, the packet that is returned by NDIS_GET_ORIGINAL_PACKET is the same packet that was indicated up by the driver below the calling driver. To indicate packets to a higher-level driver, a driver can call, for example, the NdisMIndicateReceivePacketfunction. To retrieve packets that were indicated up from a lower-level driver, a driver can call the NdisGetReceivedPacketfunction.
To obtain a pointer to a packet that was indicated up by the lowest-level driver in a layered stack of NDIS drivers, protocol and intermediate drivers call NDIS_GET_ORIGINAL_PACKET. In this call, they pass the pointer to the received packet. Using this call, each driver in the layered stack can access the OOB data block that is associated with packets that are received from the network without requiring that packets be copied to each layer.
The following example code retrieves a packet that was received from the driver below and obtains the original packet from the retrieved packet.
// Get the original packet, which could be the received packet
// or the packet originating from the lowest-level driver.
// This result is based on the number of layered drivers in the stack.
//
Pkt = NdisGetReceivedPacket(BindingHandle, MacReceiveContext);
OrigPkt = NDIS_GET_ORIGINAL_PACKET(Pkt);
Target platform |
Desktop |
Header |
Ndis.h (include Ndis.h) |
IRQL |
Any level |
NDIS_PACKET_EXTENSION_FROM_PACKET
NDIS_PER_PACKET_INFO_FROM_PACKET