forked from osmocom/wireshark
Paul Welchinski's changes to, on Win32 systems:
properly handle ASCII vs. Unicode in the list of interfaces; initialize Winsock before starting a capture, so that the code in the Win32 libpcap to get the IP address and netmask by translating the host name to an IP address works. svn path=/trunk/; revision=1737
This commit is contained in:
parent
6371e245c1
commit
f6b5d7b8b5
4
AUTHORS
4
AUTHORS
|
@ -269,6 +269,10 @@ Jochen Friedrich <jochen+ethereal@scram.de> {
|
|||
Fix to IPv6 fragment handling
|
||||
}
|
||||
|
||||
Paul Welchinski <paul.welchinski@telusplanet.net> {
|
||||
Fixes to Win32 packet capture code
|
||||
}
|
||||
|
||||
Alain Magloire <alainm@rcsm.ece.mcgill.ca> was kind enough to
|
||||
give his permission to use his version of snprintf.c.
|
||||
|
||||
|
|
19
capture.c
19
capture.c
|
@ -1,7 +1,7 @@
|
|||
/* capture.c
|
||||
* Routines for packet capture windows
|
||||
*
|
||||
* $Id: capture.c,v 1.98 2000/02/19 14:00:33 oabad Exp $
|
||||
* $Id: capture.c,v 1.99 2000/03/21 06:51:58 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -518,6 +518,23 @@ capture(void)
|
|||
struct timeval timeout;
|
||||
int pcap_fd;
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
#endif
|
||||
|
||||
/* Initialize Windows Socket if we are in a WIN32 OS
|
||||
This needs to be done before querying the interface for network/netmask */
|
||||
#ifdef _WIN32
|
||||
wVersionRequested = MAKEWORD( 1, 1 );
|
||||
err = WSAStartup( wVersionRequested, &wsaData );
|
||||
if (err!=0) {
|
||||
snprintf(errmsg, sizeof errmsg,
|
||||
"Couldn't initialize Windows Sockets.");
|
||||
pch=NULL;
|
||||
goto error;
|
||||
}
|
||||
#endif
|
||||
|
||||
ld.go = TRUE;
|
||||
ld.counts.total = 0;
|
||||
|
|
|
@ -835,6 +835,7 @@ B<http://ethereal.zing.org>.
|
|||
Fred Reimer <fwr@ga.prestige.net>
|
||||
Florian Lohoff <flo@rfc822.org>
|
||||
Jochen Friedrich <jochen+ethereal@scram.de>
|
||||
Paul Welchinski <paul.welchinski@telusplanet.net>
|
||||
|
||||
Alain Magloire <alainm@rcsm.ece.mcgill.ca> was kind enough to give his
|
||||
permission to use his version of snprintf.c.
|
||||
|
|
49
util.c
49
util.c
|
@ -1,7 +1,7 @@
|
|||
/* util.c
|
||||
* Utility routines
|
||||
*
|
||||
* $Id: util.c,v 1.38 2000/03/14 08:26:19 guy Exp $
|
||||
* $Id: util.c,v 1.39 2000/03/21 06:51:59 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -608,25 +608,46 @@ GList *
|
|||
get_interface_list(int *err, char *err_str) {
|
||||
GList *il = NULL;
|
||||
wchar_t *names;
|
||||
char *win95names;
|
||||
char newname[255];
|
||||
int i, j, done;
|
||||
|
||||
names = (wchar_t *)pcap_lookupdev(err_str);
|
||||
i = done = 0;
|
||||
|
||||
if (names)
|
||||
do
|
||||
{
|
||||
j = 0;
|
||||
while (names[i] != 0)
|
||||
newname[j++] = names[i++];
|
||||
i++;
|
||||
if (names[i] == 0)
|
||||
done = 1;
|
||||
newname[j++] = 0;
|
||||
il = g_list_append(il, g_strdup(newname));
|
||||
} while (!done);
|
||||
|
||||
if (names) {
|
||||
if (names[0]<256) {
|
||||
/* If names[0] is less than 256 it means the first byte is 0
|
||||
This implies that we are using unicode characters */
|
||||
do
|
||||
{
|
||||
j = 0;
|
||||
while (names[i] != 0)
|
||||
newname[j++] = names[i++];
|
||||
i++;
|
||||
if (names[i] == 0)
|
||||
done = 1;
|
||||
newname[j++] = 0;
|
||||
il = g_list_append(il, g_strdup(newname));
|
||||
} while (!done);
|
||||
}
|
||||
else {
|
||||
/* Otherwise we are in Windows 95/98 and using ascii(8 bit)
|
||||
characters */
|
||||
do
|
||||
{
|
||||
win95names=names;
|
||||
j = 0;
|
||||
while (win95names[i] != 0)
|
||||
newname[j++] = win95names[i++];
|
||||
i++;
|
||||
if (win95names[i] == 0)
|
||||
done = 1;
|
||||
newname[j++] = 0;
|
||||
il = g_list_append(il, g_strdup(newname));
|
||||
} while (!done);
|
||||
}
|
||||
}
|
||||
return(il);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue