Mailing List Archive

Work-around a bug in Microsoft's DNSAPI.DLL
Probably you have already noticed following bug of Microsoft's DnsQuery
function:

If you don't specify the flag DNS_QUERY_BYPASS_CACHE and you query a
non-existing domain a second time, then the return code is 9501 (no records)
instead of 9003 (NXDOMAIN).

The work-around is to call DnsQuery_A() a second time with the flag
DNS_QUERY_BYPASS_CACHE, if it returned DNS_INFO_NO_RECORDS when calling it
without the flag DNS_QUERY_BYPASS_CACHE.

For example:

DNS_STATUS rc;
DNS_RECORD* dnslist=NULL;

rc=DnsQuery_A(domain,type,
DNS_QUERY_TREAT_AS_FQDN,NULL,&dnslist,NULL);
if (rc==DNS_INFO_NO_RECORDS)
{
rc=DnsQuery_A(domain,type,DNS_QUERY_BYPASS_CACHE|
DNS_QUERY_TREAT_AS_FQDN,NULL,&dnslist,NULL);
}

Roger

-------
To unsubscribe, change your address, or temporarily deactivate your subscription,
please go to http://v2.listbox.com/member/?listname=spf-devel@v2.listbox.com