ReadPackets

BOOL CNdisApi::ReadPackets ( PETH_M_REQUEST pPacket );

Return Value:
TRUE if call was successful, FALSE otherwise

Parameters:
pPacket
Pointer to the user allocated and initialized ETH_M_REQUEST structure.

Remarks:
The following fields of ETH_M_REQUEST must be initialized:

  • ETH_M_REQUEST::hAdapterHandle must be set to the interface handle (obtained via call to CNdisApi::GetTcpipBoundAdaptersInfo). The packets will be extracted from the network interface associated packet queue. Remember that packets queued only when network interface is in the filter mode.
  • ETH_M_REQUEST::dwPacketsNumber must be set to a number of entries in EthPacket array
  • ETH_M_REQUEST::EthPacket[i].Buffer must point to the user allocated INTERMEDIATE_BUFFER structure

The following fields of the ETH_M_REQUEST and INTERMEDIATE_BUFFER are initialized by helper driver in case of success:

  • ETH_M_REQUEST::dwPacketSuccess contains number of packets returned by driver
  • INTERMEDIATE_BUFFER::m_IBuffer contains Ethernet packet
  • INTERMEDIATE_BUFFER::m_Length contains the actual length of the packet
  • INTERMEDIATE_BUFFER::m_Flags is a combination of NDIS_FLAGS_XXX (defined in ndis.h). These flags are copied from the NDIS_PACKET.Private.Flags.
  • INTERMEDIATE_BUFFER::m_dwDeviceFlags is PACKET_FLAG_ON_SEND if packet goes from MSTCP to network interface, or PACKET_FLAG_ON_RECEIVE otherwise.

This member calls the filter driver with IOCTL_NDISRD_READ_PACKETS control code (see details below).

IOCTL_NDISRD_READ_PACKETS

Input Buffer_ETH_M_REQUEST
Input Buffer Sizesizeof (_ETH_M_REQUEST)
Output Buffer_ETH_M_REQUEST
Output Buffer Sizesizeof (_ETH_M_REQUEST)