question

GaryKopet-4934 avatar image
0 Votes"
GaryKopet-4934 asked GaryKopet-4934 commented

API access to DNS over HTTPS settings

Hi,

I have dev build 21337and sdk version 20313, and I'm experimenting with DNS over HTTPS. It's working great.

I'm just wondering if there are calls somewhere in the Windows API that allow me to see the user's settings in this regard: whether DoH Is enabled and what the DoH server is for a given adapter.

Thanks,
Gary Kopet

windows-10-networkwindows-api-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

StriveSun-MSFT avatar image
1 Vote"
StriveSun-MSFT answered StriveSun-MSFT edited

Hello, @GaryKopet-4934

Please check the winapi below:

  • DnsQueryConfig: The DnsQueryConfig function enables application programmers to query for the configuration of the local computer or a specific adapter.

  • HttpQueryServiceConfiguration : The HttpQueryServiceConfiguration function retrieves one or more HTTP Server API configuration records.



Thank you!

If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

GaryKopet-4934 avatar image
0 Votes"
GaryKopet-4934 answered GaryKopet-4934 commented

Hi,

Thanks for the quick response. I'm playing with the APIs you listed, but I can't figure out how to get the information I'm after.

I can see it using "ipconfig /all". I'm after the dns config for the nic that shows DoH is enabled: "DoH: https://dns.google/dns-query". Can you tell me how I can get that via an API?

80248-screenshot-2021-03-22-094256.png



· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Because of the machine, I can't reproduce the content of your screenshot. I will ask related engineer and update here at any time. Please wait patiently.

0 Votes 0 ·

Hi,

By comparing the netopapi.h in the new sdk with the released one, I was able to identify GetInterfaceDnsSettings() as a way to get the information I need.

There is a new version of the DNS_INTERFACE_SETTINGS structure, DNS_INTERFACE_SETTINGS3. The DoH settings are in the ServerProperties.

 typedef struct _DNS_INTERFACE_SETTINGS3
 {
     ULONG Version;
     ULONG64 Flags;
     PWSTR Domain;
     PWSTR NameServer;
     PWSTR SearchList;
     ULONG RegistrationEnabled;
     ULONG RegisterAdapterName;
     ULONG EnableLLMNR;
     ULONG QueryAdapterName;
     PWSTR ProfileNameServer;
     ULONG DisableUnconstrainedQueries;
     PWSTR SupplementalSearchList;
     ULONG cServerProperties;
     DNS_SERVER_PROPERTY *ServerProperties;
     ULONG cProfileServerProperties;
     DNS_SERVER_PROPERTY *ProfileServerProperties;
 } DNS_INTERFACE_SETTINGS3;
1 Vote 1 ·