diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 3c0b78462303..413cd60371ae 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -178,7 +178,7 @@ jobs: - { build: 'cmake' , sys: 'mingw64', env: 'x86_64' , tflags: '' , config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON -DENABLE_ARES=ON', type: 'Debug', name: 'schannel c-ares U' } - { build: 'cmake' , sys: 'ucrt64' , env: 'ucrt-x86_64' , tflags: 'skiprun' , config: '-DENABLE_DEBUG=OFF -DBUILD_SHARED_LIBS=ON -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON -DENABLE_CURLDEBUG=ON', type: 'Release', name: 'schannel R TrackMemory' } - { build: 'cmake' , sys: 'clang64', env: 'clang-x86_64', tflags: 'skiprun' , config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_OPENSSL=ON -DENABLE_UNICODE=OFF', type: 'Release', name: 'openssl' } - - { build: 'cmake' , sys: 'ucrt64' , env: 'ucrt-x86_64' , tflags: 'skiprun' , config: '-DENABLE_DEBUG=OFF -DBUILD_SHARED_LIBS=ON -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON', type: 'Release', test: 'uwp', name: 'schannel' } + - { build: 'cmake' , sys: 'ucrt64' , env: 'ucrt-x86_64' , tflags: 'skiprun' , config: '-DENABLE_DEBUG=OFF -DBUILD_SHARED_LIBS=ON -DCURL_USE_SCHANNEL=ON', type: 'Release', test: 'uwp', name: 'schannel' } - { build: 'cmake' , sys: 'mingw64', env: 'x86_64' , tflags: 'skiprun' , config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=ON -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON -DCMAKE_VERBOSE_MAKEFILE=ON', type: 'Debug', cflags: '-DCURL_SCHANNEL_DEV_DEBUG', name: 'schannel dev debug' } - { build: 'cmake' , sys: 'mingw32', env: 'i686' , tflags: 'skiprun' , config: '-DENABLE_DEBUG=OFF -DBUILD_SHARED_LIBS=ON -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON', type: 'Release', name: 'schannel R' } fail-fast: false @@ -676,11 +676,20 @@ jobs: timeout-minutes: 5 run: | PATH="/c/msys64/usr/bin:$PATH" + if [ '${{ matrix.plat }}' = 'uwp' ]; then + options+=' -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0' + cflags='-DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP' + ldflags='/OPT:NOREF /OPT:NOICF /APPCONTAINER:NO' + vsglobals=';AppxPackage=false;WindowsAppContainer=false' + fi cmake -B bld ${options} \ "-DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" \ "-DVCPKG_INSTALLED_DIR=$VCPKG_INSTALLATION_ROOT/installed" \ '-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-${{ matrix.plat }}' \ - -DCMAKE_VS_GLOBALS=TrackFileAccess=false \ + "-DCMAKE_C_FLAGS=${cflags}" \ + "-DCMAKE_EXE_LINKER_FLAGS=/INCREMENTAL:NO ${ldflags}" \ + "-DCMAKE_SHARED_LINKER_FLAGS=/INCREMENTAL:NO ${ldflags}" \ + "-DCMAKE_VS_GLOBALS=TrackFileAccess=false${vsglobals}" \ '-DCMAKE_BUILD_TYPE=${{ matrix.type }}' \ -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \ -DCURL_WERROR=ON \ diff --git a/CMakeLists.txt b/CMakeLists.txt index f6582a0948cc..3c3326e8df3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,6 +108,9 @@ endif() if(WIN32) set(_target_flags "${_target_flags} WIN32") endif() +if(WINDOWS_STORE) + set(_target_flags "${_target_flags} UWP") +endif() if(CYGWIN) set(_target_flags "${_target_flags} CYGWIN") endif() @@ -178,6 +181,9 @@ if(WIN32) endif() option(ENABLE_UNICODE "Use the Unicode version of the Windows API functions" OFF) + if(WINDOWS_STORE) + set(ENABLE_UNICODE ON) + endif() if(ENABLE_UNICODE) add_definitions("-DUNICODE" "-D_UNICODE") if(MINGW) diff --git a/docs/examples/websocket.c b/docs/examples/websocket.c index 996f2a024548..758ee48e0e61 100644 --- a/docs/examples/websocket.c +++ b/docs/examples/websocket.c @@ -28,6 +28,7 @@ #include #include #ifdef _WIN32 +#include #include #define sleep(s) Sleep((DWORD)(s)) #else diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 420a4384cef1..50b4479f2377 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -465,6 +465,12 @@ #include #endif +#ifdef _WIN32 +#define Curl_getpid() GetCurrentProcessId() +#else +#define Curl_getpid() getpid() +#endif + /* * Large file (>2Gb) support using Win32 functions. */ diff --git a/lib/smb.c b/lib/smb.c index a242fc5c2a28..a72ece62ad70 100644 --- a/lib/smb.c +++ b/lib/smb.c @@ -27,12 +27,6 @@ #if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) -#ifdef _WIN32 -#define Curl_getpid() ((unsigned int)GetCurrentProcessId()) -#else -#define Curl_getpid() ((unsigned int)getpid()) -#endif - #include "smb.h" #include "urldata.h" #include "sendf.h" @@ -548,7 +542,7 @@ static void smb_format_message(struct Curl_easy *data, struct smb_header *h, h->flags2 = smb_swap16(SMB_FLAGS2_IS_LONG_NAME | SMB_FLAGS2_KNOWS_LONG_NAME); h->uid = smb_swap16(smbc->uid); h->tid = smb_swap16(req->tid); - pid = Curl_getpid(); + pid = (unsigned int)Curl_getpid(); h->pid_high = smb_swap16((unsigned short)(pid >> 16)); h->pid = smb_swap16((unsigned short) pid); } diff --git a/src/tool_doswin.c b/src/tool_doswin.c index 70b263113e06..301b2974e5bd 100644 --- a/src/tool_doswin.c +++ b/src/tool_doswin.c @@ -616,9 +616,10 @@ CURLcode FindWin32CACert(struct OperationConfig *config, */ struct curl_slist *GetLoadedModulePaths(void) { + struct curl_slist *slist = NULL; +#if !defined(CURL_WINDOWS_UWP) HANDLE hnd = INVALID_HANDLE_VALUE; MODULEENTRY32 mod = {0}; - struct curl_slist *slist = NULL; mod.dwSize = sizeof(MODULEENTRY32); @@ -661,6 +662,7 @@ struct curl_slist *GetLoadedModulePaths(void) cleanup: if(hnd != INVALID_HANDLE_VALUE) CloseHandle(hnd); +#endif return slist; } diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c index b0168038773b..9cab12c5ac37 100644 --- a/tests/server/rtspd.c +++ b/tests/server/rtspd.c @@ -1394,7 +1394,7 @@ int main(int argc, char *argv[]) if(got_exit_signal) { logmsg("========> %s rtspd (port: %d pid: %ld) exits with signal (%d)", - ipv_inuse, (int)port, (long)getpid(), exit_signal); + ipv_inuse, (int)port, (long)Curl_getpid(), exit_signal); /* * To properly set the return status of the process we * must raise the same signal SIGINT or SIGTERM that we diff --git a/tests/server/sws.c b/tests/server/sws.c index cdc94fe19e70..ef139bfc3c1f 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -2492,7 +2492,7 @@ int main(int argc, char *argv[]) if(got_exit_signal) { logmsg("========> %s sws (%s pid: %ld) exits with signal (%d)", - socket_type, location_str, (long)getpid(), exit_signal); + socket_type, location_str, (long)Curl_getpid(), exit_signal); /* * To properly set the return status of the process we * must raise the same signal SIGINT or SIGTERM that we diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c index c6ac1505da97..4edc2fd6ddf4 100644 --- a/tests/server/tftpd.c +++ b/tests/server/tftpd.c @@ -871,7 +871,7 @@ int main(int argc, char **argv) if(got_exit_signal) { logmsg("========> %s tftpd (port: %d pid: %ld) exits with signal (%d)", - ipv_inuse, (int)port, (long)getpid(), exit_signal); + ipv_inuse, (int)port, (long)Curl_getpid(), exit_signal); /* * To properly set the return status of the process we * must raise the same signal SIGINT or SIGTERM that we diff --git a/tests/server/util.c b/tests/server/util.c index a36dc0055d36..287ca3000ac5 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -278,7 +278,7 @@ curl_off_t our_getpid(void) { curl_off_t pid; - pid = (curl_off_t)getpid(); + pid = (curl_off_t)Curl_getpid(); #if defined(_WIN32) /* store pid + 65536 to avoid conflict with Cygwin/msys PIDs, see also: * - https://cygwin.com/git/?p=newlib-cygwin.git;a=commit; ↵