How to build WinPacp 4.11 VS2010 + WDK 7.1 build

How to build WinPacp 4.11 VS2010 + WDK 7.1 build

How to build WinPacp 4.11 VS2010 + WDK 7.1 build

1.get source
http://www.winpcap.org

2.build npf driver,open WDK build CMD
cd WpcapSrc_4_1_1\winpcap\packetNtx\
CompileDriver.bat

Don`t try cd WpcapSrc_4_1_1\winpcap\packetNtx\driver used build npf.sys don`t start services!

line 45
Packet.h->Undefined Err
/*
#if !defined(NDIS30) && !defined(NDIS50)
#error NDIS30 or NDIS50 should be defined
#endif
*/


3.build Packet.dll
Path WpcapSrc_4_1_1\winpcap\packetNtx\Dll\Project

Add Packet.dll project lib path
properties->Linker->General->Additional Library Directoryes->you wdk lib path D:\WinDDK\7600.16385.1\lib\wxp\i386

Find Packet32-Int.h file Add in the head
/*with out HAVE_AIRPCAP_API*/
#undef HAVE_AIRPCAP_API

4.build libpcap
Path WpcapSrc_4_1_1\winpcap\wpcap\libpcap\Win32\Prj

scanner.c->2769 line

#ifndef ANSI_CHARSET
#include <unistd.h>
#endif

inet_pton.c->65 line

/*int
inet_pton(int af, const char *src, void *dst)
{
if (af != AF_INET) {
errno = EAFNOSUPPORT;
return -1;
}
return inet_aton (src, dst);
}*/

5.build wpcap.dll
Path WpcapSrc_4_1_1\winpcap\wpcap\PRJ
error LNK2001: unresolved external symbol _snprintf

pcap-ini.h add

#ifdef WIN32
#define SHUT_WR SD_SEND /*!< The control code for shutdown() is different in Win32 */
#define snprintf _snprintf /*!< The snprintf is called _snprintf() in Win32 */
#endif

原文地址:https://www.cnblogs.com/tangtianfly/p/2690583.html