[Winpcap-users] pcap_findalldevs Hangs when called inWindowsservice

Gianluca Varenni gianluca.varenni at cacetech.com
Thu Aug 10 15:51:29 GMT 2006


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20060810/35eec846/attachment.htm


More information about the Winpcap-users mailing list