From 9f6f4ddd073c601367af8daba50bdffd57b3bd19 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Fri, 27 Feb 1998 00:32:20 -0800
Subject: [PATCH] now works with windows NT

Rev: lib/modules/Protocols.pmod/DNS.pmod:1.11
---
 lib/modules/Protocols.pmod/DNS.pmod | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/lib/modules/Protocols.pmod/DNS.pmod b/lib/modules/Protocols.pmod/DNS.pmod
index 2766fe8b9e..334434a0dc 100644
--- a/lib/modules/Protocols.pmod/DNS.pmod
+++ b/lib/modules/Protocols.pmod/DNS.pmod
@@ -223,7 +223,16 @@ class client {
   static private string match_etc_hosts(string host)
   {
     if (!etc_hosts) {
-      string raw = Stdio.read_file("/etc/hosts");
+      string raw;
+#ifdef __NT__
+      raw = RegGetValue(HKEY_LOCAL_MACHINE,
+			"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
+			"DataBasePath");
+      raw+="\\hosts";
+#else
+      raw="/etc/hosts";
+#endif
+      raw = Stdio.read_file(raw);
 
       etc_hosts = ([ "localhost":"127.0.0.1" ]);
 
@@ -257,6 +266,17 @@ class client {
     if(!server)
     {
       string domain;
+#if __NT__
+      domain=RegGetValue(HKEY_LOCAL_MACHINE,
+			 "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
+			 "Domain");
+      nameservers = ({ RegGetValue(HKEY_LOCAL_MACHINE,
+				   "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
+				   "NameServer") });
+      domains=RegGetValue(HKEY_LOCAL_MACHINE,
+			  "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
+			  "SearchList") / " "- ({""});
+#else
       string resolv_conf = Stdio.read_file("/etc/resolv.conf");
 
       if (!resolv_conf) {
@@ -301,6 +321,7 @@ class client {
 	  break;
 	}
       }
+#endif
       if (!sizeof(nameservers)) {
 	nameservers = ({ "127.0.0.1" });
       }
-- 
GitLab