[Winpcap-users] pcap_findalldevs Hangs when calledinWindowsservice

Richard Bellengere RichardB at thoroughtec.com
Fri Aug 11 12:36:24 GMT 2006


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.
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?
Is it time to start loading the debug version of the packet.dll to get
more information?
 
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 <mailto:RichardB at thoroughtec.com>  
	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
<mailto:RichardB at thoroughtec.com>  
		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
	

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20060811/a96f6ec0/attachment.htm


More information about the Winpcap-users mailing list