You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2019/03/19 18:10:46 UTC

svn commit: r1855855 - in /apr/apr/trunk: include/arch/win32/apr_arch_misc.h misc/win32/misc.c network_io/unix/sockaddr.c

Author: wrowe
Date: Tue Mar 19 18:10:46 2019
New Revision: 1855855

URL: http://svn.apache.org/viewvc?rev=1855855&view=rev
Log:
Replace the link-time pragma from r1839494 with APR_DECLARE_LATE_DLL_FUNC 
resolution of if_indextoname and if_nametoindex.


Modified:
    apr/apr/trunk/include/arch/win32/apr_arch_misc.h
    apr/apr/trunk/misc/win32/misc.c
    apr/apr/trunk/network_io/unix/sockaddr.c

Modified: apr/apr/trunk/include/arch/win32/apr_arch_misc.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/arch/win32/apr_arch_misc.h?rev=1855855&r1=1855854&r2=1855855&view=diff
==============================================================================
--- apr/apr/trunk/include/arch/win32/apr_arch_misc.h (original)
+++ apr/apr/trunk/include/arch/win32/apr_arch_misc.h Tue Mar 19 18:10:46 2019
@@ -47,6 +47,10 @@
 #include <tlhelp32.h>
 #endif
 
+#if defined(HAVE_IF_INDEXTONAME) && defined(_MSC_VER)
+#include <Iphlpapi.h>
+#endif
+
 struct apr_other_child_rec_t {
     apr_pool_t *p;
     struct apr_other_child_rec_t *next;
@@ -174,8 +178,9 @@ typedef enum {
     DLL_WINSOCKAPI = 2,    /* mswsock  From WinSock.h       */
     DLL_WINSOCK2API = 3,   /* ws2_32   From WinSock2.h      */
     DLL_SHSTDAPI = 4,      /* shell32  From ShellAPI.h      */
-    DLL_NTDLL = 5,         /* shell32  From our real kernel */
-    DLL_defined = 6        /* must define as last idx_ + 1  */
+    DLL_NTDLL = 5,         /* ntdll    From our real kernel */
+    DLL_IPHLPAPI = 6,      /* Iphlpapi From Iphlpapi.h      */
+    DLL_defined = 7        /* must define as last idx_ + 1  */
 } apr_dlltoken_e;
 
 FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char *fnName, int ordinal);
@@ -381,6 +386,23 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI
     (lpPathName));
 #define SetDllDirectoryW apr_winapi_SetDllDirectoryW
 
+#ifdef if_nametoindex
+#undef if_nametoindex
+#endif
+APR_DECLARE_LATE_DLL_FUNC(DLL_IPHLPAPI, NET_IFINDEX, WINAPI, if_nametoindex, 0, (
+    IN PCSTR InterfaceName),
+    (InterfaceName));
+#define if_nametoindex apr_winapi_if_nametoindex
+
+#ifdef if_indextoname
+#undef if_indextoname
+#endif
+APR_DECLARE_LATE_DLL_FUNC(DLL_IPHLPAPI, PCHAR, NETIOAPI_API_, if_indextoname, 0, (
+    NET_IFINDEX InterfaceIndex
+    PCHAR       InterfaceName),
+    (InterfaceIndex, InterfaceName));
+#define if_indextoname apr_winapi_if_indextoname
+
 #endif /* !defined(_WIN32_WCE) */
 
 #endif  /* ! MISC_H */

Modified: apr/apr/trunk/misc/win32/misc.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/misc/win32/misc.c?rev=1855855&r1=1855854&r2=1855855&view=diff
==============================================================================
--- apr/apr/trunk/misc/win32/misc.c (original)
+++ apr/apr/trunk/misc/win32/misc.c Tue Mar 19 18:10:46 2019
@@ -139,9 +139,11 @@ apr_status_t apr_get_oslevel(apr_oslevel
  */
 
 static const char* const lateDllName[DLL_defined] = {
-    "kernel32", "advapi32", "mswsock",  "ws2_32", "shell32", "ntdll.dll"  };
+    "kernel32", "advapi32", "mswsock",  "ws2_32", "shell32", "ntdll.dll",
+    "Iphplapi"  };
 static HMODULE lateDllHandle[DLL_defined] = {
-     NULL,       NULL,       NULL,       NULL,     NULL,       NULL       };
+     NULL,       NULL,       NULL,       NULL,     NULL,      NULL,
+     NULL       };
 
 FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char* fnName, int ordinal)
 {

Modified: apr/apr/trunk/network_io/unix/sockaddr.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/network_io/unix/sockaddr.c?rev=1855855&r1=1855854&r2=1855855&view=diff
==============================================================================
--- apr/apr/trunk/network_io/unix/sockaddr.c (original)
+++ apr/apr/trunk/network_io/unix/sockaddr.c Tue Mar 19 18:10:46 2019
@@ -31,7 +31,6 @@
 
 #if defined(HAVE_IF_INDEXTONAME) && defined(_MSC_VER)
 #include <Iphlpapi.h>
-#pragma comment(lib, "Iphlpapi.lib")
 #endif
 
 #define APR_WANT_STRFUNC