mirror of
https://github.com/curl/curl.git
synced 2026-08-24 20:43:47 +03:00
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:
parent
3060557af7
commit
998b17ea7f
18 changed files with 95 additions and 38 deletions
|
|
@ -459,7 +459,7 @@ query_complete(DWORD err, DWORD bytes, LPWSAOVERLAPPED overlapped)
|
|||
* and wait on it.
|
||||
*/
|
||||
static
|
||||
#if defined(_WIN32_WCE)
|
||||
#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_APP)
|
||||
DWORD
|
||||
#else
|
||||
unsigned int
|
||||
|
|
@ -527,7 +527,7 @@ CURL_STDCALL getaddrinfo_thread(void *arg)
|
|||
* gethostbyname_thread() resolves a name and then exits.
|
||||
*/
|
||||
static
|
||||
#if defined(_WIN32_WCE)
|
||||
#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_APP)
|
||||
DWORD
|
||||
#else
|
||||
unsigned int
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ int Curl_thread_join(curl_thread_t *hnd)
|
|||
#elif defined(USE_THREADS_WIN32)
|
||||
|
||||
curl_thread_t Curl_thread_create(
|
||||
#if defined(_WIN32_WCE)
|
||||
#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_APP)
|
||||
DWORD
|
||||
#else
|
||||
unsigned int
|
||||
|
|
@ -109,14 +109,14 @@ curl_thread_t Curl_thread_create(
|
|||
(CURL_STDCALL *func) (void *),
|
||||
void *arg)
|
||||
{
|
||||
#ifdef _WIN32_WCE
|
||||
#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_APP)
|
||||
typedef HANDLE curl_win_thread_handle_t;
|
||||
#else
|
||||
typedef uintptr_t curl_win_thread_handle_t;
|
||||
#endif
|
||||
curl_thread_t t;
|
||||
curl_win_thread_handle_t thread_handle;
|
||||
#ifdef _WIN32_WCE
|
||||
#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_APP)
|
||||
thread_handle = CreateThread(NULL, 0, func, arg, 0, NULL);
|
||||
#else
|
||||
thread_handle = _beginthreadex(NULL, 0, func, arg, 0, NULL);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
#if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
|
||||
|
||||
curl_thread_t Curl_thread_create(
|
||||
#if defined(_WIN32_WCE)
|
||||
#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_APP)
|
||||
DWORD
|
||||
#else
|
||||
unsigned int
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
|
||||
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600
|
||||
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600 && \
|
||||
!defined(CURL_WINDOWS_APP)
|
||||
# define HAVE_WIN_BCRYPTGENRANDOM
|
||||
# include <bcrypt.h>
|
||||
# ifdef _MSC_VER
|
||||
|
|
|
|||
|
|
@ -112,7 +112,11 @@ CURLcode Curl_win32_init(long flags)
|
|||
}
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
#ifdef CURL_WINDOWS_APP
|
||||
ws2_32Dll = Curl_load_library(TEXT("ws2_32.dll"));
|
||||
#else
|
||||
ws2_32Dll = GetModuleHandleA("ws2_32");
|
||||
#endif
|
||||
if(ws2_32Dll) {
|
||||
Curl_FreeAddrInfoExW = CURLX_FUNCTION_CAST(FREEADDRINFOEXW_FN,
|
||||
GetProcAddress(ws2_32Dll, "FreeAddrInfoExW"));
|
||||
|
|
@ -269,11 +273,13 @@ HMODULE Curl_load_library(LPCTSTR filename)
|
|||
|
||||
bool Curl_win32_impersonating(void)
|
||||
{
|
||||
#ifndef CURL_WINDOWS_APP
|
||||
HANDLE token = NULL;
|
||||
if(OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE, &token)) {
|
||||
CloseHandle(token);
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,13 +80,13 @@ bool curlx_verify_windows_version(const unsigned int majorVersion,
|
|||
bool matched = FALSE;
|
||||
|
||||
#if defined(CURL_WINDOWS_APP)
|
||||
(void)buildVersion;
|
||||
|
||||
/* We have no way to determine the Windows version from Windows apps,
|
||||
so let's assume we're running on the target Windows version. */
|
||||
const WORD fullVersion = MAKEWORD(minorVersion, majorVersion);
|
||||
const WORD targetVersion = (WORD)_WIN32_WINNT;
|
||||
|
||||
(void)buildVersion;
|
||||
|
||||
switch(condition) {
|
||||
case VERSION_LESS_THAN:
|
||||
matched = targetVersion < fullVersion;
|
||||
|
|
|
|||
|
|
@ -2682,6 +2682,13 @@ static void schannel_checksum(const unsigned char *input,
|
|||
DWORD provType,
|
||||
const unsigned int algId)
|
||||
{
|
||||
#ifdef CURL_WINDOWS_APP
|
||||
(void)input;
|
||||
(void)inputlen;
|
||||
(void)provType;
|
||||
(void)algId;
|
||||
memset(checksum, 0, checksumlen);
|
||||
#else
|
||||
HCRYPTPROV hProv = 0;
|
||||
HCRYPTHASH hHash = 0;
|
||||
DWORD cbHashSize = 0;
|
||||
|
|
@ -2722,6 +2729,7 @@ static void schannel_checksum(const unsigned char *input,
|
|||
|
||||
if(hProv)
|
||||
CryptReleaseContext(hProv, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static CURLcode schannel_sha256sum(const unsigned char *input,
|
||||
|
|
@ -2906,7 +2914,9 @@ const struct Curl_ssl Curl_ssl_schannel = {
|
|||
#ifdef HAS_MANUAL_VERIFY_API
|
||||
SSLSUPP_CAINFO_BLOB |
|
||||
#endif
|
||||
#ifndef CURL_WINDOWS_APP
|
||||
SSLSUPP_PINNEDPUBKEY |
|
||||
#endif
|
||||
SSLSUPP_TLS13_CIPHERSUITES |
|
||||
SSLSUPP_CA_CACHE |
|
||||
SSLSUPP_HTTPS_PROXY,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@
|
|||
|
||||
#ifdef USE_SCHANNEL
|
||||
|
||||
#if defined(__MINGW32__) || defined(CERT_CHAIN_REVOCATION_CHECK_CHAIN)
|
||||
#if (defined(__MINGW32__) || defined(CERT_CHAIN_REVOCATION_CHECK_CHAIN)) \
|
||||
&& !defined(CURL_WINDOWS_APP)
|
||||
#define HAS_MANUAL_VERIFY_API
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -346,6 +346,12 @@ static DWORD cert_get_name_string(struct Curl_easy *data,
|
|||
DWORD length)
|
||||
{
|
||||
DWORD actual_length = 0;
|
||||
#if defined(CURL_WINDOWS_APP)
|
||||
(void)data;
|
||||
(void)cert_context;
|
||||
(void)host_names;
|
||||
(void)length;
|
||||
#else
|
||||
BOOL compute_content = FALSE;
|
||||
CERT_INFO *cert_info = NULL;
|
||||
CERT_EXTENSION *extension = NULL;
|
||||
|
|
@ -457,6 +463,7 @@ static DWORD cert_get_name_string(struct Curl_easy *data,
|
|||
/* Last string has double null-terminator. */
|
||||
*current_pos = '\0';
|
||||
}
|
||||
#endif
|
||||
return actual_length;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue