Commit a450efb4 authored by Yang Tse's avatar Yang Tse
Browse files

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.
parent 0cf8d4f8
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -98,7 +98,6 @@ extern "C" {
#define ARES_ELOADIPHLPAPI           21
#define ARES_ELOADIPHLPAPI           21
#define ARES_ELOADADVAPI32           22
#define ARES_ELOADADVAPI32           22
#define ARES_EADDRGetNetworkParams   23
#define ARES_EADDRGetNetworkParams   23
#define ARES_EADDRSYSTEMFUNCTION036  24


/* Flag values */
/* Flag values */
#define ARES_FLAG_USEVC         (1 << 0)
#define ARES_FLAG_USEVC         (1 << 0)
+6 −6
Original line number Original line Diff line number Diff line
@@ -51,12 +51,12 @@ static int ares_win32_init(void)


  fpSystemFunction036 = (fpSystemFunction036_t)
  fpSystemFunction036 = (fpSystemFunction036_t)
    GetProcAddress(hnd_advapi32, "SystemFunction036");
    GetProcAddress(hnd_advapi32, "SystemFunction036");
  if (!fpSystemFunction036)

    {
  /*
      FreeLibrary(hnd_advapi32);
   * Intentionally avoid checking if the address of SystemFunction036, a.k.a.
      FreeLibrary(hnd_iphlpapi);
   * RtlGenRandom, has been located or not. This function is only available on
      return ARES_EADDRSYSTEMFUNCTION036;
   * WinXP and later. When unavailable c-ares uses portable rand() function.
    }
   */


#endif
#endif
  return ARES_SUCCESS;
  return ARES_SUCCESS;
+1 −2
Original line number Original line Diff line number Diff line
@@ -46,8 +46,7 @@ const char *ares_strerror(int code)
    "Illegal hints flags specified",
    "Illegal hints flags specified",
    "Error loading iphlpapi.dll",
    "Error loading iphlpapi.dll",
    "Error loading advapi32.dll",
    "Error loading advapi32.dll",
    "Unknown GetNetworkParams function address",
    "Could not find GetNetworkParams function"
    "Unknown SystemFunction036 function address"
  };
  };


  if(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext)))
  if(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext)))