From 9182099c105321c24a12b53183f92cc58f4e0580 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Feb 2001 22:50:50 +0000 Subject: * autoload.cc: Add LoadDLLinitfunc for iphlpapi.dll. Add LoadDLLfuncEx statements for GetIfTable@12 and GetIpAddrTable@12. * fhandler_socket.cc (fhandler_socket::ioctl): Move variable definitions to the beginning of the function to allow better debugging. Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC and SIOCGIFMTU. * net.cc: Include iphlpapi.h. (get_2k_ifconf): Rewritten. Uses IP Helper API now. (get_nt_ifconf): Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC and SIOCGIFMTU. (get_95_ifconf): Ditto. Renamed from `get_9x_ifconf'. (get_ifconf): Name loopback `lo' instead of `lo0' as in Linux. Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC and SIOCGIFMTU. Call `get_95_ifconf' only on Windows 95, `get_nt_ifconf' only on Windows NT < Service Pack 3, `get_2k_ifconf otherwise. * include/asm/socket.h: Add defines for SIOCGIFHWADDR, SIOCGIFMETRIC and SIOCGIFMTU. * include/cygwin/if.h: Add `ifr_hwaddr', `ifr_metric' and `ifr_mtu'. (struct ifreq): Add `ifru_hwaddr'. --- winsup/cygwin/autoload.cc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'winsup/cygwin/autoload.cc') diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc index f7b0a62ef..00ee37b2c 100644 --- a/winsup/cygwin/autoload.cc +++ b/winsup/cygwin/autoload.cc @@ -175,6 +175,28 @@ LoadDLLinitfunc (ws2_32) return 0; } +LoadDLLinitfunc (iphlpapi) +{ + HANDLE h; + static NO_COPY LONG here = -1L; + + while (InterlockedIncrement (&here)) + { + InterlockedDecrement (&here); + Sleep (0); + } + + if (iphlpapi_handle) + /* nothing to do */; + else if ((h = LoadLibrary ("iphlpapi.dll")) != NULL) + iphlpapi_handle = h; + else if (!iphlpapi_handle) + api_fatal ("could not load iphlpapi.dll, %E"); + + InterlockedDecrement (&here); + return 0; +} + static void __stdcall dummy_autoload (void) __attribute__ ((unused)); static void __stdcall dummy_autoload (void) @@ -313,5 +335,9 @@ LoadDLLfunc (socket, 12, wsock32) LoadDLLinit (ws2_32) LoadDLLfuncEx (WSADuplicateSocketA, 12, ws2_32, 1) LoadDLLfuncEx (WSASocketA, 24, ws2_32, 1) + +LoadDLLinit (iphlpapi) +LoadDLLfuncEx (GetIfTable, 12, iphlpapi, 1) +LoadDLLfuncEx (GetIpAddrTable, 12, iphlpapi, 1) } } -- cgit v1.2.3