我正在尝试将对Windows 7移动宽带适配器的支持添加到LWF驱动程序中。
所以现在我需要连接USB加密狗。我有一个 加密狗支持RAS调制解调器和NDIS。我的应用程序可以与RAS连接 加密狗调制解调器。我有一个界面列表,显示活动列表 适配器。但是当我在加密狗上设置NDIS时,我无法看到该适配器(3g网络 卡)在该名单上。设置后(自动ip,自动从DHCP 适配器属性)我可以看到适配器是活动的。但我无法连接 NDIS。但我可以用加密狗连接RAS调制解调器。
我的应用程序有2个INF文件。在Mux中,我有一个INF 文件以及虚拟适配器中的另一个INF文件。所以我很困惑,我应该修改哪一个?
我从微软获得了关于移动宽带INF文件更改的文档。
所以在MUX INF文件中有:
[INSTALL.NDI]
HKR, Ndi, FilterClass, , custom
HKR, Ndi, FilterType, 0x00010001, 0x00000002
HKR, Ndi\Interfaces, UpperRange, , "noupper"
HKR, Ndi\Interfaces, LowerRange, , "nolower"
HKR, Ndi\Interfaces, FilterMediaTypes, , "nolower, ethernet, wan"
HKR, Ndi, FilterRunType, 0x00010001, 1
然后我进入
[INSTALL.NDI]
HKR, Ndi, FilterClass, , custom
HKR, Ndi, FilterType, 0x00010001, 0x00000002
HKR, Ndi\Interfaces, UpperRange, , "noupper"
HKR, Ndi\Interfaces, LowerRange, , "nolower"
HKR, Ndi\Interfaces, FilterMediaTypes, , "nolower, ethernet, wan, ppip"
HKR, Ndi, FilterRunType, 0x00010001, 1
这里添加了 ppip
..
HKR, Ndi\Interfaces, UpperRange, , "ndis5"
HKR, Ndi\Interfaces, LowerRange, , "ethernet"
我得到了另一个关于数据包(缓冲区列表)的信息
https://msdn.microsoft.com/en-us/library/windows/hardware/ff559110(v=vs.85).aspx
但我的问题是我应该把这段代码放在哪里?在发送或接收功能之前?
在filter.cpp
文件中,我向函数
NdisMediumWirelessWan
NDIS_STATUS CFilter::Attach(
IN NDIS_HANDLE NdisFilterHandle,
IN PNDIS_FILTER_ATTACH_PARAMETERS AttachParameters
) {
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
if (
(AttachParameters->MiniportMediaType != NdisMedium802_3)
&& (AttachParameters->MiniportMediaType != NdisMediumWan)
&& (AttachParameters->MiniportMediaType != NdisMediumNative802_11)
&& (AttachParameters->MiniportMediaType != NdisMediumWirelessWan)
) {
status = NDIS_STATUS_INVALID_PARAMETER;
goto myExit;
}
我有sendbufferlist
功能:
VOID CFilter::SendNetBufferLists(
IN PNET_BUFFER_LIST NetBufferLists,
IN NDIS_PORT_NUMBER PortNumber,
IN ULONG SendFlags
) {
PNET_BUFFER_LIST pSendNetBufferList = NULL;
PNET_BUFFER_LIST pSendNetBufferListComplete = NULL;
PNET_BUFFER_LIST pNetBufferList = NetBufferLists;
PNET_BUFFER_LIST pNextNetBufferList = NULL;
*** i am doing RAW IP packet here ***
NdisSetNblFlag(pNetBufferList, NDIS_NBL_FLAGS_IS_IPV4);
NET_BUFFER_LIST_INFO(pNetBufferList, NetBufferListFrameType) = 0x0008;
*** END my IP raw Packet code ****
while (pNetBufferList) {
pNextNetBufferList = NET_BUFFER_LIST_NEXT_NBL(pNetBufferList);
NET_BUFFER_LIST_NEXT_NBL(pNetBufferList) = NULL;
if (pNetBufferList->ChildRefCount != 0) {
DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL, "!!! [%p]
CFilter::SendNetBufferLists(): pNetBufferList->ChildRefCount != 0\n", this);
}
PNET_BUFFER pNetBuffer = NET_BUFFER_LIST_FIRST_NB(pNetBufferList);
PNET_BUFFER pNextNetBuffer = NULL;
while (pNetBuffer) {
pNextNetBuffer = NET_BUFFER_NEXT_NB(pNetBuffer);
这是连接NDIS类型移动宽带的正确方法吗?或者我应该如何修改此代码以获得对NDIS类型移动宽带的支持。因为我可以在USB加密狗上连接RAS类型。
请帮帮我。
谢谢&问候