Re: PATCH: win32 hosts file location

From: Robert Collins <robert.collins@dont-contact.us>
Date: 18 Aug 2001 20:50:17 +1000

On 18 Aug 2001 11:40:27 +0200, Henrik Nordstrom wrote:
> Guido Serassio wrote:.
>
> > 1) Read from the registry value
> > HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath the
> > Hosts file location (but this step can be safely skipped, because i never
> > seen this value changed from %SystemRoot%\System32\drivers\etc).
> > 2) Resolve %SistemRoot%
> > 3) Read Hosts file.
> >
> > Another thing: using static paths, on dual boot systems can happen everything.
>
> Nobody is talking about "static" paths.
>
> I did not know about '1'. This makes things a little different.
>
> What about this: For win32, substitute /etc/ by the system networking database
> path before opening the file. I.e. something like the attached diff + what is
> missing (see the diff).

Hmm, thats an approach, but I though you wished to avoid runtime magic?

We need to be able to replace environment variables in the path to do it
generically.

Your suggestion of multiple paths and find the first one solves the
which-platform question - if we can add environment variables into the
paths. At which point the function becomes

currentpath=Config.etcHostsPath;
while (fp ==NULL && currentpath) {
  char *path = substenvvariables(currentpath->data);
  fp = fopen(path, "r");
  safe_free (path);
  currentpath=currentpath->next;
}

Rob
Received on Sat Aug 18 2001 - 04:50:18 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:12 MST