There is a function called if_nametoindex() that converts an interface name into an interface index. This function appears to be available on Linux and Windows. On Linux, I imagine these interface names might look like "eth0" or "wlan0".
My question is: what do Win32 interface names look like? And are there any calls that let me query what interface names are available?
There's also if_indextoname
. I've added the output below. This style of name (e.g. loopback_0
) is not the Win32 interface name. I guess these names only exist for compatibility with rfc2553. Win32 actually uses interface names like \DEVICE\TCPIP_{846EE342-7039-11DE-9D20-806E6F6E6963}
.
To enumerate all the interfaces you need to use GetIfTable
and friends. if_nameindex
is not supported.
loopback_0
tunnel_0
tunnel_2
tunnel_3
ppp_0
ethernet_0
ethernet_1
ethernet_4
ppp_1
wireless_0
ethernet_9
tunnel_4
tunnel_1
tunnel_7
tunnel_8
wireless_5
tunnel_5
tunnel_9
tunnel_10
tunnel_6
wireless_1
wireless_2
ethernet_2
ethernet_3
ethernet_5
ethernet_6
ethernet_7
wireless_3
wireless_4
wireless_6
wireless_7
wireless_8
They look like \Device\NPF_{506B4345-1FC0-43F4-BFCF-4FFAD7739AFF}
. I don't know if there's a more direct way to get a list of interfaces, but I got this one from wireshark, which uses winpcap.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With