[Winpcap-users] Debugging a winpcap exception

Chris Morgan chmorgan at gmail.com
Wed Jan 6 12:39:52 PST 2010


On Wed, Jan 6, 2010 at 3:24 PM, Chris Morgan <chmorgan at gmail.com> wrote:
> On Wed, Jan 6, 2010 at 3:19 PM, Gianluca Varenni
> <gianluca.varenni at cacetech.com> wrote:
>>
>>
>> --------------------------------------------------
>> From: "Chris Morgan" <chmorgan at gmail.com>
>> Sent: Wednesday, January 06, 2010 11:56 AM
>> To: "Gianluca Varenni" <gianluca.varenni at cacetech.com>
>> Cc: <winpcap-users at winpcap.org>
>> Subject: Re: [Winpcap-users] Debugging a winpcap exception
>>
>>> On Wed, Jan 6, 2010 at 11:31 AM, Gianluca Varenni
>>> <gianluca.varenni at cacetech.com> wrote:
>>>>
>>>>
>>>> --------------------------------------------------
>>>> From: "Chris Morgan" <chmorgan at gmail.com>
>>>> Sent: Monday, January 04, 2010 1:45 PM
>>>> To: <winpcap-users at winpcap.org>
>>>> Subject: [Winpcap-users] Debugging a winpcap exception
>>>>
>>>>> I'm trying to debug some very odd behavior in a .net application that
>>>>> pinvokes winpcap to capture network packets. The behavior I see seems
>>>>> indicative of memory corruption, when I run under the vs debugger all
>>>>> events seem to stop until I do a 'break all' and continue after
>>>>> setting breakpoints. Even then things only run for a short while.
>>>>>
>>>>> I switched to using windbg and after running I see this exception
>>>>> which may or may not be the issue. I'm having trouble continuing
>>>>> because I'm having difficulty building wpcap.dll in debug mode, it
>>>>> wants packet.lib but after building packet.lib it still won't build.
>>>>
>>>> Which configuration of packet.dll did you build? Did you follow the
>>>> instructions at
>>>>
>>>> http://www.winpcap.org/docs/docs_411/html/group__compilation.html
>>>>
>>>> Have a nice day
>>>> GV
>>>>
>>>
>>> I was trying to follow the instructions there. I've been doing
>>> software development for a long time now and those instructions are
>>> pretty confusing. It might make sense to have a single solution that
>>> contains both the packet and wpcap projects and so the targets can be
>>> synchronized to avoid the problem below. Also putting the solution at
>>> a parent directory instead of a subdirectory to make it easier to
>>> find. I can submit patches if there is any interest or not if there is
>>> a good reason why things are how they are that I'm unaware of.
>>
>> I've been working on something like that, but nothing is public yet. It's a
>> bit of a pain because there is a single flavor for wpcap.dll but several
>> flavors of packet.dll (NT4, NT5, NT6) and this makes things quite complex.
>
> Ahh thats good news. It would make those instructions a lot simpler if
> one could just pick a target :-)
>
>
>>
>>>
>>> I'm building the 'Debug No Netmon' target for the packet solution. The
>>> 'Debug' target says npptools.lib can't be found.
>>>
>>
>> This is not normal. Are you using Visual Studio 2005 SP1 to build?
>>
>
> I'm running vs2008 sp1 here.
>
>
>>
>>> Looking at the linker arguments for wpcap the additional linker
>>> directory is set to '..\..\packetNtx\Dll\Project\Debug\x86' which is
>>> the output directory for the 'Debug' target of the packet solution.
>>> Can I just change this to point at the
>>> '..\..\packetNtx\Dll\Project\Debug No Netmon\x86' directory?
>>
>> Yes.
>>
>
> Cool. Let me try that.
>
> Chris
>

It gets further now but now I'm seeing linker errors,

------ Build started: Project: wpcap, Configuration: Debug Win32 ------
Compiling...
cl : Command line warning D9035 : option 'Wp64' has been deprecated
and will be removed in a future release
sockutils.c
c:\users\chris morgan\downloads\wpcapsrc_4_1_1\winpcap\wpcap\libpcap\sockutils.c(308)
: warning C4244: '=' : conversion from 'SOCKET' to 'unsigned int',
possible loss of data
c:\users\chris morgan\downloads\wpcapsrc_4_1_1\winpcap\wpcap\libpcap\sockutils.c(342)
: warning C4267: 'function' : conversion from 'size_t' to 'int',
possible loss of data
c:\users\chris morgan\downloads\wpcapsrc_4_1_1\winpcap\wpcap\libpcap\sockutils.c(376)
: warning C4267: 'function' : conversion from 'size_t' to 'int',
possible loss of data
Linking...
   Creating library c:\Users\Chris
Morgan\Downloads\WpcapSrc_4_1_1\winpcap\wpcap\PRJ\\Debug\x86\wpcap.lib
and object c:\Users\Chris
Morgan\Downloads\WpcapSrc_4_1_1\winpcap\wpcap\PRJ\\Debug\x86\wpcap.exp
pcap-win32.obj : error LNK2001: unresolved external symbol _snprintf
pcap.obj : error LNK2001: unresolved external symbol _snprintf
savefile.obj : error LNK2019: unresolved external symbol _snprintf
referenced in function _pcap_open_offline
Win32-Extensions.obj : error LNK2001: unresolved external symbol _snprintf
optimize.obj : error LNK2001: unresolved external symbol _snprintf
pcap-new.obj : error LNK2001: unresolved external symbol _snprintf
pcap-remote.obj : error LNK2001: unresolved external symbol _snprintf
pcap-tc.obj : error LNK2001: unresolved external symbol _snprintf
bpf_image.obj : error LNK2001: unresolved external symbol _snprintf
fad-win32.obj : error LNK2001: unresolved external symbol _snprintf
gencode.obj : error LNK2001: unresolved external symbol _snprintf
inet.obj : error LNK2001: unresolved external symbol _snprintf
c:\Users\Chris Morgan\Downloads\WpcapSrc_4_1_1\winpcap\wpcap\PRJ\\Debug\x86\wpcap.dll
: fatal error LNK1120: 1 unresolved externals
Build log was saved at "file://c:\Users\Chris
Morgan\Downloads\WpcapSrc_4_1_1\winpcap\wpcap\PRJ\Debug\x86\BuildLog.htm"
wpcap - 13 error(s), 4 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I'm not sure why _snprintf can't be found even after googling for the issue...

Chris


More information about the Winpcap-users mailing list