<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2873" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Matt,</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>sorry for the long delay.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I briefly tried your code, and apart for the issue of the
service dependency (which is a known issue of WinPcap), I didn't see the service
blocking on pcap_findalldevs. Have you tried running the barebone service on
several machines, and see if it blocks?</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Have a nice day</FONT></DIV>
<DIV><FONT size=2>GV</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV>----- Original Message ----- </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=mjaffa@gmail.com href="mailto:mjaffa@gmail.com">matt jaffa</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=winpcap-users@winpcap.org
href="mailto:winpcap-users@winpcap.org">winpcap-users@winpcap.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, March 31, 2006 3:29
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Winpcap-users]
pcap_findalldevs Hangs when called in Windowsservice</DIV>
<DIV><BR></DIV>
<DIV>So we added nm and NPF to dependencies to our service and the service
started up just fine. But within the Service it is hanging on the
pcap_findalldevs. So adding those two dependencies got it to start up but it
just sits there in the pcap_findalldevs call. </DIV>
<DIV> </DIV>
<DIV>Does anyone have a working service which is using winpcap that just
doesn't hang in pcap_findalldevs?</DIV>
<DIV> </DIV>
<DIV>Thanks<BR> </DIV>
<DIV><SPAN class=gmail_quote>On 3/27/06, <B class=gmail_sendername>Bryan
Kadzban</B> <<A
href="mailto:bryan@kadzban.is-a-geek.net">bryan@kadzban.is-a-geek.net</A>>
wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">matt
jaffa wrote:<BR>> Hi,<BR>><BR>> When we are calling
pcap_findalldevs in a Windows service the service <BR>> seems to hang in
that function call.<BR><BR>Your service needs to depend on NPF.<BR><BR>The
reason is that NPF is set up to start on demand (basically, when
the<BR>first program makes a packet.dll or wpcap.dll call, the service will
be <BR>started), not at startup. When packet.dll loads (it's a
dependency of<BR>wpcap.dll), it tries to start the NPF service for you, but
since your<BR>service is starting, the service control manager is holding a
lock. It <BR>has to release the lock before any other service can
start. (Eventually<BR>something times out, NPF gets to start,
packet.dll loads, and your<BR>service finishes starting up.)<BR><BR>The fix
is to make NPF start before your service; the only supported way <BR>to do
this is to set a DependOnService REG_MULTI_SZ value in your<BR>service's
registry key. The data in the registry value should be
the<BR>name of any services you depend on; setting it to NPF by itself
is<BR>probably sufficient. <BR><BR>Er, actually... If you're
using a new enough WinPcap version (probably<BR>3.1 and newer), you'll also
have to depend on the nm (Network
Monitor)<BR>service. (packet.dll loads up wanpacket.dll, which
loads up another DLL <BR>that starts the nm service if it's
needed. So the same thing applies;<BR>nm has to be running before
either packet.dll or wanpacket.dll get<BR>loaded.) So set it to
both NPF and nm.<BR><BR><BR>_______________________________________________
<BR>Winpcap-users mailing list<BR><A
href="mailto:Winpcap-users@winpcap.org">Winpcap-users@winpcap.org</A><BR><A
href="https://www.winpcap.org/mailman/listinfo/winpcap-users">https://www.winpcap.org/mailman/listinfo/winpcap-users
</A><BR><BR><BR><BR></BLOCKQUOTE></DIV><BR>
<P>
<HR>
<P></P>_______________________________________________<BR>Winpcap-users
mailing
list<BR>Winpcap-users@winpcap.org<BR>https://www.winpcap.org/mailman/listinfo/winpcap-users<BR></BLOCKQUOTE></BODY></HTML>