mirror of
https://github.com/curl/curl.git
synced 2026-08-24 17:03:32 +03:00
Introduction of ares_library_init() and ares_library_cleanup()
This commit is contained in:
parent
60a6af7498
commit
2d64cd55a1
9 changed files with 75 additions and 28 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue