8000 Windows UWP (Store) support fix by bradh352 · Pull Request #845 · c-ares/c-ares · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Windows UWP (Store) support fix #845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/uwp.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 (ConvertInterfaceIndexToLuid "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONVERTINTERFACEINDEXTOLUID)
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)
IF (NOT WIN32)
# Disabled on Windows, because these functions are only really supported on Windows
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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(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(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)


Expand Down
6 changes: 6 additions & 0 deletions src/lib/ares_config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@
/* Define to 1 if you have the `ConvertInterfaceLuidToNameA' function. */
#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. */
#cmakedefine HAVE_INET_NET_PTON 1

Expand Down
5 changes: 5 additions & 0 deletions src/lib/config-win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@
# define HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1
#endif

/* Define to 1 if you have the `RegisterWaitForSingleObject' function. */
#define HAVE_REGISTERWAITFORSINGLEOBJECT 1

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

/* ---------------------------------------------------------------- */
Expand Down
21 changes: 14 additions & 7 deletions src/lib/event/ares_event_configchg.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,14 @@ void ares_event_configchg_destroy(ares_event_configchg_t *configchg)
return;
}

# ifndef __WATCOMC__
# ifdef HAVE_NOTIFYIPINTERFACECHANGE
if (configchg->ifchg_hnd != NULL) {
CancelMibChangeNotify2(configchg->ifchg_hnd);
configchg->ifchg_hnd = NULL;
}
# endif

# ifdef HAVE_REGISTERWAITFORSINGLEOBJECT
if (configchg->regip4_wait != NULL) {
UnregisterWait(configchg->regip4_wait);
configchg->regip4_wait = NULL;
Expand Down Expand Up @@ -231,12 +232,13 @@ void ares_event_configchg_destroy(ares_event_configchg_t *configchg)
CloseHandle(configchg->regip6_event);
configchg->regip6_event = NULL;
}
# endif

ares_free(configchg);
}


# ifndef __WATCOMC__
# ifdef HAVE_NOTIFYIPINTERFACECHANGE
static void NETIOAPI_API_
ares_event_configchg_ip_cb(PVOID CallerContext, PMIB_IPINTERFACE_ROW Row,
MIB_NOTIFICATION_TYPE NotificationType)
Expand All @@ -251,9 +253,10 @@ static void NETIOAPI_API_
static ares_bool_t
ares_event_configchg_regnotify(ares_event_configchg_t *configchg)
{
# if defined(__WATCOMC__) && !defined(REG_NOTIFY_THREAD_AGNOSTIC)
# define REG_NOTIFY_THREAD_AGNOSTIC 0x10000000L
# endif
# ifdef HAVE_REGISTERWAITFORSINGLEOBJECT
# if defined(__WATCOMC__) && !defined(REG_NOTIFY_THREAD_AGNOSTIC)
# define REG_NOTIFY_THREAD_AGNOSTIC 0x10000000L
# endif
DWORD flags = REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_LAST_SET |
REG_NOTIFY_THREAD_AGNOSTIC;

Expand All @@ -266,7 +269,9 @@ static ares_bool_t
configchg->regip6_event, TRUE) != ERROR_SUCCESS) {
return ARES_FALSE;
}

# else
(void)configchg;
# endif
return ARES_TRUE;
}

Expand Down Expand Up @@ -296,7 +301,7 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,

c->e = e;

# ifndef __WATCOMC__
# ifdef HAVE_NOTIFYIPINTERFACECHANGE
/* NOTE: If a user goes into the control panel and changes the network
* adapter DNS addresses manually, this will NOT trigger a notification.
* We've also tried listening on NotifyUnicastIpAddressChange(), but
Expand All @@ -309,6 +314,7 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
}
# endif

# ifdef HAVE_REGISTERWAITFORSINGLEOBJECT
/* Monitor HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\Interfaces
* and HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces
* for changes via RegNotifyChangeKeyValue() */
Expand Down Expand Up @@ -353,6 +359,7 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
status = ARES_ESERVFAIL;
goto done;
}
# endif

if (!ares_event_configchg_regnotify(c)) {
status = ARES_ESERVFAIL;
Expand Down
Loading
0