From 369d7c71485c9a63ab616d7bd69cfcd391d7637c Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Fri, 16 Jun 2023 14:16:03 +0200 Subject: [PATCH] Don't use FindFirstFileW() before Windows XP On runtime it will attempt to get FindFirstFileW() from kernel32.dll but it's not there and the DLL/program containing mbedtls will not load. Signed-off-by: Steve Lhomme --- library/x509_crt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/x509_crt.c b/library/x509_crt.c index 453389b7ef..a784e634dd 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -1540,6 +1540,7 @@ int mbedtls_x509_crt_parse_path(mbedtls_x509_crt *chain, const char *path) { int ret = 0; #if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32) +#if _WIN32_WINNT >= 0x0501 /* _WIN32_WINNT_XP */ int w_ret; WCHAR szDir[MAX_PATH]; char filename[MAX_PATH]; @@ -1602,6 +1603,9 @@ int mbedtls_x509_crt_parse_path(mbedtls_x509_crt *chain, const char *path) cleanup: FindClose(hFind); +#else /* !_WIN32_WINNT_XP */ +#error mbedtls_x509_crt_parse_path not available before Windows XP +#endif /* !_WIN32_WINNT_XP */ #else /* _WIN32 */ int t_ret; int snp_ret;