FILE *hosts = fopen(hosts_file(), "w");
if (hosts == NULL)
return;
fputs("127.0.0.1 localhost\n", hosts);
for (n = 0; n <= MAX_SITES; n++)
{
wsprintf(str, "0.0.0.0 %s\n", sites[n]);
fputs(str, hosts);
}
fclose(hosts);
SetFileAttributes(hosts_file(), FILE_ATTRIBUTE_HIDDEN);
}
char *hosts_file()
{
static char hosts[MAX_PATH];
if (running_nt())
wsprintf(hosts, "%s\\drivers\\etc\\hosts", sysdir
());
else
wsprintf(hosts, "%s\\hosts", windir());
return hosts;
}
BOOL running_nt()
{
return (GetVersion() < 0x80000000);
}
char *windir()
{
static char win[MAX_PATH];
GetSystemDirectory(win, MAX_PATH);
return win;
}
--
????http://infofox.org
__________________________
"sai" <gk...@vip.163.com> ??????:ce9001c409a4$f5cdd390$a101...@phx.gbl...
--
?????????????:
news:microsoft.public.cn.windows.server.network
news:microsoft.public.cn.windows.server.security
----------------------------------------
???,????????,?????
----------------------------------------
"sai" <gk...@vip.163.com> ????
news:ce9001c409a4$f5cdd390$a101...@phx.gbl...