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 DWORD dwWindowsMajorVersion
;
79 dwVersion
=GetVersion();
80 dwWindowsMajorVersion
= (DWORD
)(LOBYTE(LOWORD(dwVersion
)));
81 if (dwVersion
>= 0x80000000 && dwWindowsMajorVersion
>= 4) // Windows '95
83 for(ii
=0,jj
=0;ii
<128;ii
++)
84 if (device
[ii
]=='\0') break;
85 else if (device
[ii
]!='\0') {dev
[jj
]=device
[ii
];jj
++;}
87 (void)fprintf(stderr
, "%s: listening on %s\n",program_name
, dev
);
93 for(ii
=0,jj
=0;ii
<128;ii
++)
94 if (device
[ii
]=='\0'&& device
[ii
+1]=='\0') break;
95 else if (device
[ii
]!='\0') {dev
[jj
]=device
[ii
];jj
++;}
98 fwrite(program_name
,strlen(program_name
),1,stderr
);
99 fwrite(": listening on ",15,1,stderr
);
100 fwrite(dev
,strlen(dev
),1,stderr
);
101 fwrite("\n",1,1,stderr
);
102 (void)fflush(stderr
);