[Winpcap-users] Various fixups (was: libpcap.a)
Ouroborus
ouroborus at softhome.net
Sat Dec 17 05:46:30 GMT 2005
I finally got the first step of the tutorial to compile with MingW. This took a number (7) of fixes:
1. Add "-DHAVE_REMOTE" to "CFLAGS" in the relevant make files
2. Add "../libpcap/Win32/Src/gai_strerror.o" to the object list in wpcapsrc_3_1\wpcap\PRJ\GNUmakefile
3. Copy "struct bpf_stat {...};" from wpcapsrc_3_1\Common\Packet32.h to wpcapsrc_3_1\wpcap\libpcap\pcap-bpf.h
4. Comment out "#define IN_MULTICAST..." from wpcap\libpcap\Win32\Include\ip6_misc.h
5. Add 'pcap_findalldevs_ex' to Wpcap_no_extensions.def'
6. Change line 678 in wpcapsrc_3_1\wpcap\libpcap\inet.c as per:
### Begin ###
678c678,679
< (char*)tUstr += strlen(tAstr) + 1;;
---
> // (char*)tUstr += strlen(tAstr) + 1;;
> tUstr = (WCHAR*)(((char*)tUstr) + strlen(tAstr) + 1);
### End ###
7. Add file wpcapsrc_3_1\wpcap\libpcap\Win32\Src\gai_strerror.c:
### Begin ###
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define GAI_STRERROR_BUFFER_SIZE 1024
//#define WS2TCPIP_INLINE extern inline
#define WS2TCPIP_INLINE __stdcall
WS2TCPIP_INLINE
char *
gai_strerrorA(
IN int ecode)
{
DWORD dwMsgLen;
static char buff[GAI_STRERROR_BUFFER_SIZE + 1];
dwMsgLen = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM
|FORMAT_MESSAGE_IGNORE_INSERTS
|FORMAT_MESSAGE_MAX_WIDTH_MASK,
NULL,
ecode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)buff,
GAI_STRERROR_BUFFER_SIZE,
NULL);
return buff;
}
WS2TCPIP_INLINE
WCHAR *
gai_strerrorW(
IN int ecode
)
{
DWORD dwMsgLen;
static WCHAR buff[GAI_STRERROR_BUFFER_SIZE + 1];
dwMsgLen = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM
|FORMAT_MESSAGE_IGNORE_INSERTS
|FORMAT_MESSAGE_MAX_WIDTH_MASK,
NULL,
ecode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR)buff,
GAI_STRERROR_BUFFER_SIZE,
NULL);
return buff;
}
### End ###
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20051216/939ce186/attachment.htm
More information about the Winpcap-users
mailing list