阅读:1323回复:0
在PTreceivePacket中不知为何老是蓝屏的代码....
xpassthru里面的例子 我就在PTreceivePacket掉了这个函数把MYPACKET传了进来
VOID PacketAnlysis( IN PNDIS_PACKET packet ) { NDIS_STATUS status ; UINT TotalPacketLength = 0 , copysize = 0 , i = 0 ; PUCHAR mybuffer = NULL ,tembuffer = NULL ; MDL * pmdl ; NdisQueryPacket(packet , NULL , NULL , NULL , &TotalPacketLength ); status = NdisAllocateMemoryWithTag( &mybuffer, 2048, TAG); ASSERT( status == NDIS_STATUS_SUCCESS ) ; NdisZeroMemory( &mybuffer, 2048 ); NdisQueryBufferSafe( packet->Private.Head, &tembuffer, ©size, NormalPagePriority ); NdisMoveMemory(mybuffer, tembuffer, copysize) ; i = copysize ; pmdl = packet->Private.Head ; while(1) { if(pmdl->Next == packet->Private.Tail ) break ; pmdl = pmdl->Next ; if(pmdl == NULL ) break ; NdisQueryBufferSafe( pmdl, &tembuffer, ©size, NormalPagePriority ) ; NdisMoveMemory(mybuffer + i, tembuffer, copysize) ; i += copysize ; } //数据拷贝完毕,开始分析数据 DbgPrint("The data:%u",mybuffer) ; //释放内存 NdisFreeMemory(mybuffer , 2048 , 0) ; } |
|