0

I am writing a Windows Kernel Driver, in which I need to resolve IP addresses into corresponding hostnames. There is very little documentation available for this on Microsoft pages:

Resolving Host Names and IP Addresses

How can this be done? What lookup order does Windows follow when we resolve hostnames from the kernel?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Ramchandra
  • 1
  • 1
  • 1
  • WskGetNameInfo is the function you want. It is an interface that can obtain the hostname by IP address. The link you posted already has the answer. Perhaps you have not asked exactly what you do not understand. – reinhard v.z. Dec 03 '18 at 12:23
  • I want to know if the lookup from kernel first checks the hosts file for the given IP. This is because I do not want the kernel to make lookup request on the DNS. – Ramchandra Dec 06 '18 at 06:04
  • Is the WskGetNameInfo call in kernel sufficient to get the result or do I have to setup WskProviderNPI before making the kernel call? – Ramchandra Dec 06 '18 at 06:06

1 Answers1

1

https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/content/wsk/nc-wsk-pfn_wsk_get_name_info

The WskGetNameInfo function provides protocol-independent translation from a transport address to a host name.

According to the WDK document, it is said to provide protocol independent translation. So WskGetNameInfo seems to be providing you the way you want. I have not checked this part myself, but you can check it out with a simple test if you want. Check with a tool like Wireshark to see if DNS queries are occurring.

I do not think WskGetNameInfo will ever perform DNS queries. If so, it would be garbage.

reinhard v.z.
  • 326
  • 1
  • 5