windows: include wincrypt.h before iphlpapi.h for mingw-w64 <6#18012
windows: include wincrypt.h before iphlpapi.h for mingw-w64 <6#18012vszakats wants to merge 7 commits intocurl:masterfrom
wincrypt.h before iphlpapi.h for mingw-w64 <6#18012Conversation
winsock2.h before iphlpapi.h
|
This lead into a journey into the spider-web of weird Windows build combinations with UWP, buggy mingw-w64 headers and Might trigger another PR trying to simplify edit: as of SDK 7.1a (the earliest SDK version curl supports, via v110_xp toolset meant for XP, see |
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
The issue with this is that the if_nametoindex auto-detection code would also need this hack, and it will make those super complicated. The auto-detection is not normally run with cmake (but necessary to pass a checkprefill test). With autotools however, it's required to detect if_nametoindex. `wincrypt.h` is not safe to include as-is because UWP does not support it, but in this case this is safe because `if_nametoindex` is not supported by UWP, and thus `HAVE_IF_NAMETOINDEX` is always undefined.
winsock2.h before iphlpapi.hwinsock2.h before iphlpapi.h
winsock2.h before iphlpapi.hwincrypt.h before iphlpapi.h (for mingw-w64 <=5)
wincrypt.h before iphlpapi.h (for mingw-w64 <=5)wincrypt.h before iphlpapi.h (for mingw-w64 <6)
wincrypt.h before iphlpapi.h (for mingw-w64 <6)wincrypt.h before iphlpapi.h for mingw-w64 <6
Required for mingw-w64 5.x (and older) builds targeting a Windows 7+.
mingw-w64 6+ fixed
mprapi.h(included indirectly viaiphlpapi.h)to include
wincrypt.hfor the missing types.MSVC is not affected because SDK 7.1a (the oldest MS SDK curl supports),
mprapi.hdoes includewincrypt.h.Make sure to include
wincrypt.hbefore includingiphlpapi.hasa workaround.
wincrypt.his used unconditionally even though it'snot available in UWP. This is safe in this context, because we use
iphlpapi.hforif_nametoindex, which is not supported and usedin UWP builds.
This fixes auto-detection that missed detecting
if_nametoindexinthe affected combination, and this build error in non-unity builds:
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 Win7job while workingon another PR.
Follow-up to 0d71b18 #17413
Ref: #18009
wincrypt.hincludes. It always available in XP+ in non-UWP builds.Skipping this. While
wincrypt.hcould be included in a simpler way, it's boundto a macro (
USE_WIN32_CRYPTO) that's basically sayingNOT UWP, butit's still clearer to use the existing macro to express this.
if_nametoindexdetection from windows: bump minimum to Vista (from XP) #18009, enable fromconfig-win32.h?config-win32.h#17980 to detectUSE_WIN32_CRYPTOand LDAP againconfig-win32.h.