Windows UWP (Store) support fix (#845)

Because AppVeyor's version of MSVC needed to be patched to build UWP
applications:
https://developercommunity.visualstudio.com/t/clexe-compiler-error-C1007-when-compili/10486219
We ended up disabling UWP builds in our CI environment.

It turns out UWP support had broken in the meantime:
https://github.com/microsoft/vcpkg/pull/40213

This PR fixes the build regression and also adds a GitHub action CI
workflow for building the UWP app so we can catch this in the future.

Fix By: Brad House (@bradh352)
pull/846/head
Brad House 4 months ago committed by GitHub
parent 9377126687
commit 3fd5925adf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 29
      .github/workflows/uwp.yml
  2. 4
      CMakeLists.txt
  3. 2
      configure.ac
  4. 6
      src/lib/ares_config.h.cmake
  5. 5
      src/lib/config-win32.h
  6. 21
      src/lib/event/ares_event_configchg.c

@ -0,0 +1,29 @@
# Copyright (C) The c-ares project and its contributors
# SPDX-License-Identifier: MIT
name: Windows UWP (Store)
on:
push:
pull_request:
concurrency:
group: ${{ github.ref }}-uwp
cancel-in-progress: true
jobs:
build:
runs-on: windows-latest
name: Windows UWP (Store)
steps:
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
uwp: true
- name: Checkout c-ares
uses: actions/checkout@v4
- name: Build c-ares
run: |
mkdir build
cmake -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON "-DCMAKE_SYSTEM_VERSION=10.0" -DCMAKE_SYSTEM_NAME=WindowsStore -A x64 -Bbuild
cmake --build build --config Debug
# -DCMAKE_SYSTEM_VERSION=10.0

@ -425,6 +425,10 @@ CHECK_SYMBOL_EXISTS (if_indextoname "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_IF_INDE
CHECK_SYMBOL_EXISTS (if_nametoindex "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_IF_NAMETOINDEX) CHECK_SYMBOL_EXISTS (if_nametoindex "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_IF_NAMETOINDEX)
CHECK_SYMBOL_EXISTS (ConvertInterfaceIndexToLuid "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONVERTINTERFACEINDEXTOLUID) CHECK_SYMBOL_EXISTS (ConvertInterfaceIndexToLuid "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONVERTINTERFACEINDEXTOLUID)
CHECK_SYMBOL_EXISTS (ConvertInterfaceLuidToNameA "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONVERTINTERFACELUIDTONAMEA) CHECK_SYMBOL_EXISTS (ConvertInterfaceLuidToNameA "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONVERTINTERFACELUIDTONAMEA)
CHECK_SYMBOL_EXISTS (NotifyIpInterfaceChange "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_NOTIFYIPINTERFACECHANGE)
CHECK_SYMBOL_EXISTS (RegisterWaitForSingleObject "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_REGISTERWAITFORSINGLEOBJECT)
CHECK_SYMBOL_EXISTS (inet_net_pton "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_INET_NET_PTON) CHECK_SYMBOL_EXISTS (inet_net_pton "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_INET_NET_PTON)
IF (NOT WIN32) IF (NOT WIN32)
# Disabled on Windows, because these functions are only really supported on Windows # Disabled on Windows, because these functions are only really supported on Windows

@ -585,6 +585,8 @@ AC_CHECK_DECL(kqueue, [AC_DEFINE([HAVE_KQUEUE], 1, [Define t
AC_CHECK_DECL(epoll_create1, [AC_DEFINE([HAVE_EPOLL], 1, [Define to 1 if you have `epoll_{create1,ctl,wait}`])], [], $cares_all_includes) AC_CHECK_DECL(epoll_create1, [AC_DEFINE([HAVE_EPOLL], 1, [Define to 1 if you have `epoll_{create1,ctl,wait}`])], [], $cares_all_includes)
AC_CHECK_DECL(ConvertInterfaceIndexToLuid, [AC_DEFINE([HAVE_CONVERTINTERFACEINDEXTOLUID], 1, [Define to 1 if you have `ConvertInterfaceIndexToLuid`])], [], $cares_all_includes) AC_CHECK_DECL(ConvertInterfaceIndexToLuid, [AC_DEFINE([HAVE_CONVERTINTERFACEINDEXTOLUID], 1, [Define to 1 if you have `ConvertInterfaceIndexToLuid`])], [], $cares_all_includes)
AC_CHECK_DECL(ConvertInterfaceLuidToNameA, [AC_DEFINE([HAVE_CONVERTINTERFACELUIDTONAMEA], 1, [Define to 1 if you have `ConvertInterfaceLuidToNameA`])], [], $cares_all_includes) AC_CHECK_DECL(ConvertInterfaceLuidToNameA, [AC_DEFINE([HAVE_CONVERTINTERFACELUIDTONAMEA], 1, [Define to 1 if you have `ConvertInterfaceLuidToNameA`])], [], $cares_all_includes)
AC_CHECK_DECL(NotifyIpInterfaceChange, [AC_DEFINE([HAVE_NOTIFYIPINTERFACECHANGE], 1, [Define to 1 if you have `NotifyIpInterfaceChange`] )], [], $cares_all_includes)
AC_CHECK_DECL(RegisterWaitForSingleObject, [AC_DEFINE([HAVE_REGISTERWAITFORSINGLEOBJECT], 1, [Define to 1 if you have `RegisterWaitForSingleObject`])], [], $cares_all_includes)
AC_CHECK_DECL(__system_property_get, [AC_DEFINE([HAVE___SYSTEM_PROPERTY_GET], 1, [Define to 1 if you have `__system_property_get`] )], [], $cares_all_includes) AC_CHECK_DECL(__system_property_get, [AC_DEFINE([HAVE___SYSTEM_PROPERTY_GET], 1, [Define to 1 if you have `__system_property_get`] )], [], $cares_all_includes)

@ -148,6 +148,12 @@
/* Define to 1 if you have the `ConvertInterfaceLuidToNameA' function. */ /* Define to 1 if you have the `ConvertInterfaceLuidToNameA' function. */
#cmakedefine HAVE_CONVERTINTERFACELUIDTONAMEA 1 #cmakedefine HAVE_CONVERTINTERFACELUIDTONAMEA 1
/* Define to 1 if you have the `NotifyIpInterfaceChange' function. */
#cmakedefine HAVE_NOTIFYIPINTERFACECHANGE 1
/* Define to 1 if you have the `RegisterWaitForSingleObject' function. */
#cmakedefine HAVE_REGISTERWAITFORSINGLEOBJECT 1
/* Define to 1 if you have a IPv6 capable working inet_net_pton function. */ /* Define to 1 if you have a IPv6 capable working inet_net_pton function. */
#cmakedefine HAVE_INET_NET_PTON 1 #cmakedefine HAVE_INET_NET_PTON 1

@ -352,6 +352,9 @@
# define HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1 # define HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1
#endif #endif
/* Define to 1 if you have the `RegisterWaitForSingleObject' function. */
#define HAVE_REGISTERWAITFORSINGLEOBJECT 1
#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) && \ #if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) && \
!defined(__WATCOMC__) && !defined(WATT32) !defined(__WATCOMC__) && !defined(WATT32)
/* Define if you have if_nametoindex() */ /* Define if you have if_nametoindex() */
@ -362,6 +365,8 @@
# define HAVE_CONVERTINTERFACEINDEXTOLUID 1 # define HAVE_CONVERTINTERFACEINDEXTOLUID 1
/* Define to 1 if you have the `ConvertInterfaceLuidToNameA' function. */ /* Define to 1 if you have the `ConvertInterfaceLuidToNameA' function. */
# define HAVE_CONVERTINTERFACELUIDTONAMEA 1 # define HAVE_CONVERTINTERFACELUIDTONAMEA 1
/* Define to 1 if you have the `NotifyIpInterfaceChange' function. */
# define HAVE_NOTIFYIPINTERFACECHANGE 1
#endif #endif
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */

@ -195,13 +195,14 @@ void ares_event_configchg_destroy(ares_event_configchg_t *configchg)
return; return;
} }
# ifndef __WATCOMC__ # ifdef HAVE_NOTIFYIPINTERFACECHANGE
if (configchg->ifchg_hnd != NULL) { if (configchg->ifchg_hnd != NULL) {
CancelMibChangeNotify2(configchg->ifchg_hnd); CancelMibChangeNotify2(configchg->ifchg_hnd);
configchg->ifchg_hnd = NULL; configchg->ifchg_hnd = NULL;
} }
# endif # endif
# ifdef HAVE_REGISTERWAITFORSINGLEOBJECT
if (configchg->regip4_wait != NULL) { if (configchg->regip4_wait != NULL) {
UnregisterWait(configchg->regip4_wait); UnregisterWait(configchg->regip4_wait);
configchg->regip4_wait = NULL; configchg->regip4_wait = NULL;
@ -231,12 +232,13 @@ void ares_event_configchg_destroy(ares_event_configchg_t *configchg)
CloseHandle(configchg->regip6_event); CloseHandle(configchg->regip6_event);
configchg->regip6_event = NULL; configchg->regip6_event = NULL;
} }
# endif
ares_free(configchg); ares_free(configchg);
} }
# ifndef __WATCOMC__ # ifdef HAVE_NOTIFYIPINTERFACECHANGE
static void NETIOAPI_API_ static void NETIOAPI_API_
ares_event_configchg_ip_cb(PVOID CallerContext, PMIB_IPINTERFACE_ROW Row, ares_event_configchg_ip_cb(PVOID CallerContext, PMIB_IPINTERFACE_ROW Row,
MIB_NOTIFICATION_TYPE NotificationType) MIB_NOTIFICATION_TYPE NotificationType)
@ -251,9 +253,10 @@ static void NETIOAPI_API_
static ares_bool_t static ares_bool_t
ares_event_configchg_regnotify(ares_event_configchg_t *configchg) ares_event_configchg_regnotify(ares_event_configchg_t *configchg)
{ {
# if defined(__WATCOMC__) && !defined(REG_NOTIFY_THREAD_AGNOSTIC) # ifdef HAVE_REGISTERWAITFORSINGLEOBJECT
# define REG_NOTIFY_THREAD_AGNOSTIC 0x10000000L # if defined(__WATCOMC__) && !defined(REG_NOTIFY_THREAD_AGNOSTIC)
# endif # define REG_NOTIFY_THREAD_AGNOSTIC 0x10000000L
# endif
DWORD flags = REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_LAST_SET | DWORD flags = REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_LAST_SET |
REG_NOTIFY_THREAD_AGNOSTIC; REG_NOTIFY_THREAD_AGNOSTIC;
@ -266,7 +269,9 @@ static ares_bool_t
configchg->regip6_event, TRUE) != ERROR_SUCCESS) { configchg->regip6_event, TRUE) != ERROR_SUCCESS) {
return ARES_FALSE; return ARES_FALSE;
} }
# else
(void)configchg;
# endif
return ARES_TRUE; return ARES_TRUE;
} }
@ -296,7 +301,7 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
c->e = e; c->e = e;
# ifndef __WATCOMC__ # ifdef HAVE_NOTIFYIPINTERFACECHANGE
/* NOTE: If a user goes into the control panel and changes the network /* NOTE: If a user goes into the control panel and changes the network
* adapter DNS addresses manually, this will NOT trigger a notification. * adapter DNS addresses manually, this will NOT trigger a notification.
* We've also tried listening on NotifyUnicastIpAddressChange(), but * We've also tried listening on NotifyUnicastIpAddressChange(), but
@ -309,6 +314,7 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
} }
# endif # endif
# ifdef HAVE_REGISTERWAITFORSINGLEOBJECT
/* Monitor HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\Interfaces /* Monitor HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\Interfaces
* and HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces * and HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces
* for changes via RegNotifyChangeKeyValue() */ * for changes via RegNotifyChangeKeyValue() */
@ -353,6 +359,7 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
status = ARES_ESERVFAIL; status = ARES_ESERVFAIL;
goto done; goto done;
} }
# endif
if (!ares_event_configchg_regnotify(c)) { if (!ares_event_configchg_regnotify(c)) {
status = ARES_ESERVFAIL; status = ARES_ESERVFAIL;

Loading…
Cancel
Save