Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7621221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:08:35+00:00 2026-05-31T04:08:35+00:00

DnsQuery doesn’t have a parameter to specify the server one wants to query. On

  • 0

DnsQuery doesn’t have a parameter to specify the server one wants to query. On the other hand, I’ve seen this sample, which seems to have passed an IP in the parameter marked as “reserved and must be 0” in the MSDN documentation.

Is there some way to query a specific server (as nslookup does?) Or am I going to have to write my own DNS client (or find a library of course)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:08:37+00:00Added an answer on May 31, 2026 at 4:08 am

    The 4th argument of DnsQuery PVOID pExtra accepts a PIP4_ARRAY containing the specific DNS servers to be queried. This is combined with the 3rd argument DWORD Options of DNS_QUERY_BYPASS_CACHE , in order to bypass the resolver cache.

    This has worked since Windows 2000, and in Windows XP DnsQuery calls the function
    called privateNarrowToWideQuery (in dnsapi.dll) and takes the pExtra argument is as the PIP4_ARRAY.

    The MSDN is inaccurate in this regard , resulting in this being an undocumented feature.
    In older versions of the DnsQuery API Call pExtra used to be called aipServers.

    Regarding the DNS of IPV6 AAAA records, you can try the function with the second argument
    WORD wType as DNS_TYPE_AAAA and the fifth argument PDNS_RECORD *ppQueryResultsSet as a pointer to DNS_AAAA_DATA. Though this still forces you to pass in IPV4 IP address array and not IPV6.

    Regarding Windows Version support for the IPV6 queries see the following references

    • Domain Name Service (DNS)
    • Domain Name System Client Behavior in Windows Vista
    • Changes to IPv6 in Windows Vista and Windows Server 2008

    In future Windows versions, I believe the correct way to do this for IPV6 will be using
    DnsQueryEx , with its first argument of PDNS_QUERY_REQUEST pQueryRequest which contains
    a member PDNS_ADDR_ARRAY pDnsServerList;, which contains member WORD Family; which specifies which type of IP address the DNS server is.

    Whether DnsQuery already supports a pointer to PDNS_ADDR_ARRAY as an argument to PVOID pExtra or will be modified in future Windows Versions to do so, I am not sure, but you are welcome to try and see.

    See How to use the DnsQuery function to resolve host names and host addresses with Visual C++ .NET for sample code, as you have already discovered.

    Also see the following similar SO Question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have trouble with [DnsQuery]( http://msdn.microsoft.com/en-us/library/ms682016(VS.85).aspx) API, the *ppQueryResultsSet parameter troubles me. Can anyone
I have a small script that checks a large list of domains for their
I'm trying to get an MX record from an DNS server in C. My
We have some devices (Like IP cameras) on network. I am writing APIs in
This is my first time using C#, so I'm very much out of my
I built a test Active Directory server in Window 2008 and I also run
According to http://msdn.microsoft.com/en-us/library/aa916070.aspx (DnsQuery_W), DNS query libraries are available on Windows Mobile / CE
i have been trying to write some programs on java sockets and i got
PHP's gethostbyname() function doesn't seem to be configurable as far as timeouts are concerned.
I have a high-resolution image that I want to use as a tiled map

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.