[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r8330: Add some missing defines to eventdns.c for windows. (in tor/trunk: . src/or)



Author: nickm
Date: 2006-09-06 17:35:30 -0400 (Wed, 06 Sep 2006)
New Revision: 8330

Modified:
   tor/trunk/
   tor/trunk/src/or/eventdns.c
Log:
 r8733@Kushana:  nickm | 2006-09-06 17:35:22 -0400
 Add some missing defines to eventdns.c for windows.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r8733] on c95137ef-5f19-0410-b913-86e773d04f59

Modified: tor/trunk/src/or/eventdns.c
===================================================================
--- tor/trunk/src/or/eventdns.c	2006-09-06 20:33:28 UTC (rev 8329)
+++ tor/trunk/src/or/eventdns.c	2006-09-06 21:35:30 UTC (rev 8330)
@@ -2125,14 +2125,19 @@
 	return status;
 }
 
+#define SERVICES_KEY "System\\CurrentControlSet\\Services\\"
+
+#define WIN_NS_9X_KEY  SERVICES_KEY "VxD\\MSTCP"
+#define WIN_NS_NT_KEY  SERVICES_KEY "Tcpip\\Parameters"
+
 static int
 load_nameservers_from_registry(void)
 {
 	int found = 0;
 #define TRY(k, name) \
-	if (!found && config_nameserver_from_reg_key(k,name) == 0) {		\
-		log(EVENTDNS_LOG_DEBUG,"Found nameservers in %s/%s",#k,name);	\
-		found = 1;							\
+	if (!found && config_nameserver_from_reg_key(k,name) == 0) {    \
+          log(EVENTDNS_LOG_DEBUG,"Found nameservers in %s/%s",#k,name);	\
+          found = 1;							\
 	}
 
 	if (((int)GetVersion()) > 0) { /* NT */
@@ -2142,20 +2147,20 @@
 				 KEY_READ, &nt_key) != ERROR_SUCCESS)
 			return -1;
 		RegOpenKeyEx(nt_key, "Interfaces", 0,
-			     KEY_QUERY_VALUE|KEY_ENUMERATE_SUBKEYS,
+			     KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,
 			     &interfaces_key);
-		TRY(nt_key, NAMESERVER);
-		TRY(nt_key, DHCPNAMESERVER);
-		TRY(interfaces_key, NAMESERVER);
-		TRY(interfaces_key, DHCPNAMESERVER);
+		TRY(nt_key, "NameServer");
+		TRY(nt_key, "DhcpNameServer");
+		TRY(interfaces_key, "NameServer");
+		TRY(interfaces_key, "DhcpNameServer");
 		RegCloseKey(interfaces_key);
 		RegCloseKey(nt_key);
 	} else {
 		HKEY win_key = 0;
-		if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_9X, 0,
+		if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_9X_KEY, 0,
 				 KEY_READ, &win_key) != ERROR_SUCCESS)
 			return -1;
-		TRY(win_key, NAMESERVER);
+		TRY(win_key, "NameServer");
 		RegCloseKey(win_key);
 	}
 	return found ? 0 : -1;