我的代码:
NDIS_STATUS
PtReceive(
IN NDIS_HANDLE ProtocolBindingContext,
IN NDIS_HANDLE MacReceiveContext,
IN PVOID HeaderBuffer,
IN UINT HeaderBufferSize,
IN PVOID LookAheadBuffer,
IN UINT LookAheadBufferSize,
IN UINT PacketSize
)
{
PADAPT pAdapt = (PADAPT)ProtocolBindingContext;
PNDIS_PACKET MyPacket, Packet;
NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
if ((!pAdapt->MiniportHandle) || (pAdapt->MPDeviceState > NdisDeviceStateD0))
Status = NDIS_STATUS_FAILURE;
else do
{
Packet = NdisGetReceivedPacket(pAdapt->BindingHandle, MacReceiveContext);
////////////////////////////我加入的代码//////////////////////////////
if ( HeaderBufferSize >= sizeof(ETHeader) )
KdPrint(( "ETHeader type : %x\n", ((PETHeader)HeaderBuffer)->type ));
FilterReceive( LookAheadBuffer, LookAheadBufferSize);
/////////////////////////////////////////////////////////////////////////////////
if (Packet != NULL)
{
。。。。。。。。。。。。。。。。。。。。。passthru原来的代码
。。。。。。。。。。。。。。。。。。。。。
。。。。。。。。。。。。。。。。。。。。。
}
VOID FilterReceive(I N PVOID pData, IN UINT pDataSize )
{
//剩下数据的长度
ULONG ulLeavingLen = pDataSize;
PIPHeader pIPHdr;
PTCPHeader pTCPHdr;