阅读:3471回复:26
胡版主请进。
我的这段代码在有线网卡上运行的很正常,为什么移植到无线网卡上就歇菜了?东西太多,请大虾仔细研究,给欧找找毛病。
//bow NDIS_STATUS MPSend( IN NDIS_HANDLE MiniportAdapterContext, IN PNDIS_PACKET Packet, IN UINT Flags ) { PADAPT pAdapt = (PADAPT)MiniportAdapterContext; NDIS_STATUS Status; PNDIS_PACKET MyPacket; PRSVD Rsvd; PVOID MediaSpecificInfo = NULL; ULONG MediaSpecificInfoSize = 0; // // Other variables // PVOID PktBufferVA; UINT BufferCount; UINT TotalPacketLength; PNDIS_BUFFER CurrentBuffer; UINT CurrentBufferLength; PVOID CurrentBufferVA; PUCHAR TempVA = NULL; PNDIS_BUFFER PktBuffer; NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress; // // Set the attribute of the packet // PNDIS_PACKET_EXTENSION Old, New; // // According to our LBFO design, all sends will be performed on the secondary miniport // However, the must be completed on the primary\'s miniport handle // ASSERT (pAdapt->pSecondaryAdapt); pAdapt = pAdapt->pSecondaryAdapt; if (IsIMDeviceStateOn (pAdapt) == FALSE) { return NDIS_STATUS_FAILURE; } NdisAllocatePacket(&Status, &MyPacket, pAdapt->SendPacketPoolHandle); if(Status != NDIS_STATUS_SUCCESS) { // // Output debug information // DbgPrint(\"\\n* Debug Report @ MPSend: NdisAllocatePacket dose not renturn NDIS_STATUS_SUCCESS\\n\"); DbgPrint(\"and MPSend will return NDIS_STATUS_FAILURE\\n\"); return (NDIS_STATUS_FAILURE); } // // Get information from the packet received from up-protocol // NdisQueryPacket(Packet, NULL, &BufferCount, &CurrentBuffer, &TotalPacketLength); if(!BufferCount) { // // Output debug information // DbgPrint(\"\\n* Debug Report @ MPSend: BufferCount of Packet is 0,\\n\"); DbgPrint(\"and MPSend will return NDIS_STATUS_FAILURE\\n\"); return (NDIS_STATUS_FAILURE); } // // Allocate memory with NdisAllocateMemory // HighestAcceptableAddress.LowPart = -1; HighestAcceptableAddress.HighPart = -1; Status = NdisAllocateMemory(&PktBufferVA, TotalPacketLength, 0, HighestAcceptableAddress); if(Status == NDIS_STATUS_FAILURE) { // // Output debug information // DbgPrint(\"\\n* Debug Report @ MPSend: NdisAllocateMemory returns NDIS_STATUS_FAILURE,\\n\"); DbgPrint(\"and MPSend will return NDIS_STATUS_FAILURE\\n\"); return (NDIS_STATUS_FAILURE); } // // Allocate buffer // NdisAllocateBuffer(&Status, &PktBuffer, pAdapt->SendBufferPool, MemoryVA, TotalPacketLength); if(Status == NDIS_STATUS_FAILURE) { // // Release the memory // NdisFreeMemory(MemoryVA, TotalPacketLength, 0); // // Output debug information // DbgPrint(\"\\n* Debug Report @ MPSend: NdisAllocateBuffer returns NDIS_STATUS_FAILURE,\\n\"); DbgPrint(\"and MPSend will return NDIS_STATUS_FAILURE\\n\"); return (NDIS_STATUS_FAILURE); } // // Copy the packet to the buffer // TempVA = (PUCHAR)MemoryVA; NdisQueryBuffer(CurrentBuffer, &CurrentBufferVA, &CurrentBufferLength); while(CurrentBuffer != NULL) { NdisMoveMemory(TempVA, CurrentBufferVA, CurrentBufferLength); TempVA = (PUCHAR)TempVA + CurrentBufferLength; NdisGetNextBuffer(CurrentBuffer, &CurrentBuffer); if(CurrentBuffer == NULL) break; NdisQueryBuffer(CurrentBuffer, &CurrentBufferVA, &CurrentBufferLength); } // // TODO ... // Rsvd = (PRSVD)(MyPacket->ProtocolReserved); Rsvd->OriginalPkt = Packet; MyPacket->Private.Flags = Flags; // // Chain the buffer to Mypacket // NdisChainBufferAtBack(MyPacket,PktBuffer); NdisSetPacketFlags(MyPacket, NDIS_FLAGS_DONT_LOOPBACK); // // Copy the per packet info into the new packet // This includes ClassificationHandle, etc. // Make sure other stuff is not copied !!! // Old = NDIS_PACKET_EXTENSION_FROM_PACKET(Packet); New = NDIS_PACKET_EXTENSION_FROM_PACKET(MyPacket); New->NdisPacketInfo[TcpIpChecksumPacketInfo] = Old->NdisPacketInfo[TcpIpChecksumPacketInfo]; New->NdisPacketInfo[IpSecPacketInfo] = Old->NdisPacketInfo[IpSecPacketInfo]; New->NdisPacketInfo[TcpLargeSendPacketInfo] = Old->NdisPacketInfo[TcpLargeSendPacketInfo]; New->NdisPacketInfo[ClassificationHandlePacketInfo] = Old->NdisPacketInfo[ClassificationHandlePacketInfo]; New->NdisPacketInfo[Ieee8021pPriority] = Old->NdisPacketInfo[Ieee8021pPriority]; // // Copy the Media specific information // NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(Packet, &MediaSpecificInfo, &MediaSpecificInfoSize); if (MediaSpecificInfo || MediaSpecificInfoSize) { NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(MyPacket, MediaSpecificInfo, MediaSpecificInfoSize); } NdisSend(&Status, pAdapt->BindingHandle, MyPacket); if(Status != NDIS_STATUS_PENDING) { NdisUnchainBufferAtBack(MyPacket,&PktBuffer); NdisFreeBuffer(PktBuffer); NdisFreeMemory(MemoryVA, TotalPacketLength, 0); NdisFreePacket(MyPacket); } return (Status); } VOID PtSendComplete( IN NDIS_HANDLE ProtocolBindingContext, IN PNDIS_PACKET Packet, IN NDIS_STATUS Status ) /*++ Routine Description: Interesting case: We wish to send all sends down the secondary NIC. But when we indicate to the protocol above, we need to revert back to the original miniport that Protocol wished to use for the Send Arguments: Return Value: --*/ { PADAPT pAdapt =(PADAPT)ProtocolBindingContext; PNDIS_PACKET Pkt; PRSVD Rsvd; PNDIS_BUFFER PacketBuffer; PVOID PacketBufferVA; UINT PacketBufferLength; // // Returning the Send on the Primary, will point to itself if there is no bundle // pAdapt = pAdapt->pPrimaryAdapt; Rsvd =(PRSVD)(Packet->ProtocolReserved); Pkt = Rsvd->OriginalPkt; NdisUnchainBufferAtBack(Packet,&PacketBuffer); NdisQueryBuffer(PacketBuffer, &PacketBufferVA, &PacketBufferLength); NdisFreeBuffer(PacketBuffer); NdisFreeMemory(PacketBufferVA, PacketBufferLength, 0); NdisFreePacket(Packet); NdisMSendComplete(pAdapt->MiniportHandle, Pkt, Status); } |
|
沙发#
发布于:2002-05-26 20:32
找到一点儿802.11b的资料参考一下吧。(有一点vpn的)
http://www.dell.com/us/en/gen/topics/vectors_2001-wireless_deployment.htm |
|
|
板凳#
发布于:2002-05-24 18:39
孤军奋战者。
加油吧! :o |
|
|
地板#
发布于:2002-05-24 18:22
但是接受的时候好像有问题,可能是我的资历太浅,呵呵慢慢研究的说
|
|
地下室#
发布于:2002-05-24 17:40
昨天的问题有了新的进展,我今天做了如下两个试验: 按你这么说的话你的网卡的驱动传上来的应该是正规的MAC包,并且并没有把自己注册成无线网卡[起码它传上来的载体信息应该也是802。3!否则NDIS是不会调用PASSTHRU来处理包的!],我想就这两点你就可以把这个网卡一个正规的LAN处理,其他的就不敢说! |
|
|
5楼#
发布于:2002-05-24 16:09
昨天的问题有了新的进展,我今天做了如下两个试验:
1.将一个没有改动过的Passthru安装到无线网卡上,结果运行正常,用SoftICE观察发现如下现象: 1)所有我观察到的接收数据都是有PtReceive接受的; 2)调用NdisGetReceivedPacke的返回值为NULL,这说明不是下面的驱动用NdisMIndicateReceive送上来的. 3)PacketSize == LookAheadBufferSize,这说明接收道德是完整的数据包. 4)所有的数据都是通过NdisMEthIndicateReceive发送给上层驱动的,这说明802.11在驱动程序中所用的介质为NdisMedium802_3. 2.我用我的MPSend和PtSendComplete代替原来的代码后,运行仍然正常(到现在为止),所以我认为应该是我的接收代码出了问题,现在正在检查. |
|
6楼#
发布于:2002-05-23 16:14
我手头有accton,laneed,roamabout三种牌子的卡,试了accton,发现同样的现象。其他的还没试过。
|
|
|
7楼#
发布于:2002-05-23 16:00
你的passthru是2000上的还是xp上的? 是2000上的 |
|
8楼#
发布于:2002-05-23 15:49
你的passthru是2000上的还是xp上的?
|
|
|
9楼#
发布于:2002-05-23 15:49
不好意思~~我在海南~~呵呵~~其实我也没有研究过WWAN~~胡老大好象也没搞过~~起码我没听他在白云或这里提过~孤军奋战~~同志辛苦了~~呵呵~~鼓励一下!
|
|
|
10楼#
发布于:2002-05-23 15:41
引用: 呵呵,诚实并且认真的说,我现在就是用装有passthru(干净的)的无线网卡法的贴子。如果您在北京,我们可以面对面的讨论这问题。还有,我觉得802.11的东东好像用的是802.3的协议差不多,所以我怀疑他用的就是802_3 |
|
11楼#
发布于:2002-05-23 15:40
引用: 呵呵,城市并且认真的说,我现在就是用装有passthru(干净的)的无线网卡法的贴子。如果您在北京,我们可以面对面的讨论这问题。还有,我觉得802.11的东东好像用的是802.3的协议差不多,所以我怀疑他用的就是802_3 |
|
12楼#
发布于:2002-05-23 15:15
BOSD的原因是什么??把内存DUMP文件和BOSD显示的错误信息的LOG文件放上来看看就知道!
|
|
|
13楼#
发布于:2002-05-23 15:14
BOSD的原因是什么??把DUMPBOSD显示的错误信息的LOG文件放上来看看就知道!
|
|
|
14楼#
发布于:2002-05-23 15:09
我考~~贴上来根本没法看~~看这个吧
[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/network/hh/network/501install_8f3b.asp [/url] |
|
|
15楼#
发布于:2002-05-23 15:03
有道理,我也觉得这个地方好像有点不对劲。但是,我没有怀疑这个地方有我自己的原因,我曾经用一个干净的passthru(没有改过)编译之后安装在无线网卡上,没有什么问题的。然而,当我在passthru上动了些收脚后,问题就出来了,对有线的好用,对无线的死翘翘 怎么可能???干净的绝对在WWAN上面用不了!看这个! NdisMedium802_3; //01.Ethernet <-----+ Save NdisMedium802_5; //02.Token-Ring | Wan NdisMediumFddi; //03.FDDI | As NdisMediumWan; //04.Wan ----------+ Ethernet NdisMediumLocalTalk //05.Apple LocalTalk NdisMediumDix //06.Convenience, Not a real medium NdisMediumArcnetRaw //07.Arcnet Raw Stream NdisMediumArcnet878_2 //08.Arcnet 878_2 NdisMediumAtm //09.ATM NdisMediumWirelessWan //10.Wireless Wan NdisMediumIrda //11.Irda NdisMediumBpc //12.BPC NdisMediumCoWan //13.Connection-Oriented Wan NdisMedium1394 //14.IEEE 1394 NdisMediumMax 这上面是NDIS所支持的载体枚举,看看Wireless Wan排第几???然后再去看看没修改过的PASSTHRU支持到第几?? NDIS_MEDIUM MediumArray[3] = { NdisMedium802_3, // Ethernet NdisMedium802_5, // Token-ring NdisMediumFddi // Fddi }; 然后我们再看INF部分! HKR, Ndi\\Interfaces, FilterMediaTypes, , \"ethernet, tokenring, fddi\"这里只支持了什么?? 看看这个里面怎么说的!然后再考虑考虑~~没修改过的PASSTHRU是不是可以直接在WAN上面正常工作,还是不响应WAN~~ Network Devices and Protocols: Windows DDK Specifying Binding Interfaces For each network component that it installs, a network INF file must specify the upper and lower binding interfaces for the component by adding the Interfaces key to the Ndi key. The Interfaces key has at least two values: UpperRange A REG_SZ value that defines the interfaces to which the component can bind at its top edge. LowerRange A REG_SZ value that defines the interfaces to which the component can bind at its lower edge. For physical adapters, this interface should always be the network media, such as Ethernet or token ring, to which the adapter connects. Note The DefUpper and DefLower values in Windows 95/98/Me network INF files, however, are not supported for INF files that will be used on Windows 2000 and later versions of the operating system. The following table lists the Microsoft-supplied UpperRange values: Value Description netbios NetBIOS ipx IPX tdi TDI interface to TCP/IP ndis5 NDIS 5.x (ndis2, ndis3, and ndis4 should no longer be used). This value should be specified for any non-ATM network component, such as a non-ATM adapter, that interfaces with NDIS at its upper edge. Ndisatm NDIS 5.x with ATM support. Specified value for any ATM network component, such as an ATM adapter, whose upper edge interfaces with NDIS ndiswan Upper edge for a WAN adapter. When specified, this value causes the operating system to automatically enable the WAN adapter for use with RAS Ndiscowan Upper edge for a WAN adapter over which connection-oriented NDIS runs noupper Upper edge for any component that does not expose an upper edge for binding; such a component typically has a private interface at its upper edge winsock The Windows socket interface ndis5_atalk Upper edge for an NDIS 5.x Net component (adapter) that binds only to an AppleTalk interface at its upper edge ndis5_dlc Upper edge for an NDIS 5.x Net component (adapter) that binds only to a DLC interface at its upper edge ndis5_ip Upper edge for an NDIS 5.x Net component (adapter) that binds only to a TCP/IP interface at its upper edge ndis5_ipx Upper edge for an NDIS 5.x Net component (adapter) that binds only to an IPX interface at its upper edge ndis5_nbf Upper edge for an NDIS 5.x Net component (adapter) that binds only to a NetBEUI interface at its upper edge ndis5_streams Upper edge for an NDIS 5.x Net component (adapter) that binds only to a streams interface at its upper edge The following table lists the Microsoft-supplied LowerRange values: Value Description ethernet Lower edge for an Ethernet adapter atm Lower edge for an ATM adapter tokenring Lower edge for a token ring adapter serial Lower edge for a serial adapter fddi Lower edge for an FDDI adapter baseband Lower edge for a baseband adapter broadband Lower edge for a broadband adapter arcnet Lower edge for an Arcnet adapter isdn Lower edge for an ISDN adapter localtalk Lower edge for a LocalTalk adapter wan Lower edge for a WAN adapter nolower Lower edge for any component that does not expose a lower edge for binding ndis5 NDIS 5.x. (ndis2, ndis3, and ndis4 should no longer be used.) For any network component whose lower edge interfaces through NDIS with non-ATM components Ndisatm Ndis 5.x with ATM support. For any network component whose lower edge interfaces through NDIS with ATM components The UpperRange and LowerRange values specify the types of interfaces ― not the actual components ― to which a component can bind. The binding engine binds a network component to all components that provide the specified interface at the appropriate (upper or lower) edge. For example, a protocol with a LowerRange of ndis5 binds to all components that have an UpperRange of ndis5, such as physical or virtual adapters. If an NDIS 5.x Net component (adapter) works only with one or more specific protocols, then its UpperRange should be assigned one or more protocol-specific values, such as ndis5_atalk, ndis5_dlc, ndis5_ip, ndis5_ipx, ndis5_nbf, or ndis5_streams. Such a net class component should not be assigned an UpperRange value of ndis5, because this would cause that component to bind to all protocols that provide an ndis5 lower edge. An INF-file-writer can define and use vendor-specific UpperRange and LowerRange values for private binding interfaces. For example, if a vendor wants to bind its adapter only to its own proprietary protocol driver, the INF-file-writer could specify XXX for the UpperRange of the adapter and XXX for the LowerRange of the proprietary protocol. The Windows 2000 binding engine will bind all components that have an UpperRange of XXX (in this case, the adapter) with all components that have a LowerRange of XXX (in this case, the proprietary protocol). The following is an example of an add-registry-section that adds UpperRange and LowerRange values for an ATM adapter: [addreg-section] HKR, Ndi\\Interfaces, UpperRange, 0, \"ndisATM\" HKR, Ndi\\Interfaces, LowerRange, 0, \"atm\" Built on Wednesday, October 03, 2001 |
|
|
16楼#
发布于:2002-05-23 14:48
支持的协议就是802.11,和802.3差不多
|
|
17楼#
发布于:2002-05-23 14:41
[quote]我觉得好像,你得多提供一点信息,才能让大家明白出了什么事。 呵呵,这些问题我一个一个的回答: 1.好像是这样的,然后再启动的时候就会bluescreen,只有到安全模式下卸载passthru才可以恢复系统。 2.这种东东在国外已经不是什么新鲜玩意了,所以说明书很简单,没有什么技术方面的东东。 3.我按装驱动的顺序当然是先安装网卡的nic驱动了,然后再安装passthru。 4.我的环境是2000(讨厌死了,这个项目完了一定干掉它) 5.这个东东好像没有看过。不过我的机器上的两块网卡(有线和无线)通常是有一块被我禁用的 [/quote] 它支持的协议,你是不是能把它抄过来? |
|
|
18楼#
发布于:2002-05-23 14:38
我觉得好像,你得多提供一点信息,才能让大家明白出了什么事。 呵呵,这些问题我一个一个的回答: 1.好像是这样的,然后再启动的时候就会bluescreen,只有到安全模式下卸载passthru才可以恢复系统。 2.这种东东在国外已经不是什么新鲜玩意了,所以说明书很简单,没有什么技术方面的东东。 3.我按装驱动的顺序当然是先安装网卡的nic驱动了,然后再安装passthru。 4.我的环境是2000(讨厌死了,这个项目完了一定干掉它) 5.这个东东好像没有看过。不过我的机器上的两块网卡(有线和无线)通常是有一块被我禁用的 |
|
19楼#
发布于:2002-05-23 14:26
有道理,我也觉得这个地方好像有点不对劲。但是,我没有怀疑这个地方有我自己的原因,我曾经用一个干净的passthru(没有改过)编译之后安装在无线网卡上,没有什么问题的。然而,当我在passthru上动了些收脚后,问题就出来了,对有线的好用,对无线的死翘翘
|
|
上一页
下一页