diff options
Diffstat (limited to 'ares/ares_init.c')
-rw-r--r-- | ares/ares_init.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/ares/ares_init.c b/ares/ares_init.c index da6a04c40..68aae2dc6 100644 --- a/ares/ares_init.c +++ b/ares/ares_init.c @@ -67,6 +67,7 @@ #include <errno.h> #include "ares.h" #include "inet_net_pton.h" +#include "ares_library_init.h" #include "ares_private.h" #ifdef WATT32 @@ -560,9 +561,6 @@ static int get_iphlpapi_dns_info (char *ret_buf, size_t ret_size) { FIXED_INFO *fi, *newfi; DWORD size = sizeof (*fi); - typedef DWORD (WINAPI* get_net_param_func) (FIXED_INFO*, DWORD*); - get_net_param_func fpGetNetworkParams; /* available only on Win-98/2000+ */ - HMODULE handle; IP_ADDR_STRING *ipAddr; int i, count = 0; int debug = 0; @@ -573,15 +571,7 @@ static int get_iphlpapi_dns_info (char *ret_buf, size_t ret_size) fi = malloc(size); if (!fi) - return (0); - - handle = LoadLibrary ("iphlpapi.dll"); - if (!handle) - goto quit; - - fpGetNetworkParams = (get_net_param_func) GetProcAddress (handle, "GetNetworkParams"); - if (!fpGetNetworkParams) - goto quit; + return 0; res = (*fpGetNetworkParams) (fi, &size); if ((res != ERROR_BUFFER_OVERFLOW) && (res != ERROR_SUCCESS)) @@ -628,14 +618,12 @@ static int get_iphlpapi_dns_info (char *ret_buf, size_t ret_size) quit: if (fi) free(fi); - if (handle) - FreeLibrary (handle); if (debug && left <= ip_size) printf ("Too many nameservers. Truncating to %d addressess", count); if (ret > ret_buf) ret[-1] = '\0'; - return (count); + return count; } #endif @@ -1497,15 +1485,13 @@ static void randomize_key(unsigned char* key,int key_data_len) int randomized = 0; int counter=0; #ifdef WIN32 - HMODULE lib=LoadLibrary("ADVAPI32.DLL"); - if (lib) { - BOOLEAN (APIENTRY *pfn)(void*, ULONG) = - (BOOLEAN (APIENTRY *)(void*,ULONG))GetProcAddress(lib,"SystemFunction036"); - if (pfn && pfn(key,key_data_len) ) - randomized = 1; - - FreeLibrary(lib); - } + BOOLEAN res; + if (fpSystemFunction036) + { + res = (*fpSystemFunction036) (key, key_data_len); + if (res) + randomized = 1; + } #else /* !WIN32 */ #ifdef RANDOM_FILE FILE *f = fopen(RANDOM_FILE, "rb"); |