* dcrt0.cc: Add LoadDLLFunc statement for RegEnumValueA().
* net.cc: Change comments related to get_ifconf. (get_2k_ifconf): Eliminate `type' variable. Eliminate `sa' parameter. (get_nt_ifconf): Ditto. (get_9x_ifconf): Ditto. Rewritten. (get_ifconf): Chage calls to OS specific functions.
This commit is contained in:
parent
17e8632267
commit
52b5a97156
|
@ -1,3 +1,12 @@
|
||||||
|
Mon Oct 2 22:15:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* dcrt0.cc: Add LoadDLLFunc statement for RegEnumValueA().
|
||||||
|
* net.cc: Change comments related to get_ifconf.
|
||||||
|
(get_2k_ifconf): Eliminate `type' variable. Eliminate `sa' parameter.
|
||||||
|
(get_nt_ifconf): Ditto.
|
||||||
|
(get_9x_ifconf): Ditto. Rewritten.
|
||||||
|
(get_ifconf): Chage calls to OS specific functions.
|
||||||
|
|
||||||
Mon Oct 2 15:15:01 2000 Christopher Faylor <cgf@cygnus.com>
|
Mon Oct 2 15:15:01 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* signal.cc (sigaction): Allow new action == oldaction.
|
* signal.cc (sigaction): Allow new action == oldaction.
|
||||||
|
|
|
@ -1263,6 +1263,7 @@ LoadDLLfunc (RegDeleteKeyA, 8, advapi32)
|
||||||
LoadDLLfunc (RegDeleteValueA, 8, advapi32)
|
LoadDLLfunc (RegDeleteValueA, 8, advapi32)
|
||||||
LoadDLLfunc (RegLoadKeyA, 12, advapi32)
|
LoadDLLfunc (RegLoadKeyA, 12, advapi32)
|
||||||
LoadDLLfunc (RegEnumKeyExA, 32, advapi32)
|
LoadDLLfunc (RegEnumKeyExA, 32, advapi32)
|
||||||
|
LoadDLLfunc (RegEnumValueA, 32, advapi32)
|
||||||
LoadDLLfunc (RegOpenKeyExA, 20, advapi32)
|
LoadDLLfunc (RegOpenKeyExA, 20, advapi32)
|
||||||
LoadDLLfunc (RegQueryValueExA, 24, advapi32)
|
LoadDLLfunc (RegQueryValueExA, 24, advapi32)
|
||||||
LoadDLLfunc (RegSetValueExA, 24, advapi32)
|
LoadDLLfunc (RegSetValueExA, 24, advapi32)
|
||||||
|
|
|
@ -1017,35 +1017,16 @@ getdomainname (char *domain, int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cygwin internal */
|
/* Cygwin internal */
|
||||||
/* Fill out an ifconf struct.
|
/* Fill out an ifconf struct. */
|
||||||
*
|
|
||||||
* Windows 2000:
|
/*
|
||||||
|
* IFCONF Windows 2000:
|
||||||
* Look at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\
|
* Look at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\
|
||||||
Parameters\Interfaces
|
Parameters\Interfaces
|
||||||
* Each subkey is an interface.
|
* Each subkey is an interface.
|
||||||
*
|
|
||||||
* Windows NT:
|
|
||||||
* Look at the Bind value in
|
|
||||||
* HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Linkage\
|
|
||||||
* This is a REG_MULTI_SZ with strings of the form:
|
|
||||||
* \Device\<Netcard>, where netcard is the name of the net device.
|
|
||||||
* Then look under:
|
|
||||||
* HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<NetCard>\
|
|
||||||
* Parameters\Tcpip
|
|
||||||
* at the IPAddress, Subnetmask and DefaultGateway values for the
|
|
||||||
* required values.
|
|
||||||
*
|
|
||||||
* Windows 9x:
|
|
||||||
* We originally just did a gethostbyname, assuming that it's pretty
|
|
||||||
* unlikely Win9x will ever have more than one netcard. When this
|
|
||||||
* succeeded, we got the interface plus a loopback.
|
|
||||||
* Currently, we read all
|
|
||||||
* "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Class\NetTrans\*"
|
|
||||||
* entries from the Registry and use all entries that have legal
|
|
||||||
* "IPAddress" and "IPMask" values.
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
get_2k_ifconf (struct ifconf *ifc, struct sockaddr_in *sa, int what)
|
get_2k_ifconf (struct ifconf *ifc, int what)
|
||||||
{
|
{
|
||||||
HKEY key;
|
HKEY key;
|
||||||
int cnt = 1;
|
int cnt = 1;
|
||||||
|
@ -1064,8 +1045,9 @@ get_2k_ifconf (struct ifconf *ifc, struct sockaddr_in *sa, int what)
|
||||||
{
|
{
|
||||||
HKEY ikey;
|
HKEY ikey;
|
||||||
unsigned long lip, lnp;
|
unsigned long lip, lnp;
|
||||||
|
struct sockaddr_in *sa = NULL;
|
||||||
char name[256];
|
char name[256];
|
||||||
DWORD type, size;
|
DWORD size;
|
||||||
char eth[2] = "/", ppp[2] = "/";
|
char eth[2] = "/", ppp[2] = "/";
|
||||||
|
|
||||||
for (int idx = 0;
|
for (int idx = 0;
|
||||||
|
@ -1079,7 +1061,7 @@ get_2k_ifconf (struct ifconf *ifc, struct sockaddr_in *sa, int what)
|
||||||
/* If the "NTEContextList" value not exists, the subkey
|
/* If the "NTEContextList" value not exists, the subkey
|
||||||
is irrelevant. */
|
is irrelevant. */
|
||||||
if (RegQueryValueEx (ikey, "NTEContextList",
|
if (RegQueryValueEx (ikey, "NTEContextList",
|
||||||
NULL, &type, NULL, &size) != ERROR_SUCCESS)
|
NULL, NULL, NULL, &size) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
RegCloseKey (ikey);
|
RegCloseKey (ikey);
|
||||||
continue;
|
continue;
|
||||||
|
@ -1097,17 +1079,17 @@ get_2k_ifconf (struct ifconf *ifc, struct sockaddr_in *sa, int what)
|
||||||
char dhcpaddress[256], dhcpnetmask[256];
|
char dhcpaddress[256], dhcpnetmask[256];
|
||||||
|
|
||||||
if (RegQueryValueEx (ikey, "IPAddress",
|
if (RegQueryValueEx (ikey, "IPAddress",
|
||||||
NULL, &type,
|
NULL, NULL,
|
||||||
(unsigned char *) ipaddress,
|
(unsigned char *) ipaddress,
|
||||||
(size = 256, &size)) == ERROR_SUCCESS
|
(size = 256, &size)) == ERROR_SUCCESS
|
||||||
&& RegQueryValueEx (ikey, "SubnetMask",
|
&& RegQueryValueEx (ikey, "SubnetMask",
|
||||||
NULL, &type,
|
NULL, NULL,
|
||||||
(unsigned char *) netmask,
|
(unsigned char *) netmask,
|
||||||
(size = 256, &size)) == ERROR_SUCCESS)
|
(size = 256, &size)) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
/* ppp interfaces don't have the "AddressType" value. */
|
/* ppp interfaces don't have the "AddressType" value. */
|
||||||
if (RegQueryValueEx (ikey, "AddressType",
|
if (RegQueryValueEx (ikey, "AddressType",
|
||||||
NULL, &type, NULL, &size) == ERROR_SUCCESS)
|
NULL, NULL, NULL, &size) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
++*eth;
|
++*eth;
|
||||||
strcpy (ifr->ifr_name, "eth");
|
strcpy (ifr->ifr_name, "eth");
|
||||||
|
@ -1123,12 +1105,12 @@ get_2k_ifconf (struct ifconf *ifc, struct sockaddr_in *sa, int what)
|
||||||
memset (&ifr->ifr_addr, '\0', sizeof ifr->ifr_addr);
|
memset (&ifr->ifr_addr, '\0', sizeof ifr->ifr_addr);
|
||||||
if (cygwin_inet_addr (ipaddress) == 0L
|
if (cygwin_inet_addr (ipaddress) == 0L
|
||||||
&& RegQueryValueEx (ikey, "DhcpIPAddress",
|
&& RegQueryValueEx (ikey, "DhcpIPAddress",
|
||||||
NULL, &type,
|
NULL, NULL,
|
||||||
(unsigned char *) dhcpaddress,
|
(unsigned char *) dhcpaddress,
|
||||||
(size = 256, &size))
|
(size = 256, &size))
|
||||||
== ERROR_SUCCESS
|
== ERROR_SUCCESS
|
||||||
&& RegQueryValueEx (ikey, "DhcpSubnetMask",
|
&& RegQueryValueEx (ikey, "DhcpSubnetMask",
|
||||||
NULL, &type,
|
NULL, NULL,
|
||||||
(unsigned char *) dhcpnetmask,
|
(unsigned char *) dhcpnetmask,
|
||||||
(size = 256, &size))
|
(size = 256, &size))
|
||||||
== ERROR_SUCCESS)
|
== ERROR_SUCCESS)
|
||||||
|
@ -1189,12 +1171,25 @@ get_2k_ifconf (struct ifconf *ifc, struct sockaddr_in *sa, int what)
|
||||||
ifc->ifc_len = cnt * sizeof (struct ifreq);
|
ifc->ifc_len = cnt * sizeof (struct ifreq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IFCONF Windows NT:
|
||||||
|
* Look at the Bind value in
|
||||||
|
* HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Linkage\
|
||||||
|
* This is a REG_MULTI_SZ with strings of the form:
|
||||||
|
* \Device\<Netcard>, where netcard is the name of the net device.
|
||||||
|
* Then look under:
|
||||||
|
* HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<NetCard>\
|
||||||
|
* Parameters\Tcpip
|
||||||
|
* at the IPAddress, Subnetmask and DefaultGateway values for the
|
||||||
|
* required values.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
get_nt_ifconf (struct ifconf *ifc, struct sockaddr_in *sa, int what)
|
get_nt_ifconf (struct ifconf *ifc, int what)
|
||||||
{
|
{
|
||||||
HKEY key;
|
HKEY key;
|
||||||
unsigned long lip, lnp;
|
unsigned long lip, lnp;
|
||||||
DWORD type, size;
|
struct sockaddr_in *sa = NULL;
|
||||||
|
DWORD size;
|
||||||
int cnt = 1;
|
int cnt = 1;
|
||||||
char *binding = (char *) 0;
|
char *binding = (char *) 0;
|
||||||
|
|
||||||
|
@ -1210,12 +1205,12 @@ get_nt_ifconf (struct ifconf *ifc, struct sockaddr_in *sa, int what)
|
||||||
0, KEY_READ, &key) == ERROR_SUCCESS)
|
0, KEY_READ, &key) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
if (RegQueryValueEx (key, "Bind",
|
if (RegQueryValueEx (key, "Bind",
|
||||||
NULL, &type,
|
NULL, NULL,
|
||||||
NULL, &size) == ERROR_SUCCESS)
|
NULL, &size) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
binding = (char *) alloca (size);
|
binding = (char *) alloca (size);
|
||||||
if (RegQueryValueEx (key, "Bind",
|
if (RegQueryValueEx (key, "Bind",
|
||||||
NULL, &type,
|
NULL, NULL,
|
||||||
(unsigned char *) binding,
|
(unsigned char *) binding,
|
||||||
&size) != ERROR_SUCCESS)
|
&size) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -1242,11 +1237,11 @@ get_nt_ifconf (struct ifconf *ifc, struct sockaddr_in *sa, int what)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (RegQueryValueEx (key, "IPAddress",
|
if (RegQueryValueEx (key, "IPAddress",
|
||||||
NULL, &type,
|
NULL, NULL,
|
||||||
(unsigned char *) ipaddress,
|
(unsigned char *) ipaddress,
|
||||||
(size = 256, &size)) == ERROR_SUCCESS
|
(size = 256, &size)) == ERROR_SUCCESS
|
||||||
&& RegQueryValueEx (key, "SubnetMask",
|
&& RegQueryValueEx (key, "SubnetMask",
|
||||||
NULL, &type,
|
NULL, NULL,
|
||||||
(unsigned char *) netmask,
|
(unsigned char *) netmask,
|
||||||
(size = 256, &size)) == ERROR_SUCCESS)
|
(size = 256, &size)) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -1276,12 +1271,12 @@ get_nt_ifconf (struct ifconf *ifc, struct sockaddr_in *sa, int what)
|
||||||
memset (&ifr->ifr_addr, '\0', sizeof ifr->ifr_addr);
|
memset (&ifr->ifr_addr, '\0', sizeof ifr->ifr_addr);
|
||||||
if (cygwin_inet_addr (ip) == 0L
|
if (cygwin_inet_addr (ip) == 0L
|
||||||
&& RegQueryValueEx (key, "DhcpIPAddress",
|
&& RegQueryValueEx (key, "DhcpIPAddress",
|
||||||
NULL, &type,
|
NULL, NULL,
|
||||||
(unsigned char *) dhcpaddress,
|
(unsigned char *) dhcpaddress,
|
||||||
(size = 256, &size))
|
(size = 256, &size))
|
||||||
== ERROR_SUCCESS
|
== ERROR_SUCCESS
|
||||||
&& RegQueryValueEx (key, "DhcpSubnetMask",
|
&& RegQueryValueEx (key, "DhcpSubnetMask",
|
||||||
NULL, &type,
|
NULL, NULL,
|
||||||
(unsigned char *) dhcpnetmask,
|
(unsigned char *) dhcpnetmask,
|
||||||
(size = 256, &size))
|
(size = 256, &size))
|
||||||
== ERROR_SUCCESS)
|
== ERROR_SUCCESS)
|
||||||
|
@ -1340,82 +1335,176 @@ get_nt_ifconf (struct ifconf *ifc, struct sockaddr_in *sa, int what)
|
||||||
ifc->ifc_len = cnt * sizeof (struct ifreq);
|
ifc->ifc_len = cnt * sizeof (struct ifreq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IFCONF Windows 9x:
|
||||||
|
* HKLM/Enum/Network/MSTCP/"*"
|
||||||
|
* -> Value "Driver" enthält Subkey relativ zu
|
||||||
|
* HKLM/System/CurrentControlSet/Class/
|
||||||
|
* -> In Subkey "Bindings" die Values aufzählen
|
||||||
|
* -> Enthält Subkeys der Form "VREDIR\*"
|
||||||
|
* Das * ist ein Subkey relativ zu
|
||||||
|
* HKLM/System/CurrentControlSet/Class/Net/
|
||||||
|
* HKLM/System/CurrentControlSet/Class/"Driver"
|
||||||
|
* -> Value "IPAddress"
|
||||||
|
* -> Value "IPMask"
|
||||||
|
* HKLM/System/CurrentControlSet/Class/Net/"*"(aus "VREDIR\*")
|
||||||
|
* -> Wenn Value "AdapterName" == "MS$PPP" -> ppp interface
|
||||||
|
* -> Value "DriverDesc" enthält den Namen
|
||||||
|
*
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
get_9x_ifconf (struct ifconf *ifc, struct sockaddr_in *sa, int what)
|
get_9x_ifconf (struct ifconf *ifc, int what)
|
||||||
{
|
{
|
||||||
HKEY key, subkey;
|
HKEY key;
|
||||||
unsigned long lip, lnp;
|
unsigned long lip, lnp;
|
||||||
|
struct sockaddr_in *sa = NULL;
|
||||||
FILETIME update;
|
FILETIME update;
|
||||||
LONG res;
|
LONG res;
|
||||||
DWORD type, size;
|
DWORD size;
|
||||||
char ifname[256], ip[256], np[256];
|
|
||||||
int cnt = 1;
|
int cnt = 1;
|
||||||
|
char ifname[256];
|
||||||
char eth[2];
|
char eth[2] = "/";
|
||||||
eth[0] = '/';
|
char ppp[2] = "/";
|
||||||
eth[1] = '\0';
|
|
||||||
|
|
||||||
/* Union maps buffer to correct struct */
|
/* Union maps buffer to correct struct */
|
||||||
struct ifreq *ifr = ifc->ifc_req;
|
struct ifreq *ifr = ifc->ifc_req;
|
||||||
|
|
||||||
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE,
|
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "Enum\\Network\\MSTCP",
|
||||||
"SYSTEM\\"
|
0, KEY_READ, &key) != ERROR_SUCCESS)
|
||||||
"CurrentControlSet\\"
|
|
||||||
"Services\\"
|
|
||||||
"Class\\"
|
|
||||||
"NetTrans",
|
|
||||||
0, KEY_READ, &key) == ERROR_SUCCESS)
|
|
||||||
{
|
{
|
||||||
for (int i = 0;
|
/* Set the correct length */
|
||||||
(res = RegEnumKeyEx (key, i, ifname,
|
ifc->ifc_len = cnt * sizeof (struct ifreq);
|
||||||
(size = sizeof ifname, &size),
|
return;
|
||||||
0, 0, 0, &update)) != ERROR_NO_MORE_ITEMS;
|
}
|
||||||
++i)
|
|
||||||
|
for (int i = 0;
|
||||||
|
(res = RegEnumKeyEx (key, i, ifname,
|
||||||
|
(size = sizeof ifname, &size),
|
||||||
|
0, 0, 0, &update)) != ERROR_NO_MORE_ITEMS;
|
||||||
|
++i)
|
||||||
|
{
|
||||||
|
HKEY ifkey, subkey;
|
||||||
|
char driver[256], classname[256], bindname[256], netname[256];
|
||||||
|
char adapter[256], ip[256], np[256];
|
||||||
|
|
||||||
|
if (res != ERROR_SUCCESS
|
||||||
|
|| RegOpenKeyEx (key, ifname, 0,
|
||||||
|
KEY_READ, &ifkey) != ERROR_SUCCESS)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (RegQueryValueEx (ifkey, "Driver", 0,
|
||||||
|
NULL, (unsigned char *) driver,
|
||||||
|
(size = sizeof driver, &size)) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
if (res != ERROR_SUCCESS
|
RegCloseKey (ifkey);
|
||||||
|| RegOpenKeyEx (key, ifname, 0,
|
continue;
|
||||||
KEY_READ, &subkey) != ERROR_SUCCESS)
|
}
|
||||||
continue;
|
|
||||||
if (RegQueryValueEx (subkey, "IPAddress", 0,
|
strcpy (classname, "System\\CurrentControlSet\\Services\\Class\\");
|
||||||
&type, (unsigned char *) ip,
|
strcat (classname, driver);
|
||||||
(size = sizeof ip, &size)) == ERROR_SUCCESS
|
if ((res = RegOpenKeyEx (HKEY_LOCAL_MACHINE, classname,
|
||||||
|| RegQueryValueEx (subkey, "IPMask", 0,
|
0, KEY_READ, &subkey)) != ERROR_SUCCESS)
|
||||||
&type, (unsigned char *) np,
|
{
|
||||||
(size = sizeof np, &size)) == ERROR_SUCCESS)
|
RegCloseKey (ifkey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RegQueryValueEx (subkey, "IPAddress", 0,
|
||||||
|
NULL, (unsigned char *) ip,
|
||||||
|
(size = sizeof ip, &size)) == ERROR_SUCCESS
|
||||||
|
&& RegQueryValueEx (subkey, "IPMask", 0,
|
||||||
|
NULL, (unsigned char *) np,
|
||||||
|
(size = sizeof np, &size)) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
if ((caddr_t)++ifr > ifc->ifc_buf
|
||||||
|
+ ifc->ifc_len
|
||||||
|
- sizeof(struct ifreq))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
switch (what)
|
||||||
|
{
|
||||||
|
case SIOCGIFCONF:
|
||||||
|
case SIOCGIFADDR:
|
||||||
|
sa = (struct sockaddr_in *) &ifr->ifr_addr;
|
||||||
|
sa->sin_addr.s_addr = cygwin_inet_addr (ip);
|
||||||
|
break;
|
||||||
|
case SIOCGIFBRDADDR:
|
||||||
|
lip = cygwin_inet_addr (ip);
|
||||||
|
lnp = cygwin_inet_addr (np);
|
||||||
|
sa = (struct sockaddr_in *) &ifr->ifr_broadaddr;
|
||||||
|
sa->sin_addr.s_addr = lip & lnp | ~lnp;
|
||||||
|
break;
|
||||||
|
case SIOCGIFNETMASK:
|
||||||
|
sa = (struct sockaddr_in *) &ifr->ifr_netmask;
|
||||||
|
sa->sin_addr.s_addr = cygwin_inet_addr (np);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sa->sin_family = AF_INET;
|
||||||
|
sa->sin_port = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
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
|
||||||
|
&& !strcasecmp (adapter, "MS$PPP"))
|
||||||
|
{
|
||||||
|
++*ppp;
|
||||||
|
strcpy (ifr->ifr_name, "ppp");
|
||||||
|
strcat (ifr->ifr_name, ppp);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if ((caddr_t)++ifr > ifc->ifc_buf
|
|
||||||
+ ifc->ifc_len
|
|
||||||
- sizeof(struct ifreq))
|
|
||||||
break;
|
|
||||||
++*eth;
|
++*eth;
|
||||||
strcpy (ifr->ifr_name, "eth");
|
strcpy (ifr->ifr_name, "eth");
|
||||||
strcat (ifr->ifr_name, eth);
|
strcat (ifr->ifr_name, eth);
|
||||||
switch (what)
|
|
||||||
{
|
|
||||||
case SIOCGIFCONF:
|
|
||||||
case SIOCGIFADDR:
|
|
||||||
sa = (struct sockaddr_in *) &ifr->ifr_addr;
|
|
||||||
sa->sin_addr.s_addr = cygwin_inet_addr (ip);
|
|
||||||
break;
|
|
||||||
case SIOCGIFBRDADDR:
|
|
||||||
lip = cygwin_inet_addr (ip);
|
|
||||||
lnp = cygwin_inet_addr (np);
|
|
||||||
sa = (struct sockaddr_in *) &ifr->ifr_broadaddr;
|
|
||||||
sa->sin_addr.s_addr = lip & lnp | ~lnp;
|
|
||||||
break;
|
|
||||||
case SIOCGIFNETMASK:
|
|
||||||
sa = (struct sockaddr_in *) &ifr->ifr_netmask;
|
|
||||||
sa->sin_addr.s_addr = cygwin_inet_addr (np);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sa->sin_family = AF_INET;
|
|
||||||
sa->sin_port = 0;
|
|
||||||
++cnt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RegCloseKey (subkey);
|
RegCloseKey (subkey);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RegCloseKey (ifkey);
|
||||||
|
|
||||||
|
++cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
|
||||||
|
RegCloseKey (key);
|
||||||
|
|
||||||
/* Set the correct length */
|
/* Set the correct length */
|
||||||
ifc->ifc_len = cnt * sizeof (struct ifreq);
|
ifc->ifc_len = cnt * sizeof (struct ifreq);
|
||||||
}
|
}
|
||||||
|
@ -1468,11 +1557,11 @@ get_ifconf (struct ifconf *ifc, int what)
|
||||||
os_version_info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
|
os_version_info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
|
||||||
GetVersionEx (&os_version_info);
|
GetVersionEx (&os_version_info);
|
||||||
if (os_version_info.dwPlatformId != VER_PLATFORM_WIN32_NT)
|
if (os_version_info.dwPlatformId != VER_PLATFORM_WIN32_NT)
|
||||||
get_9x_ifconf (ifc, sa, what);
|
get_9x_ifconf (ifc, what);
|
||||||
else if (os_version_info.dwMajorVersion <= 4)
|
else if (os_version_info.dwMajorVersion <= 4)
|
||||||
get_nt_ifconf (ifc, sa, what);
|
get_nt_ifconf (ifc, what);
|
||||||
else
|
else
|
||||||
get_2k_ifconf (ifc, sa, what);
|
get_2k_ifconf (ifc, what);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue