microsoft / microsoft/Windows-classic-samples
DnsQueryEx doesn't work when using external DNS server and interface index in the same time
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 5.7k
- Forks
- 3.3k
- PR merge metrics
- No merged PRs in 30d
Description
One of these two parameters must be 0, otherwise DnsQueryEx failed with 0x57 error code. I don't know if this is feature or bug ?
// Working example
DNS_QUERY_REQUEST.InterfaceIndex = 0;
DNS_QUERY_REQUEST.pDnsServerList = &dns;
// also work
DNS_QUERY_REQUEST.InterfaceIndex = 4;
DNS_QUERY_REQUEST.pDnsServerList = NULL;
// Failed
DNS_QUERY_REQUEST.InterfaceIndex = 4;
DNS_QUERY_REQUEST.pDnsServerList = &dns;
I'm using Windows 10 21H2, Visual Studio 2019
I see a similar issue here but still no solution: https://docs.microsoft.com/en-us/answers/questions/820961/dnsqueryex-with-custom-interfaceindex-is-not-worki.html
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the three DNS_QUERY_REQUEST configurations shown in the issue with DnsQueryEx on the stated Windows environment. Determine whether combining InterfaceIndex and pDnsServerList is supported and document the expected behavior or a confirmed cause for the 0x57 failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- networking, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100