//结果输出3(去除非PCI物理网卡)
void Output3(PIP_ADAPTER_INFO pIpAdapterInfo)
{
//可能有多网卡,因此通过循环去判断
while (pIpAdapterInfo)
{
//去除非PCI物理网卡
if (IsPCINetCard(pIpAdapterInfo) != IS_PCI)
{
if (IsPCINetCard(pIpAdapterInfo) == REG_ERROR)
{
printf("1\n");
return;
}
pIpAdapterInfo = pIpAdapterInfo->Next;
continue;
}
//输出信息
cout << "网卡名称:" << pIpAdapterInfo->AdapterName << endl;
cout << "网卡描述:" << pIpAdapterInfo->Description << endl;
cout << "网卡MAC地址:" << pIpAdapterInfo->Address;
for (UINT i = 0; i < pIpAdapterInfo->AddressLength; i++)
{
if (i == pIpAdapterInfo->AddressLength - 1)
{
printf("%02x\n", pIpAdapterInfo->Address[i]);
}
else
{
printf("%02x-", pIpAdapterInfo->Address[i]);
}
}
cout << "网卡IP地址如下:" << endl;
IP_ADDR_STRING *pIpAddrString = &(pIpAdapterInfo->IpAddressList);
//可能网卡有多IP,因此通过循环去判断
do
{
cout << pIpAddrString->IpAddress.String << endl;
pIpAddrString = pIpAddrString->Next;
} while (pIpAddrString);
pIpAdapterInfo = pIpAdapterInfo->Next;
cout << "*****************************************************" << endl;
}
return;
}
使用C++对物理网卡/虚拟网卡进行识别(包含内外(4)
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:https://www.heiqu.com/d99a8c27f2311af7fdd4a844698ec296.html