2 * Copyright (c) 1999, 2000
3 * Politecnico di Torino. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the Politecnico
13 * di Torino, and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 #include <tcpdump-stdinc.h>
26 static WCHAR
*TmpName
=NULL
;
28 extern char* AdapterName1
;
31 WCHAR
* SChar2WChar(char* nome
)
34 TmpName
=(WCHAR
*) malloc ((strlen(nome
)+2)*sizeof(WCHAR
));
35 for (i
=0;i
<(signed)strlen(nome
)+1; i
++)
41 void* GetAdapterFromList(void* device
,int index
)
44 DWORD dwWindowsMajorVersion
;
49 dwVersion
=GetVersion();
50 dwWindowsMajorVersion
= (DWORD
)(LOBYTE(LOWORD(dwVersion
)));
51 if (dwVersion
>= 0x80000000 && dwWindowsMajorVersion
>= 4) // Windows '95
54 for(i
=0;i
<index
-1;i
++){
55 while(*Adapter95
++!=0);
56 if(*Adapter95
==0)return NULL
;
61 Adapter
=(WCHAR
*)device
;
62 for(i
=0;i
<index
-1;i
++){
64 if(*Adapter
==0)return NULL
;
72 void PrintCapBegins (char* program_name
, char* device
)
75 if(IsTextUnicode(device
,
76 wcslen((short*)device
), // Device always ends with a double \0, so this way to determine its
77 // length should be always valid
80 fprintf(stderr
, "%s: listening on %ws\n",program_name
, device
);
84 fprintf(stderr
, "%s: listening on %s\n",program_name
, device
);