阅读:1064回复:7
ptreceivepacket包长度问题
为什么不同的方法得到的包长度不同?
方法1: NdisQueryPacket(Packet, NULL, NULL, NULL, TotalPacketLength); DbgPrint(\"Line(%4d) ************* F:PtReceivePacket pAdapt->MiniportHandle:0x8d\\n\", __LINE__, *TotalPacketLength); 方法2: NDIS_SET_ORIGINAL_PACKET(MyPacket, NDIS_GET_ORIGINAL_PACKET(Packet)); DbgPrint(\"Line(%4d) MyPacket->Private.TotalLength:%d\\n\", __LINE__, MyPacket->Private.TotalLength); 得到的结果分别为: 1. 0x8D 2. 0xBF(0d191) why? |
|
最新喜欢:![]()
|
沙发#
发布于:2003-01-28 11:09
TotalLength; // Total amount of data in the packet
他是整个packet的大小,Ippacket是在buffer中的,你应该把一个ndis_packet中的所有buffer的大小加起来。 |
|
|
板凳#
发布于:2003-01-28 11:51
mikeluo老兄:
能说的详细一些吗? 原始数据包比TotalPacketLength多出的是什么东东? 向你请教这么多问题,也没给过分,这次一并多多地给。 |
|
|
地板#
发布于:2003-01-28 14:44
这个你可以看ddk里面关于ndis_packet和ndis_buffer的声明。
typedef struct _NDIS_PACKET { NDIS_PACKET_PRIVATE Private; union { struct // For Connection-less miniports { UCHAR MiniportReserved[2*sizeof(PVOID)]; UCHAR WrapperReserved[2*sizeof(PVOID)]; }; struct { // // For de-serialized miniports. And by implication conn-oriented miniports. // This is for the send-path only. Packets indicated will use WrapperReserved // instead of WrapperReservedEx // UCHAR MiniportReservedEx[3*sizeof(PVOID)]; UCHAR WrapperReservedEx[sizeof(PVOID)]; }; struct { UCHAR MacReserved[4*sizeof(PVOID)]; }; }; ULONG_PTR Reserved[2]; // For compatibility with Win95 UCHAR ProtocolReserved[1]; } NDIS_PACKET, *PNDIS_PACKET, **PPNDIS_PACKET; 这是packet的, typedef struct _NDIS_PACKET_PRIVATE { UINT PhysicalCount; // number of physical pages in packet. UINT TotalLength; // Total amount of data in the packet. PNDIS_BUFFER Head; // first buffer in the chain PNDIS_BUFFER Tail; // last buffer in the chain // if Head is NULL the chain is empty; Tail doesn\'t have to be NULL also PNDIS_PACKET_POOL Pool; // so we know where to free it back to UINT Count; ULONG Flags; BOOLEAN ValidCounts; UCHAR NdisPacketFlags; // See fPACKET_xxx bits below USHORT NdisPacketOobOffset; } NDIS_PACKET_PRIVATE, * PNDIS_PACKET_PRIVATE; private的, 2k下的ndis_buffer是一个MDL typedef struct _MDL { struct _MDL *Next; CSHORT Size; CSHORT MdlFlags; struct _EPROCESS *Process; PVOID MappedSystemVa; PVOID StartVa; ULONG ByteCount; ULONG ByteOffset; } MDL, *PMDL; 这里面存的才是一个IP_packet的内容,所以你要查一个IP_packet的长度要在这里面找。private里面的那个是整个NDIS_packet的大小,不要把这两个packet弄混。 |
|
|
地下室#
发布于:2003-01-28 14:56
mikeluo 什么时候回家?
|
|
5楼#
发布于:2003-01-28 14:58
明天,你呢?
|
|
|
6楼#
发布于:2003-01-28 15:13
都回家了,幸福!!!!!!!!
我是不回去了,一路顺风。 |
|
|
7楼#
发布于:2003-01-28 16:13
我后天走,31 号下午才能到家
|
|