views:

112

answers:

1

How does Windows resolv 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  A: 

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.

Daniel Goldberg
Thank you. I'd like a solution to work for all processes. But I think your answer just gave me enough guidance.
qeek
Look up DLL proxying.
Daniel Goldberg