lwconfig.c revision 24e0175a62f15a33a04f98571603873bd097b54a
/*
* Copyright (C) 2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lwconfig.c,v 1.1 2002/08/11 03:29:32 mayer 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;
int idx;
!= ERROR_SUCCESS)
/* Get the named directory */
}
idx = 0;
break;
}
idx++;
}
}
/* 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);
}
}
/* Get the list of nameservers */
while (pIPAddr) {
break;
if (res != LWRES_R_SUCCESS) {
return (res);
}
}
return (ret);
}