您如何区分来自GetAdaptersParams的各种以太网适配器? [英] How do you differentiate between various Ethernet adapters from GetAdaptersParams?

查看:112
本文介绍了您如何区分来自GetAdaptersParams的各种以太网适配器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我执行ipconfig -all时,我得到4个不同的物理地址(与以下内容关联:以太网适配器无线网络连接,以太网适配器本地连接,以太网适配器和以太网适配器网络连接适配器).当我通过GetAdaptersInfo获得此信息时,我会得到相同的4个地址,但是我无法确定这4个是本地连接.它们都具有type = Ethernet.有谁知道如何区分本地连接和其他网络适配器?

适配器名称或描述均不包含有关适配器是否为本地连接的任何信息. IP地址也不是确定的.

数据必须在某个地方,因为ipconfig -all可以显示它.我搜寻了所有我认为可能在逻辑上包含数据的结构,但没有发现任何跳到我身上的东西.如果我真的不知道自己在找什么,这无济于事.

When I do ipconfig -all I get 4 different physical addresses (associated with the following: Ethernet adapter Wireless Network Connection, Ethernet adapter Local Area Connection, Ethernet adapter and Ethernet adapter Network Connect Adapter). When I get this info via GetAdaptersInfo I get the same 4 addresses but I cannot tell which of the 4 is the Local Area Connection. They all have type=Ethernet. Does anyone know how to differentiate the Local Area Connection from the other Network Adapters?

Neither the adapter name nor the description contain any info about whether or not the adapter is the Local Area Connection. The IP address is not conclusive either.

The data must be somewhere because ipconfig -all is able to display it. I have hunted through every structure that I thought might logically contain the data but I didn''t see anything that jumped out at me. It doesn''t help that I don''t really know what I''m looking for.

推荐答案

本地连接不会有192.168.0 .x IP地址?
Won''t a local connection have a 192.168.0.x IP address ?


GetAdaptersInfo函数 [ ^ ]来自MSDN,该示例显示了AdapterName和Description.
GetAdaptersInfo Function[^] from MSDN has an example that shows the AdapterName and Description.
printf("\tAdapter Name: \t%s\n", pAdapter->AdapterName);
printf("\tAdapter Desc: \t%s\n", pAdapter->Description);


GetAdaptersInfo中的适配器名称可用于从注册表中检索信息(请参见文章修复知识库文章823206").找到一个名称为"Local Area Connection"的计算机.注意:注册表可能包含多个以该字符串开头的名称.
The adapter names from GetAdaptersInfo can be used to retrieve info from the registry (see article "Fix for KB article 823206"). Find the one whose name is "Local Area Connection". NOTE: The registry may contain more than 1 name starting with that string.


这篇关于您如何区分来自GetAdaptersParams的各种以太网适配器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆