[Winpcap-users] Re: Winpcap-users Digest, Vol 25, Issue 14

Hardik Shah hardik_nt at yahoo.com
Fri Apr 20 16:19:21 GMT 2007


try using entercriticalsection before starting anythread.if i m not wrong no two thread can access the same stuff at kernel level.
 
--------------------------------
  Hardik Shah
  mobile:- 9827634991
  phone:- +91-0731-2570516  


----- Original Message ----
From: "winpcap-users-request at winpcap.org" <winpcap-users-request at winpcap.org>
To: winpcap-users at winpcap.org
Sent: Friday, 20 April, 2007 5:30:50 PM
Subject: Winpcap-users Digest, Vol 25, Issue 14

Send Winpcap-users mailing list submissions to
    winpcap-users at winpcap.org

To subscribe or unsubscribe via the World Wide Web, visit
    https://www.winpcap.org/mailman/listinfo/winpcap-users
or, via email, send a message with subject or body 'help' to
    winpcap-users-request at winpcap.org

You can reach the person managing the list at
    winpcap-users-owner at winpcap.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Winpcap-users digest..."


Today's Topics:

   1. Problem with threading (Avelino Martins)


----------------------------------------------------------------------

Message: 1
Date: Thu, 19 Apr 2007 21:18:42 +0000
From: Avelino Martins <martins_ajc at msn.com>
Subject: [Winpcap-users] Problem with threading
To: <winpcap-users at winpcap.org>
Message-ID: <BAY117-W18EBF90F0362E266B52C688C570 at phx.gbl>
Content-Type: text/plain; charset="iso-8859-1"

Hello all, 
despite all the threads i readed about issues on threading problems, i couldn't get to a conclusion at the specific issue of the function 
pcap_findalldevs() hanging when called from a child thread, take the simple example:
 
#include <pcap.h>
#pragma comment(lib, "Wpcap.lib")
 
void GetINetDevice()
{
     pcap_if_t* alldevs;
     char errbuf[PCAP_ERRBUF_SIZE+1];
 
     /* Retrieve the device list */
     if(pcap_findalldevs(&alldevs, errbuf) == -1)
     {
          printf("Error in pcap_findalldevs: %s\n", errbuf);
          exit(1);
     }
     // Could not create thread
     MessageBox(NULL, "Sucess","",MB_OK);
 
     // Free the device list 
     pcap_freealldevs(alldevs);
}
 
 
int main()
{ 
     DWORD m_dwThreadID;
     HANDLE m_hThread;
     m_hThread = CreateThread(0,
                                             0,
                                             (LPTHREAD_START_ROUTINE)GetINetDevice,
                                             NULL,
                                             0,
                                             &m_dwThreadID);
     if(!m_hThread)
     {
          // Could not create thread
          MessageBox(NULL, "Thread error","",MB_OK);
     }
     return 0;
}
 
Is anyone able to tell me if the fact of the app hangs/exits on pcap_findalldevs(), is a known issue at winpcap, and if there is any workaround?
 
Best Regards
_________________________________________________________________
Veja mais. Partilhe mais. Experimente o Windows Live Messenger beta gratuitamente
http://ideas.live.com/programpage.aspx?versionId=0eccd94b-eb48-497c-8e60-c6313f7ebb73
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20070419/d60d9c04/attachment.html

------------------------------

_______________________________________________
Winpcap-users mailing list
Winpcap-users at winpcap.org
https://www.winpcap.org/mailman/listinfo/winpcap-users


End of Winpcap-users Digest, Vol 25, Issue 14
*********************************************







      Send a FREE SMS to your friend's mobile from Yahoo! Messenger. Get it now at http://in.messenger.yahoo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20070420/6999be0f/attachment.htm


More information about the Winpcap-users mailing list