阅读:1297回复:4
NdisMIndicateReceivePacket时死掉
处理NdisGetReceivedPacket为NULL,用了HuYuguang 代码
但在NdisMIndicateReceivePacket时死掉。 附: { Status = NdisAllocateMemory( &pPacketContent,2000,0,HighestAcceptableAddress); if (Status != NDIS_STATUS_SUCCESS ) { DbgPrint(\"ptreceive :ndisallocatememory failed\\n\"); return NDIS_STATUS_NOT_ACCEPTED ; } if(pPacketContent == NULL) { DbgPrint(\"prreceive:pPacketContent == NULL\\n\"); return NDIS_STATUS_NOT_ACCEPTED ; } RtlZeroMemory(pPacketContent, 2000 ); RtlCopyMemory(pPacketContent,HeaderBuffer,HeaderBufferSize); RtlCopyMemory(pPacketContent+HeaderBufferSize,LookAheadBuffer,LookAheadBufferSize); PacketLen = PacketSize+HeaderBufferSize; // DbgPrint(\"Packet Size=%d\\n\",PacketLen); result = RecvProcess( pAdapt,pPacketContent,&PacketLen); if( result == PACKET_REFUSE ) { DbgPrint(\"ptreceive :packet_refuse\\n\"); NdisFreeMemory(pPacketContent,2000,0); return NDIS_STATUS_NOT_ACCEPTED; } NdisDprAllocatePacket(&Status, &MyPacket, pAdapt->RecvPacketPoolHandle); if(Status == NDIS_STATUS_SUCCESS) { NdisAllocateBuffer(&Status,&PacketBuffer,pAdapt->RecvBufferPoolHandle,pPacketContent,PacketLen); NdisChainBufferAtFront( MyPacket, PacketBuffer ); MyPacket->Private.Head->Next=NULL; MyPacket->Private.Tail=NULL; Resvd =(PRSVD)(MyPacket->MiniportReserved); Resvd->OriginalPkt = NULL; NDIS_SET_PACKET_HEADER_SIZE( MyPacket, HeaderBufferSize ); NdisMIndicateReceivePacket(pAdapt->MiniportHandle, &MyPacket, 1); // 这个函数调用之后ndis就只能调用protocol的ptrecievepacket了。 if ( NDIS_GET_PACKET_STATUS( MyPacket ) != NDIS_STATUS_PENDING ) { NdisFreeBuffer(PacketBuffer); NdisFreeMemory(pPacketContent,2000,0); NdisDprFreePacket(MyPacket); } break; } |
|
沙发#
发布于:2002-10-23 19:46
你又找冲了,程序有问题,你别把别人拉上啊。
|
|
板凳#
发布于:2002-10-23 22:17
你用的huyuguang的那个代码?????
这个站上的是98下面的吧 |
|
|
地板#
发布于:2002-10-24 10:17
你在这行代码
NdisMIndicateReceivePacket(pAdapt->MiniportHandle, &MyPacket, 1); 前加上语句: NDIS_SET_PACKET_STATUS(MyPacket, NDIS_STATUS_RESOURCES); 就可以了 WIN2K下通过 [编辑 - 10/24/02 by tx_zcy] |
|
|
地下室#
发布于:2002-10-24 13:59
多谢,是由于MPReturnPackets处理
我加了NDIS_SET_PACKET_STATUS(MyPacket, NDIS_STATUS_RESOURCES); 虽然程序可以跑了,但是好象上层无法收到该包, 不知为何? TO fracker: 我不是拉上谁,而是HU的代码比较多人了解了毕竟。这个问题以前讨论过程中HU给出的代码,感谢还来不及,只为解惑,无它 |
|