我希望我的程序在用户的计算机上获取主MAC地址,并在用户登录时将其发送到我的服务器,因此我可以限制我的程序仅在2台设备上运行(如evernote)
我尝试使用GetAdaptersAddresses function,但它给了我多个网络适配器信息。这是输出:
... Length of the IP_ADAPTER_ADDRESS struct: 376 IfIndex (IPv4 interface): 4 Adapter name: {1DF5C314-BE85-4804-B653-D3E5F98F5231} Number of Unicast Addresses: 2 No Anycast Addresses Number of Multicast Addresses: 10 Number of DNS Server Addresses: 3 DNS Suffix: Description: VMware Virtual Ethernet Adapter for VMnet8 Friendly name: VMware Network Adapter VMnet8 Physical address: 00-50-56-C0-00-08 Flags: 453 Mtu: 1500 IfType: 6 OperStatus: 1 Ipv6IfIndex (IPv6 interface): 4 ZoneIndices (hex): 4 4 4 4 1 1 1 1 1 1 1 1 1 1 0 1 Transmit link speed: 100000000 Receive link speed: 100000000 Number of IP Adapter Prefix entries: 8 Length of the IP_ADAPTER_ADDRESS struct: 376 IfIndex (IPv4 interface): 9 Adapter name: {65CE3D53-968E-410E-8C47-E0BACBC3D42B} Number of Unicast Addresses: 2 No Anycast Addresses Number of Multicast Addresses: 10 Number of DNS Server Addresses: 3 DNS Suffix: Description: Hyper-V Virtual Ethernet Adapter Friendly name: vEthernet ( Physical address: **BC-85-56-8F-3B-0B** Flags: 453 Mtu: 1500 IfType: 6 OperStatus: 1 Ipv6IfIndex (IPv6 interface): 9 ZoneIndices (hex): 9 9 9 9 1 1 1 1 1 1 1 1 1 1 0 1 Transmit link speed: 54000000 Receive link speed: 54000000 Number of IP Adapter Prefix entries: 8 ...
我可以在路线上看到第二个。这是我正在寻找的那个,但我怎样才能将它与其他人区分开来?
我想要的是一个MAC应该是:
我发现Detect-Internet-Network-Availability,网络适配器接口上的网络状态可能是识别我想要的“主要”网络适配器的因素之一。但它是用C#编写的。
有什么想法吗?