windows: fix UWP builds, add GHA job

Add new job to test building for UWP (aka `CURL_WINDOWS_APP`).

Fix fallouts when building for UWP:
- rand: do not use `BCryptGenRandom()`.
- cmake: disable using win32 LDAP.
- cmake: disable telnet.
- version_win32: fix code before declaration.
- schannel: disable `HAS_MANUAL_VERIFY_API`.
- schannel: disable `SSLSUPP_PINNEDPUBKEY`
  and make `schannel_checksum()` a stub.
  Ref: e178fbd40a #1429
- schannel: make `cert_get_name_string()` a failing stub.
- system_win32: make `Curl_win32_impersonating()` a failing stub.
- system_win32: try to fix `Curl_win32_init()` (untested).
- threads: fix to use `CreateThread()`.
- src: disable searching `PATH` for the CA bundle.
- src: disable bold text support and capability detection.
- src: disable `getfiletime()`/`setfiletime()`.
- tests: make `win32_load_system_library()` a failing stub.
- tests/server/util: make it compile.
- tests/server/sockfilt: make it compile.
- tests/lib3026: fix to use `CreateThread()`.

See individual commits for build error details.

Some of these fixes may have better solutions, and some may not work
as expected. The goal of this patch is to make curl build for UWP.

Closes #13870
This commit is contained in:
Viktor Szakats 2024-06-03 23:06:56 +02:00
parent 3060557af7
commit 998b17ea7f
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
18 changed files with 95 additions and 38 deletions

View file

@ -66,7 +66,7 @@ unsigned int get_terminal_columns(void)
struct winsize ts;
if(!ioctl(STDIN_FILENO, TIOCGWINSZ, &ts))
cols = (int)ts.ws_col;
#elif defined(_WIN32)
#elif defined(_WIN32) && !defined(CURL_WINDOWS_APP)
{
HANDLE stderr_hnd = GetStdHandle(STD_ERROR_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO console_info;

View file

@ -620,6 +620,11 @@ CURLcode FindWin32CACert(struct OperationConfig *config,
{
CURLcode result = CURLE_OK;
#ifdef CURL_WINDOWS_APP
(void)config;
(void)backend;
(void)bundle_file;
#else
/* Search and set cert file only if libcurl supports SSL.
*
* If Schannel is the selected SSL backend then these locations are
@ -645,6 +650,7 @@ CURLcode FindWin32CACert(struct OperationConfig *config,
result = CURLE_OUT_OF_MEMORY;
}
}
#endif
return result;
}
@ -703,6 +709,9 @@ cleanup:
return slist;
}
bool tool_term_has_bold;
#ifndef CURL_WINDOWS_APP
/* The terminal settings to restore on exit */
static struct TerminalSettings {
HANDLE hStdOut;
@ -714,8 +723,6 @@ static struct TerminalSettings {
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif
bool tool_term_has_bold;
static void restore_terminal(void)
{
if(InterlockedExchange(&TerminalSettings.valid, (LONG)FALSE))
@ -770,6 +777,7 @@ static void init_terminal(void)
}
}
}
#endif
LARGE_INTEGER tool_freq;
bool tool_isVistaOrGreater;
@ -786,7 +794,9 @@ CURLcode win32_init(void)
QueryPerformanceFrequency(&tool_freq);
#ifndef CURL_WINDOWS_APP
init_terminal();
#endif
return CURLE_OK;
}

View file

@ -41,7 +41,7 @@ int getfiletime(const char *filename, struct GlobalConfig *global,
/* Windows stat() may attempt to adjust the unix GMT file time by a daylight
saving time offset and since it's GMT that is bad behavior. When we have
access to a 64-bit type we can bypass stat and get the times directly. */
#if defined(_WIN32)
#if defined(_WIN32) && !defined(CURL_WINDOWS_APP)
HANDLE hfile;
TCHAR *tchar_filename = curlx_convert_UTF8_to_tchar((char *)filename);
@ -95,7 +95,7 @@ void setfiletime(curl_off_t filetime, const char *filename,
/* Windows utime() may attempt to adjust the unix GMT file time by a daylight
saving time offset and since it's GMT that is bad behavior. When we have
access to a 64-bit type we can bypass utime and set the times directly. */
#if defined(_WIN32)
#if defined(_WIN32) && !defined(CURL_WINDOWS_APP)
HANDLE hfile;
TCHAR *tchar_filename = curlx_convert_UTF8_to_tchar((char *)filename);