windows: reduce/stop loading DLLs at runtime

- replace dynamic `InitSecurityInterface()` call with early binding and
  link `secur32` system DLL.
  The library and function are available in all supported curl Windows
  targets, meaning WinXP or newer.  Add small hack for mingw32ce to
  make it build.

- detect and use `if_nametoindex()` on Windows when available. Link
  `iphlpapi` system DLL. Requires targeting Vista or newer.
  Replacing the dynamic call and the pre-load optimization for lib3026.

Suggested-by: Jay Satiro

Closes #17413
This commit is contained in:
Viktor Szakats 2025-05-21 19:37:55 +02:00
parent c129d0b1a8
commit 0d71b18153
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
16 changed files with 186 additions and 182 deletions

View file

@ -59,6 +59,10 @@
#error "We cannot compile without socket() support!"
#endif
#if defined(HAVE_IF_NAMETOINDEX) && defined(_WIN32)
#include <iphlpapi.h>
#endif
#include <limits.h>
#include "doh.h"
@ -1794,10 +1798,10 @@ static void zonefrom_url(CURLU *uh, struct Curl_easy *data,
#if defined(HAVE_IF_NAMETOINDEX) || defined(_WIN32)
/* Zone identifier is not numeric */
unsigned int scopeidx = 0;
#ifdef _WIN32
scopeidx = Curl_if_nametoindex(zoneid);
#else
#ifdef HAVE_IF_NAMETOINDEX
scopeidx = if_nametoindex(zoneid);
#else
scopeidx = Curl_if_nametoindex(zoneid);
#endif
if(!scopeidx) {
#ifndef CURL_DISABLE_VERBOSE_STRINGS