为什么nslookup.exe可以通过指定的DNS服务器解析,而dnsapi.dll中却没有对应的API? [英] Why nslookup.exe can resolved with a specified DNS server, but there isn't corresponding API in dnsapi.dll?
问题描述
nslookup.exe www.google.com 127.0.0.1
nslookup.exe www.google.com 127.0.0.1
这个命令可以用DNS server 127.0.0.1解析,75.0 KB nslookup.exe不可能实现全栈DNS协议解析器,所以肯定是使用了dnsapi.dll.
This command can resolve using DNS server 127.0.0.1, it's impossible to implement a full stack DNS protocol resolver in a 75.0 KB nslookup.exe, so it must have been using dnsapi.dll.
那么哪个dll导出C函数可以在dnsapi.dll中提供与指定DNS服务器类似的gethostbyname()?
So which dll export C function can provide similar gethostbyname() with a specified DNS server in dnsapi.dll?
推荐答案
您可以在 DNSQuery
函数中使用 pExtra
参数.
You can use the pExtra
parameter to the DNSQuery
function.
显然 MSDN 文档是不完整,因为它说这个参数必须为空.
Apparently the MSDN documentation is incomplete, since it says this parameter must be null.
参见 http://support.microsoft.com/kb/831226 的示例其用途.
See http://support.microsoft.com/kb/831226 for an example of its use.
这篇关于为什么nslookup.exe可以通过指定的DNS服务器解析,而dnsapi.dll中却没有对应的API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!