[Winpcap-users] pcap_findalldevs Hangs when calledinWindowsservice
Gianluca Varenni
gianluca.varenni at cacetech.com
Fri Aug 11 15:29:26 GMT 2006
----- Original Message -----
From: Richard Bellengere
To: winpcap-users at winpcap.org
Sent: Friday, August 11, 2006 5:36 AM
Subject: RE: [Winpcap-users] pcap_findalldevs Hangs when calledinWindowsservice
Hi.
Checked Visual Studio 2005 Express and WinPCap version 4.0.
Checked Visual Studio 2003 C++ and WinPCap version 4.0.
Checked program compiled as Multibyte Characters and Unicode Characters.
This doesn't influence WinPcap.
Checked program compiled linked to runtime libraries in multithreaded dll and static inclusion of multithreaded runtime libraries.
I tried compiling the same code in to a windowed app (instead of console app) and running that as a service.
All result in the same problem. pcap_findalldevs hangs.
The documetation makes reference to pcap_findalldevs_ex, but I have not been able to find it in headers and compile, Am I missing something?
If you want to use pcap_findalldevs_ex, just include pcap.h (do *NOT* include any other header), and have both WPCAP and HAVE_REMOTE defined as preprocessor directives. In any case pcap_findalldevs_ex is a wrapper against pcap_findalldevs, which in turn calls PacketGetAdapterNames, which is almost certainly the API that hangs. So it does not help.
Is it time to start loading the debug version of the packet.dll to get more information?
That would be very helpful. Please use WinPcap 4.0alpha1, as this version produces a much more verbose trace.
Have a nice day
GV
Regards
RichardB
------------------------------------------------------------------------------
From: winpcap-users-bounces at winpcap.org [mailto:winpcap-users-bounces at winpcap.org] On Behalf Of Gianluca Varenni
Sent: 10 August 2006 18:15
To: winpcap-users at winpcap.org
Subject: Re: [Winpcap-users] pcap_findalldevs Hangs when calledinWindowsservice
Richard,
I'll try to create a small test application to reproduce the problem. One thing came to my mind: have you changed the compilation properties of your application so have it thread safe?
Under VC2003, it's in the project properties, under C/C++ -> Code generation -> Runtime Library. Be sure to set it to set it to multithreaded (or multithreaded DLL, depending on the flavor of CRT that you want to use).
have a nice day
GV
----- Original Message -----
From: Richard Bellengere
To: winpcap-users at winpcap.org
Sent: Thursday, August 10, 2006 1:06 AM
Subject: RE: [Winpcap-users] pcap_findalldevs Hangs when called inWindowsservice
Hi
Sorry - my sample app depends on way too much for me to quickly zip it up and post it.
I'm using 3.1. I will try 4.0 and let you know what happens.
I'm using Visual C++ 2005 Express. I will try Visual Studio 2003 for size too.
Some more information that may be of interest.
My service is compiled as a console application. When running it (in debug mode) as a console app and not a service, pcap_findalldevs is successful only if run from the main thread. pcap_loop can be run from the new thread no problem. When I do the same thing in a windowed application I can call pcap_findalldevs from the new thread without issue.
It really smacks of a thread permissions issue. I've tried making sure the apps and services are running as admin (because of npf and nm), but that does not seem to help. Right now I'm trying to find out what the difference is between a console thread and a Window thread.
Regards
RichardB
----------------------------------------------------------------------------
From: winpcap-users-bounces at winpcap.org [mailto:winpcap-users-bounces at winpcap.org] On Behalf Of Gianluca Varenni
Sent: 09 August 2006 19:15
To: winpcap-users at winpcap.org
Subject: Re: [Winpcap-users] pcap_findalldevs Hangs when called in Windowsservice
Richard,
can you please provide a sample app showing the problem?
Which version of WinPcap are you using? WinPcap 3.1 has a known bug that affects services based on WinPcap, bug that has been fixed in the newer versions of WinPcap like 4.0alpha1.
Have a nice day
GV
----- Original Message -----
From: Richard Bellengere
To: winpcap-users at winpcap.org
Sent: Tuesday, August 08, 2006 5:44 AM
Subject: [Winpcap-users] pcap_findalldevs Hangs when called in Windows service
Hi.
I'm getting exactly the same thing. Did you ever get a solution to this problem?
It seems to have something to do with findalldevs being called from a new thread and not the process's main thread.
Thanks
RichardB
--------------------------------------------------------------------------
_______________________________________________
Winpcap-users mailing list
Winpcap-users at winpcap.org
https://www.winpcap.org/mailman/listinfo/winpcap-users
----------------------------------------------------------------------------
_______________________________________________
Winpcap-users mailing list
Winpcap-users at winpcap.org
https://www.winpcap.org/mailman/listinfo/winpcap-users
------------------------------------------------------------------------------
_______________________________________________
Winpcap-users mailing list
Winpcap-users at winpcap.org
https://www.winpcap.org/mailman/listinfo/winpcap-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20060811/a5fc8d4a/attachment-0001.htm
More information about the Winpcap-users
mailing list