From b677ff3d15f3a26b185e89f15dee45bbd125902d Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Mon, 18 May 2009 01:25:20 +0000 Subject: [PATCH] Intentionally avoid checking if the address of SystemFunction036, a.k.a. RtlGenRandom, has been located or not. This function is only available on WinXP and later. When unavailable c-ares uses portable rand() function. --- ares.h | 1 - ares_library_init.c | 12 ++++++------ ares_strerror.c | 3 +-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/ares.h b/ares.h index 9d09a7a..6db8b96 100644 --- a/ares.h +++ b/ares.h @@ -98,7 +98,6 @@ extern "C" { #define ARES_ELOADIPHLPAPI 21 #define ARES_ELOADADVAPI32 22 #define ARES_EADDRGetNetworkParams 23 -#define ARES_EADDRSYSTEMFUNCTION036 24 /* Flag values */ #define ARES_FLAG_USEVC (1 << 0) diff --git a/ares_library_init.c b/ares_library_init.c index 92bcedf..ee3fe68 100644 --- a/ares_library_init.c +++ b/ares_library_init.c @@ -51,12 +51,12 @@ static int ares_win32_init(void) fpSystemFunction036 = (fpSystemFunction036_t) GetProcAddress(hnd_advapi32, "SystemFunction036"); - if (!fpSystemFunction036) - { - FreeLibrary(hnd_advapi32); - FreeLibrary(hnd_iphlpapi); - return ARES_EADDRSYSTEMFUNCTION036; - } + + /* + * Intentionally avoid checking if the address of SystemFunction036, a.k.a. + * RtlGenRandom, has been located or not. This function is only available on + * WinXP and later. When unavailable c-ares uses portable rand() function. + */ #endif return ARES_SUCCESS; diff --git a/ares_strerror.c b/ares_strerror.c index 4a2f453..6ded90d 100644 --- a/ares_strerror.c +++ b/ares_strerror.c @@ -46,8 +46,7 @@ const char *ares_strerror(int code) "Illegal hints flags specified", "Error loading iphlpapi.dll", "Error loading advapi32.dll", - "Unknown GetNetworkParams function address", - "Unknown SystemFunction036 function address" + "Could not find GetNetworkParams function" }; if(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext))) -- 2.7.4