Subject: get_iphlpapi_dns_info does not get Name Server

get_iphlpapi_dns_info does not get Name Server

From: Alfredo Tupone <alfredo_at_tupone.it>
Date: 2005-08-18

This is the first bug entry at sourceforge/c-ares so I wonder if that is
used at all :(

Link to the bug is :
https://sourceforge.net/tracker/index.php?func=detail&aid=1249476&group_id=135799&atid=735476

in ares_init.c there is a method to get the Name Server by calling
GetNetworkParams. As specified by MS, you need to call the function, and
then, if it return the ERROR_BUFFER_OVERFLOW result, you should allocate
the buffer and call this function again to get this parameters. The
current c-ares code does not handle the case where the buffer size is
just big enough, and just quit and go to fallback registry analyzing,
when no overflow is detected. We have fixed that inside the

static int get_iphlpapi_dns_info (char *ret_buf, size_t ret_size)

by declaring

HRESULT res;

and changing

if ((*GetNetworkParams) (fi, &size) != ERROR_BUFFER_OVERFLOW)
goto quit;

to

res = (*GetNetworkParams) (fi, &size);
if ((res != ERROR_BUFFER_OVERFLOW) && (res != ERROR_SUCCESS))
goto quit;

you can see:

http://cvs.sourceforge.net/viewcvs.py/bzflag/bzflag/src/c-ares/ares_init.c?r1=1.4&r2=1.5

A link to the MSDN related page:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/
iphlp/iphlp/retrieving_information_using_getnetworkparams.asp

_______________________________________________
http://cool.haxx.se/mailman/listinfo/c-ares
Received on Thu Aug 18 11:39:54 2005