简体   繁体   English

在Windows NDIS的passthru示例中,如何发送带有特定适配器的NDIS_PACKET?

[英]In Windows NDIS's passthru example, how to send a NDIS_PACKET with a specific adapter?

I'm working on a NAT-like software in Windows platform by modifying the original passthru example in Windows WDK. 我正在Windows平台上通过修改Windows WDK中原始的passthru示例来开发类似NAT的软件。

Here're several network adapters in my machine, and I wanna analyze every packet I received then decide which adapter to forward the packet to. 这是我机器中的几个网络适配器,我想分析我收到的每个数据包,然后决定将数据包转发到哪个适配器。 There comes the problem: I don't know how to specify the adapter for sending when calling the NdisSend function. 问题来了:调用NdisSend函数时,我不知道如何指定发送适配器。

As follows, there's a BindingHandle arg in NdisSend, but in my understanding it should stand for all the adapters in passthru(may not right:) 如下所示,NdisSend中有一个BindingHandle arg,但据我理解,它应该代表passthru中的所有适配器(可能不正确:)

NdisSend(&Status, pAdapt->BindingHandle, MyPacket); NdisSend(&Status,pAdapt-> BindingHandle,MyPacket);

So how to specify a adapter like this form :{62E9DB05-88D3-479D-A194-22D6A591DB96} when calling NdisSend? 那么如何在调用NdisSend时指定像这样的适配器:{62E9DB05-88D3-479D-A194-22D6A591DB96}?

Very thx.. 非常感谢

I think the clue is pAdapt->BindingHandle , so pAdapt is a pointer to a structure that contains all adapter-specific information, including a BindingHandle . 我认为线索是pAdapt->BindingHandle ,所以pAdapt是指向结构的指针,该结构包含所有适配器特定的信息,包括BindingHandle So each adapter has a different BindingHandle , and that's how you control which adapter gets the packet. 因此,每个适配器都有一个不同的BindingHandle ,这就是您控制哪个适配器获取数据包的方式。

Also you might want to investigate if you can use WFP instead of NDIS for you driver. 另外,您可能想调查一下是否可以将WFP代替NDIS用于驱动程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM