OpenNetCf SDF 未返回所有适配器
通过以下方式调用 GetAllNetworkInterfaces() 时:
INetworkInterface[] rgni = WirelessZeroConfigNetworkInterface.GetAllNetworkInterfaces();
我只取回一个适配器 RNDISFN1,它具有链接本地地址 (169.254....)。
我怀疑发生了一些不好的事情导致所有适配器都没有填充到阵列中;在调试器下,当我关闭该功能时,我看到:
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in CSharpSample.exe
A first chance exception of type 'System.MissingMethodException' occurred in OpenNETCF.Net.dll
A first chance exception of type 'OpenNETCF.Net.NetworkInformation.NetworkInformationException' occurred in OpenNETCF.Net.dll
明确地说,其最终目标是获取无线配置文件列表,并能够在它们之间进行切换。
目前,是否有人见过 GetAllNetworkInterfaces() 不返回所有适配器的实例?我在 Windows Mobile 6 下使用版本 OpenNetCF SDF v2.3。
When calling GetAllNetworkInterfaces() via:
INetworkInterface[] rgni = WirelessZeroConfigNetworkInterface.GetAllNetworkInterfaces();
I'm only getting back a single adapter back, RNDISFN1, which has a link-local address (169.254....).
I suspect something bad is happening to cause all of the adapters to not be populated in the array; under the debugger, when I fire off the function, I'm seeing:
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in CSharpSample.exe
A first chance exception of type 'System.MissingMethodException' occurred in OpenNETCF.Net.dll
A first chance exception of type 'OpenNETCF.Net.NetworkInformation.NetworkInformationException' occurred in OpenNETCF.Net.dll
To be clear, the end goal of this is to get a list of Wireless Profiles, and have the ability to switch between them.
For now, has anybody seen instances where GetAllNetworkInterfaces() doesn't return all of the adapters? I am using version OpenNetCF SDF v2.3 under Windows Mobile 6.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实上,您看到一个适配器(我可以通过名称看出),这表明您已经处于摇篮状态。 ActiveSync 在其所有的荣耀中,在摇篮时会关闭所有其他无线电,因此不会出现其他无线电。在未支架时运行代码,您可能会看到您的 WiFi(和任何其他)适配器出现。
The fact you see a single adapter (and I can tell by the name) indicates that you're cradled. ActiveSync, in all its glory, shuts down all other radios when cradled and therefore no other radios will show up. Run the code when not cradled and you'll likely see your WiFi (and any other) adapters appear.