Skip to content

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Jul 24, 2025

After this patch curl requires targeting Vista or newer, and a toolchain
with Vista support.

Supported MSVC compilers (VS2010+) all support Vista:

  • VS2012+ target Win8 (or later) by default.
  • VS2010 targets Win7 by default.

Supported mingw-w64 versions (v3+) all support Vista:

  • mingw-w64 v9+ target Win10 by default.
  • mingw-w64 v8 and older target Server 2003 (~XP) by default.
    After this patch it may be necessary to override the default Windows
    target version to Vista (or newer) via:
    autotools: CPPFLAGS=-D_WIN32_WINNT=0x0600
    cmake: -DCURL_TARGET_WINDOWS_VERSION=0x0600
  • mingw-w64 v6+ allow changing the default at toolchain build-time.

Notes:

  • For non-MSVC, non-mingw-w64 toolchains, if_nametoindex needs to be
    allowlisted in curl_setup.h, if they do support it.

Fixes #17985 (discussion)


w/o sp https://github.com/curl/curl/pull/18009/files?w=1

Targeting Windows 7 (instead of Vista) as a minimum, would save 20
lines more and two runtime version checks in Schannel. I think it's fine
to keep supporting Vista.

@vszakats vszakats marked this pull request as draft July 24, 2025 01:41
@vszakats vszakats added the Windows Windows-specific label Jul 24, 2025
@github-actions github-actions bot added the CI Continuous Integration label Jul 24, 2025
@vszakats vszakats force-pushed the vista branch 3 times, most recently from 9b136f3 to f0b639c Compare July 24, 2025 09:51
@vszakats vszakats changed the title windows: bump minimum to Windows 7 windows: bump minimum to Vista Jul 24, 2025
vszakats added a commit that referenced this pull request Jul 24, 2025
- lib/connect.c: unused since:
  71b7e01 #10141

- lib/curl_sspi.c: unused since:
  0d71b18 #17413

Cherry-picked from #18009
Closes #18011
vszakats added a commit to vszakats/curl that referenced this pull request Jul 24, 2025
Seen with a non-unity, mingw-w64 CI job targeting a Vista+ Windows
version while working on a PR. This combination is not normally
tested in CI.

Fixing:
```
In file included from D:/my-cache/mingw32/i686-w64-mingw32/include/iprtrmib.h:9:0,
                 from D:/my-cache/mingw32/i686-w64-mingw32/include/iphlpapi.h:17,
                 from D:/a/curl/curl/lib/url.c:63:
D:/my-cache/mingw32/i686-w64-mingw32/include/mprapi.h:865:3: error: unknown type name 'CERT_NAME_BLOB'
   CERT_NAME_BLOB *certificateNames;
   ^~~~~~~~~~~~~~
D:/my-cache/mingw32/i686-w64-mingw32/include/mprapi.h:887:3: error: unknown type name 'CRYPT_HASH_BLOB'
   CRYPT_HASH_BLOB certBlob;
   ^~~~~~~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/16497057672/job/46645264552?pr=18012#step:10:140

Follow-up to 0d71b18 curl#17413
Ref: curl#18009
vszakats added a commit to vszakats/curl that referenced this pull request Jul 24, 2025
Seen with a non-unity, mingw-w64 CI job targeting a Vista+ Windows
version while working on a PR. This combination is not normally
tested in CI.

Fixing:
```
In file included from D:/my-cache/mingw32/i686-w64-mingw32/include/iprtrmib.h:9:0,
                 from D:/my-cache/mingw32/i686-w64-mingw32/include/iphlpapi.h:17,
                 from D:/a/curl/curl/lib/url.c:63:
D:/my-cache/mingw32/i686-w64-mingw32/include/mprapi.h:865:3: error: unknown type name 'CERT_NAME_BLOB'
   CERT_NAME_BLOB *certificateNames;
   ^~~~~~~~~~~~~~
D:/my-cache/mingw32/i686-w64-mingw32/include/mprapi.h:887:3: error: unknown type name 'CRYPT_HASH_BLOB'
   CRYPT_HASH_BLOB certBlob;
   ^~~~~~~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/16497057672/job/46645264552?pr=18012#step:10:140

Follow-up to 0d71b18 curl#17413
Ref: curl#18009
vszakats added a commit that referenced this pull request Jul 24, 2025
Required for mingw-w64 5.x (and older) builds targeting a Windows 7+.

mingw-w64 6+ fixed `mprapi.h` (included indirectly via `iphlpapi.h`)
to include `wincrypt.h` for the missing types.

MSVC is not affected because SDK 7.1a (the oldest MS SDK curl supports),
`mprapi.h` does include `wincrypt.h`.

Make sure to include `wincrypt.h` before including `iphlpapi.h` as
a workaround. `wincrypt.h` is used unconditionally even though it's
not available in UWP. This is safe in this context, because we use
`iphlpapi.h` for `if_nametoindex`, which is not supported and used
in UWP builds.

This fixes auto-detection that missed detecting `if_nametoindex` in
the affected combination, and this build error in non-unity builds:
```
In file included from D:/my-cache/mingw32/i686-w64-mingw32/include/iprtrmib.h:9:0,
                 from D:/my-cache/mingw32/i686-w64-mingw32/include/iphlpapi.h:17,
                 from D:/a/curl/curl/lib/url.c:63:
D:/my-cache/mingw32/i686-w64-mingw32/include/mprapi.h:865:3: error: unknown type name 'CERT_NAME_BLOB'
   CERT_NAME_BLOB *certificateNames;
   ^~~~~~~~~~~~~~
D:/my-cache/mingw32/i686-w64-mingw32/include/mprapi.h:887:3: error: unknown type name 'CRYPT_HASH_BLOB'
   CRYPT_HASH_BLOB certBlob;
   ^~~~~~~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/16497057672/job/46645264552?pr=18012#step:10:140

This combination is not normally tested in CI. It was caught in
the `dl-mingw, CM 6.4.0-i686 schannel !unity Win7` job while working
on another PR.

Follow-up to 0d71b18 #17413
Ref: #18009
Closes #18012
@vszakats vszakats force-pushed the vista branch 2 times, most recently from 8c9ff31 to 5410661 Compare July 25, 2025 00:06
@vszakats vszakats changed the title windows: bump minimum to Vista windows: bump minimum to Vista (from XP) Jul 25, 2025
@vszakats vszakats force-pushed the vista branch 3 times, most recently from a87bd89 to 4c0a94f Compare July 27, 2025 12:20
vszakats added a commit that referenced this pull request Jul 27, 2025
Collision happens when building with mingw-w64 v3 or v2 while targeting
Vista or newer. `iphlpapi.h` includes `windns.h` in this case, which
defines macros named `DNS_TYPE_*`, colliding with curl doh enums.

The issue was fixed in mingw-w64 v4:
mirror/mingw-w64@ea95d55

Fixes:
```
lib/doh.h:54:3: error: expected identifier before numeric constant
   DNS_TYPE_A = 1,
   ^
```
Ref: https://github.com/curl/curl/actions/runs/16551209676/job/46806303365?pr=18009#step:10:17

This workaround seems harmless and generally good practice, but
another option is to require mingw-w64 v4.

Ref: #18009
Closes #18041
@vszakats vszakats force-pushed the vista branch 3 times, most recently from 7db8996 to 20cfc9e Compare July 28, 2025 10:53
@vszakats vszakats added the feature-window A merge of this requires an open feature window label Jul 28, 2025
UWP builds don't support iphlpapi's if_nametoindex().

```
D:/a/curl/curl/lib/url.c: In function 'zonefrom_url':
D:/a/curl/curl/lib/url.c:1777:55: error: unused parameter 'data' [-Werror=unused-parameter]
 1777 | static void zonefrom_url(CURLU *uh, struct Curl_easy *data,
      |                                     ~~~~~~~~~~~~~~~~~~^~~~
```

```
C:\a\curl\curl\lib\url.c(1777,55): warning C4100: 'data': unreferenced parameter [C:\a\curl\curl\bld\lib\libcurl_object.vcxproj]
```
…ista

mingw-w64 v5.x and older defaults to 0x0502 (WS2003)
mingw-w64 v6 v7 v8 defaults to 0x0502 (WS2003) by default
mingw-w64 v9.x and later (as of v13) defaults to 0x0a00 (Win10) by default
Present in all supported toolchains (VS2008+, mingw-w64),
but requires targeting XP SP2+.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration feature-window A merge of this requires an open feature window tests Windows Windows-specific

Development

Successfully merging this pull request may close these issues.

4 participants