no valid address (Windows 95)

Alexander Gottwald Alexander.Gottwald@informatik.tu-chemnitz.de
Wed Sep 26 14:10:00 GMT 2001


On Wed, 26 Sep 2001, Tim Koenig wrote:

> This might be a bug in Cygwin, since that framework is not present at all in the Win32-API (I doubt anything like that is present in Winsock 1, but Winsock 2 has a GET_INTERFACE_INFO call to WSAIoctl which returns an INTERFACE_INFO) and has to be emulated completely.

I debugged the code and it seems that the interpretation of the registry keys
is wrong. 

The key HKLM\Enum\Network\MSTCP\* describes on TCP/IP setting. This
is bound to several services (VREDIR,VSERVER) and to a network card (NIC).
The code in cygwin assumes that the binding to services via VREDIR
binds to the NIC too. From the logical point this seems not to be correct.
It is more logical that one TCP/IP setting is dircetly bound to the NIC.
I changed this in the ls_netdev code and win95c and win95a showed the correct
interfaces. I'm currently compiling a new version of cygwin to check that
the changes work. 

The patch compiles and works in a test program. The test in cygwin is
still to come, If someone can compile it faster, please feel free to test.

bye
    ago
-------------------------SNIP--------------------
--- cygwin-1.3.3-2/winsup/cygwin/net.cc	Wed Sep 12 07:31:56 2001
+++ cygwin-new/winsup/cygwin/net.cc	Wed Sep 26 21:12:47 2001
@@ -1905,7 +1905,7 @@
        ++i)
     {
       HKEY ifkey, subkey;
-      char driver[256], classname[256], bindname[256], netname[256];
+      char driver[256], classname[256], netname[256];
       char adapter[256], ip[256], np[256];
 
       if (res != ERROR_SUCCESS
@@ -1981,57 +1981,34 @@
 
       RegCloseKey (subkey);
 
-      if (RegOpenKeyEx (ifkey, "Bindings",
-			 0, KEY_READ, &subkey) != ERROR_SUCCESS)
-	{
-	  RegCloseKey (ifkey);
-	  --ifr;
-	  continue;
-	}
-
-      for (int j = 0;
-	   (res = RegEnumValue (subkey, j, bindname,
-				(size = sizeof bindname, &size),
-				0, NULL, NULL, NULL)) != ERROR_NO_MORE_ITEMS;
-	   ++j)
-	if (!strncasecmp (bindname, "VREDIR\\", 7))
-	  break;
+      strcpy (netname, "System\\CurrentControlSet\\Services\\Class\\Net\\");
+      strcat (netname, ifname);
 
+      if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, netname,
+                  0, KEY_READ, &subkey) != ERROR_SUCCESS)
+      {
+          RegCloseKey (ifkey);
+          --ifr;
+          continue;
+      }
+
+      if (RegQueryValueEx (subkey, "AdapterName", 0,
+                  NULL, (unsigned char *) adapter,
+                  (size = sizeof adapter, &size)) == ERROR_SUCCESS
+              && strcasematch (adapter, "MS$PPP"))
+      {
+          ++*ppp;
+          strcpy (ifr->ifr_name, "ppp");
+          strcat (ifr->ifr_name, ppp);
+      }
+      else
+      {
+          ++*eth;
+          strcpy (ifr->ifr_name, "eth");
+          strcat (ifr->ifr_name, eth);
+      }
+      
       RegCloseKey (subkey);
-
-      if (res == ERROR_SUCCESS)
-	{
-	  strcpy (netname, "System\\CurrentControlSet\\Services\\Class\\Net\\");
-	  strcat (netname, bindname + 7);
-
-	  if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, netname,
-			    0, KEY_READ, &subkey) != ERROR_SUCCESS)
-	    {
-	      RegCloseKey (ifkey);
-	      --ifr;
-	      continue;
-	    }
-
-	  if (RegQueryValueEx (subkey, "AdapterName", 0,
-			       NULL, (unsigned char *) adapter,
-			       (size = sizeof adapter, &size)) == ERROR_SUCCESS
-	      && strcasematch (adapter, "MS$PPP"))
-	    {
-	      ++*ppp;
-	      strcpy (ifr->ifr_name, "ppp");
-	      strcat (ifr->ifr_name, ppp);
-	    }
-	  else
-	    {
-	      ++*eth;
-	      strcpy (ifr->ifr_name, "eth");
-	      strcat (ifr->ifr_name, eth);
-	    }
-
-	  RegCloseKey (subkey);
-
-	}
-
       RegCloseKey (ifkey);
 
       ++cnt;
---------------------------SNIP----------------------
-- 
Alexander.Gottwald@s1999.tu-chemnitz.de
http://www.gotti.org
phone: +49 3725 3498080     mobile: +49 172 7854017



More information about the Cygwin-xfree mailing list