Windows DNS hooks

淺唱寂寞╮ 提交于 2019-12-23 02:57:28

问题


How does Windows resolve DNS and how can I intercept the calls, in order to inject my own domains? I need this in an application, and running my own DNS server or modifying the hosts file is not a solution.


回答1:


I'm not sure what your purpose is, but there are several options. CodeProject includes something that might help you here. It seems to do what you need to do. Now, the other solution might involve abit of work of your own that might be inappropiate for the project. For one, you need to figure out if the following function is the one responsible for DNS lookups in the applications you want to modify. The next stage is basically implementing the CodeProject code yourself, set up a global hook using Microsoft Detours and in the returning trampoline insert your modifying code.

I'm still not quite sure why you need to do this though, if you would provide more detail on the end goal, you might get better answers.




回答2:


You may be looking for Hooking DNSQuery() function calls in dnsapi.lib/dnsap.dll



来源:https://stackoverflow.com/questions/1317067/windows-dns-hooks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!