When I using this code
reference here: http://support.microsoft.com/kb/831226
I can complier success, but when i use it doing some dns query, the return address is weird, for example: 176.20.31.0 (this shouldn’t be a valid address)
Here is my output:
C:\dnsq\Debug>dnsq.exe -n tw.media.blizzard.com -t A -s 8.8.8.8
The IP address of the host tw.media.blizzard.com is 176.20.31.0
But actually the tw.media.blizzard.com should be: (I query it by nslookup)
# nslookup tw.media.blizzard.com 8.8.8.8
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
tw.media.blizzard.com canonical name = tw.media.blizzard.com.edgesuite.net.
tw.media.blizzard.com.edgesuite.net canonical name = a1479.g.akamai.net.
Name: a1479.g.akamai.net
Address: 23.14.93.167
Name: a1479.g.akamai.net
Address: 23.14.93.157
My question is why dnsquery doesn’t work on some FQDN?
Any suggestion would be appreciated 🙂
I found the problem.
For those FQDN which leading to invlid address, the common thing are all of their DNS record type are “DNS_TYPE_CNAME”, not DNS_TYPE_A.
So we need to parse the whole PDNS_RECORD to get DNS_TYPE_A information.
I’ll post my change here:
Original code from MS:
My change here: