Skip to content

Commit

Permalink
Intentionally avoid checking if the address of SystemFunction036, a.k.a.
Browse files Browse the repository at this point in the history
RtlGenRandom, has been located or not. This function is only available on
WinXP and later. When unavailable c-ares uses portable rand() function.
  • Loading branch information
yangtse committed May 18, 2009
1 parent 0cf8d4f commit a450efb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion ares/ares.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions ares/ares_library_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions ares/ares_strerror.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit a450efb

Please sign in to comment.