Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2006-12-15 12:50:32 +0300
committerCorinna Vinschen <corinna@vinschen.de>2006-12-15 12:50:32 +0300
commitc21efb9a856090d8ef0e5a7fdd03bf6346de4b60 (patch)
tree3244f466f271d4931c1020a6e7e795c021f76fb8 /winsup/cygwin/libc
parent4c0b8a072bc2877282383f799274361858ff1c3e (diff)
* libc/minires-os-if.c (cygwin_query): Remove ERROR_PROC_NOT_FOUND case.
(get_dns_info): Verify DnsQuery exists. Use autoloaded GetNetworkParams.
Diffstat (limited to 'winsup/cygwin/libc')
-rw-r--r--winsup/cygwin/libc/minires-os-if.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/winsup/cygwin/libc/minires-os-if.c b/winsup/cygwin/libc/minires-os-if.c
index 28676cada..0f723ae34 100644
--- a/winsup/cygwin/libc/minires-os-if.c
+++ b/winsup/cygwin/libc/minires-os-if.c
@@ -196,10 +196,6 @@ static int cygwin_query(res_state statp, const char * DomName, int Class, int Ty
DPRINTF(debug, "DnsQuery: %lu (Windows)\n", res);
if (res) {
switch (res) {
- case ERROR_PROC_NOT_FOUND:
- errno = ENOSYS;
- statp->res_h_errno = NO_RECOVERY;
- break;
case ERROR_INVALID_NAME:
errno = EINVAL;
statp->res_h_errno = NETDB_INTERNAL;;
@@ -393,13 +389,12 @@ void get_dns_info(res_state statp)
DWORD dwRetVal;
IP_ADDR_STRING * pIPAddr;
FIXED_INFO * pFixedInfo;
- HINSTANCE kerneldll;
- typedef DWORD WINAPI (*GNPType)(PFIXED_INFO, PULONG);
- GNPType PGetNetworkParams;
int numAddresses = 0;
- if (statp->use_os) {
- DPRINTF(debug, "using dnsapi.dll\n");
+ if (statp->use_os
+ && ((dwRetVal = DnsQuery_A(NULL, 0, 0, NULL, NULL, NULL)) != ERROR_PROC_NOT_FOUND))
+ {
+ DPRINTF(debug, "using dnsapi.dll %d\n", dwRetVal);
statp->os_query = (typeof(statp->os_query)) cygwin_query;
/* We just need the search list. Avoid loading iphlpapi. */
statp->nscount = -1;
@@ -408,17 +403,8 @@ void get_dns_info(res_state statp)
if (statp->nscount != 0)
goto use_registry;
- if (!(kerneldll = LoadLibrary("IPHLPAPI.DLL"))) {
- DPRINTF(debug, "LoadLibrary: error %lu (Windows)\n", GetLastError());
- goto use_registry;
- }
- if (!(PGetNetworkParams = (GNPType) GetProcAddress(kerneldll,
- "GetNetworkParams"))) {
- DPRINTF(debug, "GetProcAddress: error %lu (Windows)\n", GetLastError());
- goto use_registry;
- }
/* First call to get the buffer length we need */
- dwRetVal = PGetNetworkParams((FIXED_INFO *) 0, &ulOutBufLen);
+ dwRetVal = GetNetworkParams((FIXED_INFO *) 0, &ulOutBufLen);
if (dwRetVal != ERROR_BUFFER_OVERFLOW) {
DPRINTF(debug, "GetNetworkParams: error %lu (Windows)\n", dwRetVal);
goto use_registry;
@@ -427,7 +413,7 @@ void get_dns_info(res_state statp)
DPRINTF(debug, "alloca: %s\n", strerror(errno));
goto use_registry;
}
- if ((dwRetVal = PGetNetworkParams((FIXED_INFO *) pFixedInfo, & ulOutBufLen))) {
+ if ((dwRetVal = GetNetworkParams(pFixedInfo, & ulOutBufLen))) {
DPRINTF(debug, "GetNetworkParams: error %lu (Windows)\n", dwRetVal);
goto use_registry;
}