Ethereal-dev: Re: [Ethereal-dev] Listing network interfaces in Windows NT/98/2000

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Sat, 10 Feb 2001 01:48:22 -0800
On Fri, Feb 09, 2001 at 05:31:20PM -0000, Graham Bloice wrote:
> 1) Grope in the registry.

See "PacketGetAdapterNames()", in "Packet9x\DLL\Packet32.c" and
"packetNtx\DLL\Packet32.c" in the WinPcap source, for an example of how
this is done; note that

	1) the registry groping in question does, in fact, differ
	   between Windows OT (95/98) and Windows NT (4.0/2K);

	2) on Windows OT it returns ASCII strings, on Windows NT it
	   returns, I think, Unicode strings;

	3) I don't know whether the registry-groping in the OT version
	   depends on the WinPcap driver being installed or not - the
	   registry-groping in the NT version doesn't (although it does
	   depend, I presume, on TCP/IP being installed, as it appears
	   to look for what devices are bound to the TCP/IP stack).

If you're using WinPcap, though, you can also do this by using
"pcap_lookupdev()"; in WinPcap, "pcap_lookupdev()" returns a list of
interface names, in Unicode on NT, rather than just one interface name
in ASCII as it does on UNIX.

(I presume you want to do this in a program other than Ethereal; on
Ethereal, the way you do it is with "get_interface_list()" in "util.c",
which has both a UNIX version that uses SIOCGIFCONF and a Windows
version that uses "pcap_lookupdev()".  See the code to generate the
drop-down list in "gtk/capture_dlg.c".