lwconfig.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2002, 2004, 2006, 2007, 2013, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: lwconfig.c,v 1.7 2007/12/14 01:40:42 marka Exp $ */
/*
* We do this so that we may incorporate everything in the main routines
* so that we can take advantage of the fixes and changes made there
* without having to add them twice. We can then call the parse routine
* if there is a resolv.conf file and fetch our own data from the
* Windows environment otherwise.
*/
/*
* Note that on Win32 there is normally no resolv.conf since all information
* is stored in the registry. Therefore there is no ordering like the
* contents of resolv.conf. Since the "search" or "domain" keyword, on
* Win32 if a search list is found it is used, otherwise the domain name
* is used since they are mutually exclusive. The search list can be entered
* that you add your nameserver list.
*/
#include "../lwconfig.c"
#include <iphlpapi.h>
#define TCPIP_SUBKEY \
"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
void
char searchlist[MAX_PATH];
char *cp;
!= ERROR_SUCCESS)
/* Get the named directory */
}
if (!keyFound)
return;
break;
}
}
}
/* Use the resolver if there is one */
return (ret);
/*
* We didn't get any nameservers so we need to do this ourselves
*/
if (dwRetVal == ERROR_BUFFER_OVERFLOW) {
}
if (dwRetVal != ERROR_SUCCESS) {
return (LWRES_R_FAILURE);
}
/* Get the search list from the registry */
/* Use only if there is no search list */
return (LWRES_R_FAILURE);
}
} else
/* Get the list of nameservers */
while (pIPAddr) {
break;
if (ret != LWRES_R_SUCCESS) {
return (ret);
}
}
return (LWRES_R_SUCCESS);
}