243 lines
12 KiB
HTML
243 lines
12 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||
|
<title>WinPcap: How to compile WinPcap</title>
|
||
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||
|
<link href="style.css" rel="stylesheet" type="text/css"/>
|
||
|
</head>
|
||
|
<body>
|
||
|
<!-- Generated by Doxygen 1.6.1 -->
|
||
|
<div class="navigation" id="top">
|
||
|
<div class="tabs">
|
||
|
<ul>
|
||
|
<li><a href="main.html"><span>Main Page</span></a></li>
|
||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||
|
<li><a href="modules.html"><span>Modules</span></a></li>
|
||
|
<li><a href="annotated.html"><span>Data Structures</span></a></li>
|
||
|
<li><a href="files.html"><span>Files</span></a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="contents">
|
||
|
<h1>How to compile WinPcap<br/>
|
||
|
<small>
|
||
|
[<a class="el" href="group__internals.html">WinPcap internals</a>]</small>
|
||
|
</h1><table border="0" cellpadding="0" cellspacing="0">
|
||
|
</table>
|
||
|
<html>
|
||
|
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
||
|
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
|
||
|
<meta name="ProgId" content="FrontPage.Editor.Document">
|
||
|
<title></title>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<p>This section explains how to compile WinPcap, both the kernel level and
|
||
|
the user-level portion, on the various Win32 platforms. The source code can be
|
||
|
found on the <a href="http://www.winpcap.org/">WinPcap website</a>.</p>
|
||
|
<h2>Compiling the driver</h2>
|
||
|
<p>Two main NPF source trees are available for compilation: Windows NTx and Windows 9x. Note that, since the NPF
|
||
|
Driver is platform-dependent, it is STRONGLY suggested to compile it for the OS where it will be used, in order to
|
||
|
link the correct DDK libraries. For example, if you compile the
|
||
|
driver with the Windows NT 4 DDK, it will not work properly on Windows 2000 and
|
||
|
vice versa.</p>
|
||
|
<h3>Compiling the driver for Windows NT4</h3>
|
||
|
<p>Software requirements:</p>
|
||
|
<ul>
|
||
|
<li>Microsoft Driver Developer Kit (DDK) for Windows NT4</li>
|
||
|
<li>A recent version of the Microsoft Platform Software Development Kit
|
||
|
(SDK) that is compatible with Visual Studio 6 (the latest compatible one is
|
||
|
Platform SDK February 2003). This version of the PSDK is available on the
|
||
|
Microsoft web site at
|
||
|
<a href="http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm">
|
||
|
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm</a>.
|
||
|
It can be ordered online at
|
||
|
<a href="http://www.qmedia.ca/launch/psdk.htm">
|
||
|
http://www.qmedia.ca/launch/psdk.htm</a>, and it's also available to
|
||
|
Microsoft MSDN subscribers on the Subscribers Downloads web site.<li>Microsoft Visual C++ 6.0
|
||
|
with Service Pack 5 or 6 (both the service packs are available online on the
|
||
|
Microsoft web site).</ul>
|
||
|
<p>If your system satisfies these requirements, follow these steps:</p>
|
||
|
<ol>
|
||
|
<li>From the Windows NT Start menu, select the folder <em>Programs</em> and
|
||
|
then <i>Development Kits</i>, then <em>Windows NT4 DDK.</em> From here select the voice
|
||
|
<em>Checked Build
|
||
|
Environment</em> if you want to build a debug version, or <em>Free Build
|
||
|
Environment</em> if you want to build a release version.
|
||
|
<li>A command prompt will be opened. Move to the directory PacketNTx inside the
|
||
|
WinPcap source folder and type the command<br><br><i>CompileDriver<br></i>
|
||
|
<br>This script will generate the driver (npf.sys). The binary will be put in
|
||
|
one of these folders<ul>
|
||
|
<li><i>Free Build Environment: </i>winpcap\PacketNTx\driver\bin\NT4\i386\free</li>
|
||
|
<li><i>Checked Build Environment: </i>winpcap\PacketNTx\driver\bin\NT4\i386\checked</li>
|
||
|
</ul>
|
||
|
</ol>
|
||
|
<p><b>Warning</b>: sometimes, during the compilation of the driver, a lot of
|
||
|
'last line incomplete' errors are generated. Ignore these errors and let the
|
||
|
compilation process continue, they are due to bugs in some DDK versions.</p>
|
||
|
<h3>Compiling the driver for Windows 2000/XP/2003/Vista/2008/Win7/2008R2 (x86 and x64)</h3>
|
||
|
<p>Software requirements:</p>
|
||
|
<ul>
|
||
|
<li>Microsoft Windows Driver Kit (WDK) 6001.18002. As of release 4.1,
|
||
|
WinPcap is compiled with WDK 6001.18002.</li>
|
||
|
</ul>
|
||
|
<p>NOTE: it should be possible to use older DDKs to compile WinPcap, but you
|
||
|
might need to
|
||
|
manually modify the compilation scripts in order to disable PREfast (PREfast is
|
||
|
a static code analysis tool shipped with recent versions of the DDK/WDK).</p>
|
||
|
<p>If your system satisfies these requirements, follow these steps:</p>
|
||
|
<ol>
|
||
|
<li>From the Windows Start menu, select the folder <em>Programs</em> and
|
||
|
then <i>Windows Driver K</i>, then <em>WDK 6001.18002</em>, then <em>Build Environments</em>.<ul>
|
||
|
<li>x86 driver: Choose <em>Windows 2000</em> and then <em>Windows 2000 x86 Free Build Environment </em>if you want to build a release version or <em>Windows 2000
|
||
|
x86 Checked Build Environment </em>if you want to build a debug version.</li>
|
||
|
<li>x64 driver: Choose <em>Windows Server 2003</em> and then <em>Windows
|
||
|
Server 2003 x64 Free Build Environment </em>if you want to build a release version or
|
||
|
<em>Windows Server 2003
|
||
|
x64 Checked Build Environment </em>if you want to build a debug version.</li>
|
||
|
</ul>
|
||
|
<li>A command prompt will be opened. Move to the directory PacketNTx inside the
|
||
|
WinPcap source folder and type the command<br><br><i>CompileDriver<br></i>
|
||
|
<br>This script will generate the driver (npf.sys). The binary will be put in
|
||
|
one of these folders<ul>
|
||
|
<li><i>x86 driver (both Free and Checked Build): </i>winpcap\PacketNTx\driver\bin\i386</li>
|
||
|
<li><i>x64 driver (both Free and Checked Build): </i>winpcap\PacketNTx\driver\bin\amd64</li>
|
||
|
</ul>
|
||
|
</ol>
|
||
|
<h3>Compiling the driver on Windows 9x</h3>
|
||
|
<p><font color="#FF0000">NOTE: this Windows platform is no longer supported by
|
||
|
WinPcap. However, the sources for these operating systems are still available in
|
||
|
the sources package.</font></p>
|
||
|
<p>To compile the driver for Windows 9x you will need:</p>
|
||
|
<ul>
|
||
|
<li>Driver Developer Kit (DDK) for Windows 95/98/ME
|
||
|
<li>A recent version of the Microsoft Platform Software Development Kit (SDK)
|
||
|
that is compatible with Visual Studio 6 (the latest compatible one is
|
||
|
Platform SDK February 2003). This version of the PSDK is available on the
|
||
|
Microsoft web site at
|
||
|
<a href="http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm">
|
||
|
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm</a>.
|
||
|
It can be ordered online at
|
||
|
<a href="http://www.qmedia.ca/launch/psdk.htm">
|
||
|
http://www.qmedia.ca/launch/psdk.htm</a>, and it's also available to
|
||
|
Microsoft MSDN subscribers on the Subscribers Downloads web site.<li>Microsoft Visual C++ 6.0
|
||
|
with Service Pack 5 or 6 (both the service packs are available online on the
|
||
|
Microsoft web site).</ul>
|
||
|
<p>The steps to follow are:</p>
|
||
|
<ol>
|
||
|
<li>Open a DOS shell
|
||
|
<li>Go to the VisualC++ BIN directory (for example C:\DEVSTUDIO\VC\BIN) and
|
||
|
execute the command<br>
|
||
|
<br>
|
||
|
<em>Vcvars32<br>
|
||
|
</em>
|
||
|
<li>Go to the SDK directory (for example C:\MSSDK) and execute the command<br>
|
||
|
<br>
|
||
|
<em>Setenv sdk_path</em><br>
|
||
|
<br>
|
||
|
where <em>sdk_path</em> is the directory of SDK (for example Setenv C:\MSSDK)
|
||
|
<li>Go to the DDK directory (for example C:\DDK) and execute the command<br>
|
||
|
<br>
|
||
|
<em>Ddkenv 32 net<br>
|
||
|
</em>
|
||
|
<li>Move to the directory whit the driver's source code and type the command<br>
|
||
|
<br>
|
||
|
<em>nmake rtl<br>
|
||
|
<br>
|
||
|
</em>to obtain a release version, or<br>
|
||
|
<br>
|
||
|
<em>nmake<br>
|
||
|
<br>
|
||
|
</em>to obtain a debug version.<br>The release version of <i>packet.vxd</i> will be placed in the
|
||
|
<em>retail</em>
|
||
|
directory, the debug version in the <em>debug</em> directory.</li>
|
||
|
</ol>
|
||
|
<p><strong>Warning</strong>: On some systems the NMAKE utility is not able to
|
||
|
launch ADRC2VXD, this means that the driver binary is generated correctly, but
|
||
|
without the copyright information. We don't know the cause of this problem.</p>
|
||
|
<h2>Compiling packet.dll</h2>
|
||
|
<p>The source tree for this DLL is located in PacketNTx\dll\.</p>
|
||
|
<p><font color="#FF0000">NOTE: the 9x family of Windows operating systems is no longer supported
|
||
|
by WinPcap. However, the sources for these operating systems are still available
|
||
|
in the sources package.</font></p>
|
||
|
<p>Software requirements:</p>
|
||
|
<ul>
|
||
|
<li>Microsoft Visual Studio 2005 SP1. It's theoretically possible to compile
|
||
|
the x86 version with Visual Studio 6, but the project files are no longer
|
||
|
maintained.<li>The AirPcap developer's pack from
|
||
|
<a href="http://www.cacetech.com/products/airpcap.htm">
|
||
|
http://www.cacetech.com/products/airpcap.htm</a>. The AirPcap developer's
|
||
|
pack needs to be unzipped in a folder in the same folder where the WinPcap
|
||
|
sources have been unzipped.</ul>
|
||
|
<p>To compile the PACKET.DLL, load the project <i>packet.sln</i> contained in the directory PacketNTx\dll\project
|
||
|
in Visual Studio 2005. There are several project
|
||
|
configurations, each of them available for the x86 (Win32) and x64 platforms:</p>
|
||
|
<ul>
|
||
|
<li><i>Release</i>: standard release configuration</li>
|
||
|
<li><i>Debug</i>: standard debug configuration</li>
|
||
|
<li><i>Release NT4</i>: release configuration able to run on
|
||
|
NT4. It does not include Wan and IP helper API support.</li>
|
||
|
<li><i>Debug NT4</i>: debug configuration able to run on
|
||
|
NT4. It does not include Wan and IP helper API support.</li>
|
||
|
<li><i>Release No NetMon</i>: release configuration able to run on
|
||
|
Vista. It
|
||
|
does not include Wan support (with the NetMon API).</li>
|
||
|
<li><i>Debug No NetMon</i>: debug configuration able to run on
|
||
|
Vista. It
|
||
|
does not include Wan support (with the NetMon API).</li>
|
||
|
<li><i>Release LOG_TO_FILE</i>: standard release configuration with tracing to
|
||
|
file enabled.</li>
|
||
|
<li><i>Release NT4 LOG_TO_FILE</i>: release configuration able to run on
|
||
|
NT4 with tracing to file enabled. It does not include Wan and IP helper API support.</li>
|
||
|
<li><i>Release No NetMon LOG_TO_FILE</i>: release configuration able to run on
|
||
|
Vista with tracing to file enabled. It
|
||
|
does not include Wan support (with the NetMon API).</li>
|
||
|
</ul>
|
||
|
<p>Choose the desired configuration and build the project to obtain the binary
|
||
|
files.</p>
|
||
|
<h2>Compiling wpcap.dll</h2>
|
||
|
<p>wpcap.dll can be compiled for any Win32 platform and the generated dll is system independent.</p>
|
||
|
<p>System Requirements:</p>
|
||
|
<ul>
|
||
|
<li>Microsoft Visual Studio 2005 SP1. It's theoretically possible to compile
|
||
|
the x86 version with Visual Studio 6, but the project files are no longer
|
||
|
maintained.<li>The AirPcap developer's pack from
|
||
|
<a href="http://www.cacetech.com/products/airpcap.htm">
|
||
|
http://www.cacetech.com/products/airpcap.htm</a>. The AirPcap developer's
|
||
|
pack needs to be unzipped in a folder in the same folder where the WinPcap
|
||
|
sources have been unzipped.There are eight build project configurations:</ul>
|
||
|
<p>To compile the wpcap.dll, load the project <i>wpcap.sln</i> contained in the directory
|
||
|
wpcap\PRJ
|
||
|
in Visual Studio 2005. There are several project
|
||
|
configurations, each of them available for the x86 (Win32) and x64 platforms:</p>
|
||
|
<ul>
|
||
|
<li><i>Release</i>: standard release configuration</li>
|
||
|
<li><i>Debug</i>: standard debug configuration</li>
|
||
|
<li><i>Release No AirPcap</i>: release configuration without support for
|
||
|
AirPcap adapters.</li>
|
||
|
<li><i>Debug No AirPcap</i>: debug configuration without support for AirPcap
|
||
|
adapters.</li>
|
||
|
</ul>
|
||
|
<p>Choose the desired configuration and build the project to obtain the binary
|
||
|
files.</p>
|
||
|
<p><i>Note</i>: wpcap.dll contains the source code of libpcap from
|
||
|
<a href="http://www.tcpdump.org">www.tcpdump.org</a>, with some modifications
|
||
|
for remote capture. You will be able to include and build a different libpcap
|
||
|
version simply copying it in the directory <i>winpcap\wpcap\prj</i> of the
|
||
|
WinPcap source code distribution, but you must use the "Debug" or "Release"
|
||
|
build configurations.<br>
|
||
|
</p>
|
||
|
|
||
|
</body>
|
||
|
|
||
|
</html>
|
||
|
</div>
|
||
|
|
||
|
<hr>
|
||
|
<p align="right"><img border="0" src="winpcap_small.gif" align="absbottom" width="91" height="27">
|
||
|
documentation. Copyright (c) 2002-2005 Politecnico di Torino. Copyright (c) 2005-2009
|
||
|
CACE Technologies. All rights reserved.</p>
|