dect
/
libpcap
Archived
13
0
Fork 0

Fixes to compile WinPcap under MINGW32 and MINGW64.

This commit is contained in:
Gianluca Varenni 2010-10-15 01:42:59 -07:00
parent 4d7214cbc5
commit cc1a80e41e
6 changed files with 23 additions and 7 deletions

View File

@ -45,6 +45,12 @@
* in ai_flags? * in ai_flags?
*/ */
/*
* Mingw64 has its own implementation of getaddrinfo, mingw32 no
*/
#ifndef __MINGW64__
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
@ -85,7 +91,7 @@ static const char rcsid[] _U_ =
#ifdef NEED_ADDRINFO_H #ifdef NEED_ADDRINFO_H
#include "addrinfo.h" #include "addrinfo.h"
#ifdef WIN32 #ifdef WIN32
#include "IP6_misc.h" #include "ip6_misc.h"
#endif #endif
#endif #endif
@ -1118,3 +1124,6 @@ find_afd(af)
} }
return NULL; return NULL;
} }
#endif /*__MING64__*/

View File

@ -47,7 +47,7 @@ static const char rcsid[] _U_ =
* XXX - why was this included even on UNIX? * XXX - why was this included even on UNIX?
*/ */
#ifdef __MINGW32__ #ifdef __MINGW32__
#include "IP6_misc.h" #include "ip6_misc.h"
#endif #endif
#ifndef WIN32 #ifndef WIN32

6
inet.c
View File

@ -878,8 +878,10 @@ pcap_lookupdev(errbuf)
*/ */
while(NAdapts--) while(NAdapts--)
{ {
strcpy((char*)tUstr, tAstr); char* tmp = (char*)tUstr;
(char*)tUstr += strlen(tAstr) + 1;; strcpy(tmp, tAstr);
tmp += strlen(tAstr) + 1;
tUstr = (WCHAR*)tmp;
tAstr += strlen(tAstr) + 1; tAstr += strlen(tAstr) + 1;
} }

View File

@ -39,7 +39,12 @@ static const char rcsid[] _U_ =
#include <pcap-int.h> #include <pcap-int.h>
#include <Packet32.h> #include <Packet32.h>
#ifdef __MINGW32__ #ifdef __MINGW32__
#include <ddk/ndis.h> #ifdef __MINGW64__
#include <ntddndis.h>
#else /*__MINGW64__*/
#include <ddk/ntddndis.h>
#include <ndis.h>
#endif /*__MINGW64__*/
#else /*__MINGW32__*/ #else /*__MINGW32__*/
#include <ntddndis.h> #include <ntddndis.h>
#endif /*__MINGW32__*/ #endif /*__MINGW32__*/

2
pcap.c
View File

@ -57,7 +57,7 @@ static const char rcsid[] _U_ =
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#if !defined(_MSC_VER) && !defined(__BORLANDC__) #if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__MINGW32__)
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <fcntl.h> #include <fcntl.h>

View File

@ -54,7 +54,7 @@ static const char rcsid[] _U_ =
#include <pcap-stdinc.h> #include <pcap-stdinc.h>
#ifdef __MINGW32__ #ifdef __MINGW32__
#include "IP6_misc.h" #include "ip6_misc.h"
#endif #endif
#else /* WIN32 */ #else /* WIN32 */
#include <sys/socket.h> /* for "struct sockaddr" in "struct addrinfo" */ #include <sys/socket.h> /* for "struct sockaddr" in "struct addrinfo" */