Loading lib/config-win32.h +0 −10 Original line number Diff line number Diff line Loading @@ -154,11 +154,6 @@ #define HAVE_WS2TCPIP_H 1 #endif /* Define if you have the <Iphlpapi.h> header file. */ #ifndef __SALFORDC__ #define HAVE_IPHLPAPI_H 1 #endif /* ---------------------------------------------------------------- */ /* OTHER HEADER INFO */ /* ---------------------------------------------------------------- */ Loading Loading @@ -611,11 +606,6 @@ Vista # define HAVE_GETNAMEINFO 1 # endif #endif #if defined(HAVE_IPHLPAPI_H) #if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) #define HAVE_IF_NAMETOINDEX 1 #endif #endif #if defined(__POCC__) # ifndef _MSC_VER Loading lib/system_win32.c +24 −12 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 2016 - 2017, Steve Holme, <steve_holme@hotmail.com>. * Copyright (C) 2016 - 2019, Steve Holme, <steve_holme@hotmail.com>. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -36,6 +36,12 @@ LARGE_INTEGER Curl_freq; bool Curl_isVistaOrGreater; /* Handle of iphlpapp.dll */ static HMODULE s_hIpHlpApiDll = NULL; /* Pointer to the if_nametoindex function */ IF_NAMETOINDEX_FN Curl_if_nametoindex = NULL; /* Curl_win32_init() performs win32 global initialization */ CURLcode Curl_win32_init(long flags) { Loading Loading @@ -89,6 +95,17 @@ CURLcode Curl_win32_init(long flags) } #endif s_hIpHlpApiDll = Curl_load_library(TEXT("iphlpapi.dll")); if(s_hIpHlpApiDll) { /* Get the address of the if_nametoindex function */ IF_NAMETOINDEX_FN pIfNameToIndex = CURLX_FUNCTION_CAST(IF_NAMETOINDEX_FN, (GetProcAddress(s_hIpHlpApiDll, "if_nametoindex"))); if(pIfNameToIndex) Curl_if_nametoindex = pIfNameToIndex; } if(Curl_verify_windows_version(6, 0, PLATFORM_WINNT, VERSION_GREATER_THAN_EQUAL)) { Curl_isVistaOrGreater = TRUE; Loading @@ -103,6 +120,12 @@ CURLcode Curl_win32_init(long flags) /* Curl_win32_cleanup() is the opposite of Curl_win32_init() */ void Curl_win32_cleanup(long init_flags) { if(s_hIpHlpApiDll) { FreeLibrary(s_hIpHlpApiDll); s_hIpHlpApiDll = NULL; Curl_if_nametoindex = NULL; } #ifdef USE_WINDOWS_SSPI Curl_sspi_global_cleanup(); #endif Loading @@ -114,10 +137,6 @@ void Curl_win32_cleanup(long init_flags) } } #if defined(USE_WINDOWS_SSPI) || (!defined(CURL_DISABLE_TELNET) && \ defined(USE_WINSOCK)) #if !defined(LOAD_WITH_ALTERED_SEARCH_PATH) #define LOAD_WITH_ALTERED_SEARCH_PATH 0x00000008 #endif Loading @@ -140,8 +159,6 @@ typedef HMODULE (APIENTRY *LOADLIBRARYEX_FN)(LPCTSTR, HANDLE, DWORD); # define LOADLIBARYEX "LoadLibraryExA" #endif #endif /* USE_WINDOWS_SSPI || (!CURL_DISABLE_TELNET && USE_WINSOCK) */ /* * Curl_verify_windows_version() * Loading Loading @@ -334,9 +351,6 @@ bool Curl_verify_windows_version(const unsigned int majorVersion, return matched; } #if defined(USE_WINDOWS_SSPI) || (!defined(CURL_DISABLE_TELNET) && \ defined(USE_WINSOCK)) /* * Curl_load_library() * Loading Loading @@ -411,6 +425,4 @@ HMODULE Curl_load_library(LPCTSTR filename) return hModule; } #endif /* USE_WINDOWS_SSPI || (!CURL_DISABLE_TELNET && USE_WINSOCK) */ #endif /* WIN32 */ lib/system_win32.h +7 −6 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 2016, Steve Holme, <steve_holme@hotmail.com>. * Copyright (C) 2016 - 2019, Steve Holme, <steve_holme@hotmail.com>. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -48,20 +48,21 @@ typedef enum { PLATFORM_WINNT } PlatformIdentifier; /* We use our own typedef here since some headers might lack this */ typedef unsigned int(WINAPI *IF_NAMETOINDEX_FN)(char *); /* This is used instread of if_nametoindex if available on Windows */ IF_NAMETOINDEX_FN Curl_if_nametoindex; /* This is used to verify if we are running on a specific windows version */ bool Curl_verify_windows_version(const unsigned int majorVersion, const unsigned int minorVersion, const PlatformIdentifier platform, const VersionCondition condition); #if defined(USE_WINDOWS_SSPI) || (!defined(CURL_DISABLE_TELNET) && \ defined(USE_WINSOCK)) /* This is used to dynamically load DLLs */ HMODULE Curl_load_library(LPCTSTR filename); #endif /* USE_WINDOWS_SSPI || (!CURL_DISABLE_TELNET && USE_WINSOCK) */ #endif /* WIN32 */ #endif /* HEADER_CURL_SYSTEM_WIN32_H */ lib/url.c +13 −2 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ bool curl_win32_idn_to_ascii(const char *in, char **out); #include "inet_pton.h" #include "getinfo.h" #include "urlapi-int.h" #include "system_win32.h" /* And now for the protocols */ #include "ftp.h" Loading Loading @@ -1903,18 +1904,28 @@ static void zonefrom_url(CURLU *uh, struct connectdata *conn) if(!*endp && (scope < UINT_MAX)) /* A plain number, use it directly as a scope id. */ conn->scope_id = (unsigned int)scope; #ifdef HAVE_IF_NAMETOINDEX #if defined(HAVE_IF_NAMETOINDEX) else { #elif defined(WIN32) else if(Curl_if_nametoindex) { #endif #if defined(HAVE_IF_NAMETOINDEX) || defined(WIN32) /* Zone identifier is not numeric */ unsigned int scopeidx = 0; #if defined(WIN32) scopeidx = Curl_if_nametoindex(zoneid); #else scopeidx = if_nametoindex(zoneid); #endif if(!scopeidx) infof(conn->data, "Invalid zoneid: %s; %s\n", zoneid, strerror(errno)); else conn->scope_id = scopeidx; } #endif /* HAVE_IF_NAMETOINDEX */ #endif /* HAVE_IF_NAMETOINDEX || WIN32 */ free(zoneid); } } Loading Loading
lib/config-win32.h +0 −10 Original line number Diff line number Diff line Loading @@ -154,11 +154,6 @@ #define HAVE_WS2TCPIP_H 1 #endif /* Define if you have the <Iphlpapi.h> header file. */ #ifndef __SALFORDC__ #define HAVE_IPHLPAPI_H 1 #endif /* ---------------------------------------------------------------- */ /* OTHER HEADER INFO */ /* ---------------------------------------------------------------- */ Loading Loading @@ -611,11 +606,6 @@ Vista # define HAVE_GETNAMEINFO 1 # endif #endif #if defined(HAVE_IPHLPAPI_H) #if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) #define HAVE_IF_NAMETOINDEX 1 #endif #endif #if defined(__POCC__) # ifndef _MSC_VER Loading
lib/system_win32.c +24 −12 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 2016 - 2017, Steve Holme, <steve_holme@hotmail.com>. * Copyright (C) 2016 - 2019, Steve Holme, <steve_holme@hotmail.com>. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -36,6 +36,12 @@ LARGE_INTEGER Curl_freq; bool Curl_isVistaOrGreater; /* Handle of iphlpapp.dll */ static HMODULE s_hIpHlpApiDll = NULL; /* Pointer to the if_nametoindex function */ IF_NAMETOINDEX_FN Curl_if_nametoindex = NULL; /* Curl_win32_init() performs win32 global initialization */ CURLcode Curl_win32_init(long flags) { Loading Loading @@ -89,6 +95,17 @@ CURLcode Curl_win32_init(long flags) } #endif s_hIpHlpApiDll = Curl_load_library(TEXT("iphlpapi.dll")); if(s_hIpHlpApiDll) { /* Get the address of the if_nametoindex function */ IF_NAMETOINDEX_FN pIfNameToIndex = CURLX_FUNCTION_CAST(IF_NAMETOINDEX_FN, (GetProcAddress(s_hIpHlpApiDll, "if_nametoindex"))); if(pIfNameToIndex) Curl_if_nametoindex = pIfNameToIndex; } if(Curl_verify_windows_version(6, 0, PLATFORM_WINNT, VERSION_GREATER_THAN_EQUAL)) { Curl_isVistaOrGreater = TRUE; Loading @@ -103,6 +120,12 @@ CURLcode Curl_win32_init(long flags) /* Curl_win32_cleanup() is the opposite of Curl_win32_init() */ void Curl_win32_cleanup(long init_flags) { if(s_hIpHlpApiDll) { FreeLibrary(s_hIpHlpApiDll); s_hIpHlpApiDll = NULL; Curl_if_nametoindex = NULL; } #ifdef USE_WINDOWS_SSPI Curl_sspi_global_cleanup(); #endif Loading @@ -114,10 +137,6 @@ void Curl_win32_cleanup(long init_flags) } } #if defined(USE_WINDOWS_SSPI) || (!defined(CURL_DISABLE_TELNET) && \ defined(USE_WINSOCK)) #if !defined(LOAD_WITH_ALTERED_SEARCH_PATH) #define LOAD_WITH_ALTERED_SEARCH_PATH 0x00000008 #endif Loading @@ -140,8 +159,6 @@ typedef HMODULE (APIENTRY *LOADLIBRARYEX_FN)(LPCTSTR, HANDLE, DWORD); # define LOADLIBARYEX "LoadLibraryExA" #endif #endif /* USE_WINDOWS_SSPI || (!CURL_DISABLE_TELNET && USE_WINSOCK) */ /* * Curl_verify_windows_version() * Loading Loading @@ -334,9 +351,6 @@ bool Curl_verify_windows_version(const unsigned int majorVersion, return matched; } #if defined(USE_WINDOWS_SSPI) || (!defined(CURL_DISABLE_TELNET) && \ defined(USE_WINSOCK)) /* * Curl_load_library() * Loading Loading @@ -411,6 +425,4 @@ HMODULE Curl_load_library(LPCTSTR filename) return hModule; } #endif /* USE_WINDOWS_SSPI || (!CURL_DISABLE_TELNET && USE_WINSOCK) */ #endif /* WIN32 */
lib/system_win32.h +7 −6 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 2016, Steve Holme, <steve_holme@hotmail.com>. * Copyright (C) 2016 - 2019, Steve Holme, <steve_holme@hotmail.com>. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -48,20 +48,21 @@ typedef enum { PLATFORM_WINNT } PlatformIdentifier; /* We use our own typedef here since some headers might lack this */ typedef unsigned int(WINAPI *IF_NAMETOINDEX_FN)(char *); /* This is used instread of if_nametoindex if available on Windows */ IF_NAMETOINDEX_FN Curl_if_nametoindex; /* This is used to verify if we are running on a specific windows version */ bool Curl_verify_windows_version(const unsigned int majorVersion, const unsigned int minorVersion, const PlatformIdentifier platform, const VersionCondition condition); #if defined(USE_WINDOWS_SSPI) || (!defined(CURL_DISABLE_TELNET) && \ defined(USE_WINSOCK)) /* This is used to dynamically load DLLs */ HMODULE Curl_load_library(LPCTSTR filename); #endif /* USE_WINDOWS_SSPI || (!CURL_DISABLE_TELNET && USE_WINSOCK) */ #endif /* WIN32 */ #endif /* HEADER_CURL_SYSTEM_WIN32_H */
lib/url.c +13 −2 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ bool curl_win32_idn_to_ascii(const char *in, char **out); #include "inet_pton.h" #include "getinfo.h" #include "urlapi-int.h" #include "system_win32.h" /* And now for the protocols */ #include "ftp.h" Loading Loading @@ -1903,18 +1904,28 @@ static void zonefrom_url(CURLU *uh, struct connectdata *conn) if(!*endp && (scope < UINT_MAX)) /* A plain number, use it directly as a scope id. */ conn->scope_id = (unsigned int)scope; #ifdef HAVE_IF_NAMETOINDEX #if defined(HAVE_IF_NAMETOINDEX) else { #elif defined(WIN32) else if(Curl_if_nametoindex) { #endif #if defined(HAVE_IF_NAMETOINDEX) || defined(WIN32) /* Zone identifier is not numeric */ unsigned int scopeidx = 0; #if defined(WIN32) scopeidx = Curl_if_nametoindex(zoneid); #else scopeidx = if_nametoindex(zoneid); #endif if(!scopeidx) infof(conn->data, "Invalid zoneid: %s; %s\n", zoneid, strerror(errno)); else conn->scope_id = scopeidx; } #endif /* HAVE_IF_NAMETOINDEX */ #endif /* HAVE_IF_NAMETOINDEX || WIN32 */ free(zoneid); } } Loading