[Winpcap-users] Access Violation when using first pcapfunction(pcap_findalldevs_ex) in debug mode...

Gianluca Varenni gianluca.varenni at gmail.com
Fri Jul 15 06:04:58 GMT 2005


Hi Ravi.

It does seem the bug we have recently fixed in our source tree, related to 
the Netmon COM component.

Can you please try packet.dll and wanpacket.dll that you can find at the 
followind URLs and tell me if they solve your problem?

http://www.winpcap.org/gianluca/Packet.dll
http://www.winpcap.org/gianluca/WanPacket.dll

You should copy them in the same folder of your executable (if you debug 
through VS, check in the "debug" window that the right version of 
(wan)packet.dll is loaded by the test app).

Have a nice day
GV



----- Original Message ----- 
From: "Ravi Sankar" <s_rsy at yahoo.com>
To: <winpcap-users at winpcap.org>
Sent: Thursday, July 14, 2005 10:17 PM
Subject: Re: [Winpcap-users] Access Violation when using first 
pcapfunction(pcap_findalldevs_ex) in debug mode...


> Hello All,
>
> The Visual Studio Version 6.0 with Service Pack 6.
>
> I have tried to run the sample programs it also has
> same problem.
>
> Project "Build Active configuration" is "Win32 -
> Debug"
>
> The code is properly compiled. Few times in Debug mode
> (F5) with / without break point it executes fine. but
> most of time it fails
>
> When I run the program ( Ctrl + F5) it executes fine.
>
> When I put break point in any place in the code and
> Debug (F5), it gives "Access Violation" at
> "pcap_findalldevs_ex".
>
> If I put break point in "pcap_findalldevs_ex" and
> debug (F5) it executes properly until that point and
> if I "Step In (F11)" or "Step Over (F10)" it gives
> access violation.
>
> My guess where the problem may be
>
> 1. Any initilizing issues - After I see all the
> replies and sample programs I feel
> "pcap_findalldevs_ex" can be used directly with out
> any initialising. So this may not be a problem.
>
> 2. If unloading of Packet.DLL properly or stop the
> capturing properly or not closing the handle properly,
> it may give "Access Violoation". I am using
> "pcap_loop" function with a handler "packet_handler"
> similar as in "netmeter" sample. When closing the
> application i terminate thread and use "pcap_close" to
> close the adaptor and Wait for the thread to stop. The
> code written while closing the application
>
>
> // Terminate the monitor thread
> BOOL res=TerminateThread(m_hMonitorThread,0);
>
> if(res==false){
> AfxMessageBox("Fatal Error: cannot terminate the
> capture thread");
> exit(0);
> }
>
> pcap_close (m_pCaptureHandle);
>
> //wait the end of the capture thread
> WaitForSingleObject(m_hMonitorThread, INFINITE);
>
>
>
> Please let me know if any more cleaning to be done.
>
>
> One more clarification.
>
> In the help it is mentioned that "pcap_loop" and
> "pcap_dispatch" is discouraged function. When i
> searched for any function with message handler
> function i could not find any thing more. That means,
> we have to use  "pcap_open" for opening adaptor and
> then capture using "pcap_next_ex" and close using
> "pcap_close"?
>
> Thanks for your time
> Ravi
>
>
>
> ____________________________________________________
> Start your day with Yahoo! - make it your home page
> http://www.yahoo.com/r/hs
>
> _______________________________________________
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-users 



More information about the Winpcap-users mailing list