|
|
@ -250,25 +250,22 @@ static void ares_event_configchg_ip_cb(PVOID CallerContext, |
|
|
|
} |
|
|
|
} |
|
|
|
# endif |
|
|
|
# endif |
|
|
|
|
|
|
|
|
|
|
|
static ares_bool_t ares_event_configchg_regnotify(ares_event_configchg_t *configchg) |
|
|
|
static ares_bool_t |
|
|
|
|
|
|
|
ares_event_configchg_regnotify(ares_event_configchg_t *configchg) |
|
|
|
{ |
|
|
|
{ |
|
|
|
# if defined(__WATCOMC__) && !defined(REG_NOTIFY_THREAD_AGNOSTIC) |
|
|
|
# if defined(__WATCOMC__) && !defined(REG_NOTIFY_THREAD_AGNOSTIC) |
|
|
|
# define REG_NOTIFY_THREAD_AGNOSTIC 0x10000000L |
|
|
|
# define REG_NOTIFY_THREAD_AGNOSTIC 0x10000000L |
|
|
|
# endif |
|
|
|
# endif |
|
|
|
DWORD flags = |
|
|
|
DWORD flags = REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_LAST_SET | |
|
|
|
REG_NOTIFY_CHANGE_NAME|REG_NOTIFY_CHANGE_LAST_SET|REG_NOTIFY_THREAD_AGNOSTIC; |
|
|
|
REG_NOTIFY_THREAD_AGNOSTIC; |
|
|
|
|
|
|
|
|
|
|
|
if (RegNotifyChangeKeyValue(configchg->regip4, TRUE, |
|
|
|
if (RegNotifyChangeKeyValue(configchg->regip4, TRUE, flags, |
|
|
|
flags, |
|
|
|
configchg->regip4_event, TRUE) != ERROR_SUCCESS) { |
|
|
|
configchg->regip4_event, |
|
|
|
|
|
|
|
TRUE) != ERROR_SUCCESS) { |
|
|
|
|
|
|
|
return ARES_FALSE; |
|
|
|
return ARES_FALSE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (RegNotifyChangeKeyValue(configchg->regip6, TRUE, |
|
|
|
if (RegNotifyChangeKeyValue(configchg->regip6, TRUE, flags, |
|
|
|
flags, |
|
|
|
configchg->regip6_event, TRUE) != ERROR_SUCCESS) { |
|
|
|
configchg->regip6_event, |
|
|
|
|
|
|
|
TRUE) != ERROR_SUCCESS) { |
|
|
|
|
|
|
|
return ARES_FALSE; |
|
|
|
return ARES_FALSE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -318,14 +315,16 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg, |
|
|
|
/* 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() */ |
|
|
|
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, |
|
|
|
if (RegOpenKeyEx( |
|
|
|
"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces", |
|
|
|
HKEY_LOCAL_MACHINE, |
|
|
|
0, KEY_NOTIFY, &c->regip4) != ERROR_SUCCESS) { |
|
|
|
"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces", 0, |
|
|
|
|
|
|
|
KEY_NOTIFY, &c->regip4) != ERROR_SUCCESS) { |
|
|
|
status = ARES_ESERVFAIL; |
|
|
|
status = ARES_ESERVFAIL; |
|
|
|
goto done; |
|
|
|
goto done; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, |
|
|
|
if (RegOpenKeyEx( |
|
|
|
|
|
|
|
HKEY_LOCAL_MACHINE, |
|
|
|
"SYSTEM\\CurrentControlSet\\Services\\Tcpip6\\Parameters\\Interfaces", |
|
|
|
"SYSTEM\\CurrentControlSet\\Services\\Tcpip6\\Parameters\\Interfaces", |
|
|
|
0, KEY_NOTIFY, &c->regip6) != ERROR_SUCCESS) { |
|
|
|
0, KEY_NOTIFY, &c->regip6) != ERROR_SUCCESS) { |
|
|
|
status = ARES_ESERVFAIL; |
|
|
|
status = ARES_ESERVFAIL; |
|
|
@ -345,13 +344,15 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!RegisterWaitForSingleObject(&c->regip4_wait, c->regip4_event, |
|
|
|
if (!RegisterWaitForSingleObject(&c->regip4_wait, c->regip4_event, |
|
|
|
ares_event_configchg_reg_cb, c, INFINITE, WT_EXECUTEDEFAULT)) { |
|
|
|
ares_event_configchg_reg_cb, c, INFINITE, |
|
|
|
|
|
|
|
WT_EXECUTEDEFAULT)) { |
|
|
|
status = ARES_ESERVFAIL; |
|
|
|
status = ARES_ESERVFAIL; |
|
|
|
goto done; |
|
|
|
goto done; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!RegisterWaitForSingleObject(&c->regip6_wait, c->regip6_event, |
|
|
|
if (!RegisterWaitForSingleObject(&c->regip6_wait, c->regip6_event, |
|
|
|
ares_event_configchg_reg_cb, c, INFINITE, WT_EXECUTEDEFAULT)) { |
|
|
|
ares_event_configchg_reg_cb, c, INFINITE, |
|
|
|
|
|
|
|
WT_EXECUTEDEFAULT)) { |
|
|
|
status = ARES_ESERVFAIL; |
|
|
|
status = ARES_ESERVFAIL; |
|
|
|
goto done; |
|
|
|
goto done; |
|
|
|
} |
|
|
|
} |
|
|
@ -454,7 +455,8 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg, |
|
|
|
size_t i; |
|
|
|
size_t i; |
|
|
|
const char *searchlibs[] = { |
|
|
|
const char *searchlibs[] = { |
|
|
|
"/usr/lib/libSystem.dylib", |
|
|
|
"/usr/lib/libSystem.dylib", |
|
|
|
"/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration", |
|
|
|
"/System/Library/Frameworks/SystemConfiguration.framework/" |
|
|
|
|
|
|
|
"SystemConfiguration", |
|
|
|
NULL |
|
|
|
NULL |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -471,7 +473,8 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg, |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pdns_configuration_notify_key = dlsym(handle, "dns_configuration_notify_key"); |
|
|
|
pdns_configuration_notify_key = |
|
|
|
|
|
|
|
dlsym(handle, "dns_configuration_notify_key"); |
|
|
|
if (pdns_configuration_notify_key != NULL) { |
|
|
|
if (pdns_configuration_notify_key != NULL) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|