How get location of Hosts file?

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

Is there an API call I can use to get the location of the Hosts file
on any version of Windows?
 
Bill said:
Is there an API call I can use to get the location of the Hosts file
on any version of Windows?

Hi

I don't know about any API for this, but this is where you will find it for the
different OS versions:

Windows 9x\ME: %windir%\
Windows XP\2000/NT4: %windir%\SYSTEM32\DRIVERS\ETC\
 
Hi - The following is an extract from my standard posting about fixing the
qHosts worm which may be of use:

<extract>
Just to follow up on this - there may be multiple different HOSTS files on
your machine with the trojan's settings some of which cannot not be removed
by the Removal Tools, and you'll need to do a search to find and just delete
them all, or clean them per the manual directions at the Symantec site. A
very useful tool for this purpose is HostFileReader, available here courtesy
of Option^Explicit:
http://members.shaw.ca/techcd/VB_Projects/HostsFileReader.zip This will
locate all of the HOSTS files on your designated partition and allow you to
remove them individually. Recommended, especially for the qHosts worm
problem.
</extract>

That help?


--
Please respond in the same thread.
Regards, Jim Byrd, MS-MVP



In
 
Torgeir Bakken (MVP) said:
I don't know about any API for this, but this is where you will find it for the
different OS versions:

Windows 9x\ME: %windir%\
Windows XP\2000/NT4: %windir%\SYSTEM32\DRIVERS\ETC\

Found this after further research:

For Windows XP\2000/NT4, it is the value data in the registry value "DataBasePath"
found under the key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
that will determine the path to the hosts file.
 
Back
Top