<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:verdana,helvetica,sans-serif;font-size:8pt">try using entercriticalsection before starting anythread.if i m not wrong no two thread can access the same stuff at kernel level.<br><div> </div>--------------------------------<br> <div>Hardik Shah<br> <font size="3">mobile:- 9827634991</font><br> phone:- +91-0731-2570516 </div><div style="font-family: verdana,helvetica,sans-serif; font-size: 8pt;"><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: "winpcap-users-request@winpcap.org" <winpcap-users-request@winpcap.org><br>To: winpcap-users@winpcap.org<br>Sent: Friday, 20 April, 2007 5:30:50 PM<br>Subject: Winpcap-users Digest, Vol 25, Issue 14<br><br><div>Send Winpcap-users mailing list submissions to<br> winpcap-users@winpcap.org<br><br>To subscribe or
unsubscribe via the World Wide Web, visit<br> <a target="_blank" href="https://www.winpcap.org/mailman/listinfo/winpcap-users">https://www.winpcap.org/mailman/listinfo/winpcap-users</a><br>or, via email, send a message with subject or body 'help' to<br> winpcap-users-request@winpcap.org<br><br>You can reach the person managing the list at<br> winpcap-users-owner@winpcap.org<br><br>When replying, please edit your Subject line so it is more specific<br>than "Re: Contents of Winpcap-users digest..."<br><br><br>Today's Topics:<br><br> 1. Problem with threading (Avelino Martins)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Thu, 19 Apr 2007 21:18:42 +0000<br>From: Avelino Martins <martins_ajc@msn.com><br>Subject: [Winpcap-users] Problem with threading<br>To: <winpcap-users@winpcap.org><br>Message-ID:
<BAY117-W18EBF90F0362E266B52C688C570@phx.gbl><br>Content-Type: text/plain; charset="iso-8859-1"<br><br>Hello all, <br>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 <br>pcap_findalldevs() hanging when called from a child thread, take the simple example:<br> <br>#include <pcap.h><br>#pragma comment(lib, "Wpcap.lib")<br> <br>void GetINetDevice()<br>{<br> pcap_if_t* alldevs;<br> char errbuf[PCAP_ERRBUF_SIZE+1];<br> <br> /* Retrieve the device list */<br> if(pcap_findalldevs(&alldevs, errbuf) == -1)<br> {<br> printf("Error in pcap_findalldevs: %s\n", errbuf);<br> exit(1);<br> }<br> // Could
not create thread<br> MessageBox(NULL, "Sucess","",MB_OK);<br> <br> // Free the device list <br> pcap_freealldevs(alldevs);<br>}<br> <br> <br>int main()<br>{ <br> DWORD m_dwThreadID;<br> HANDLE m_hThread;<br> m_hThread = CreateThread(0,<br> 0,<br>
(LPTHREAD_START_ROUTINE)GetINetDevice,<br> NULL,<br> 0,<br> &m_dwThreadID);<br> if(!m_hThread)<br>
{<br> // Could not create thread<br> MessageBox(NULL, "Thread error","",MB_OK);<br> }<br> return 0;<br>}<br> <br>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?<br> <br>Best Regards<br>_________________________________________________________________<br>Veja mais. Partilhe mais. Experimente o Windows Live Messenger beta gratuitamente<br><a target="_blank" href="http://ideas.live.com/programpage.aspx?versionId=0eccd94b-eb48-497c-8e60-c6313f7ebb73">http://ideas.live.com/programpage.aspx?versionId=0eccd94b-eb48-497c-8e60-c6313f7ebb73</a><br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: <a target="_blank"
href="http://www.winpcap.org/pipermail/winpcap-users/attachments/20070419/d60d9c04/attachment.html">http://www.winpcap.org/pipermail/winpcap-users/attachments/20070419/d60d9c04/attachment.html</a><br><br>------------------------------<br><br>_______________________________________________<br>Winpcap-users mailing list<br>Winpcap-users@winpcap.org<br><a target="_blank" href="https://www.winpcap.org/mailman/listinfo/winpcap-users">https://www.winpcap.org/mailman/listinfo/winpcap-users</a><br><br><br>End of Winpcap-users Digest, Vol 25, Issue 14<br>*********************************************<br></div></div><br></div></div><br>
<hr size=1></hr>
Check out what you're missing if you're not on <a href="http://us.rd.yahoo.com/mail/in/ymessenger/*http://in.messenger.yahoo.com/">Yahoo! Messenger</a> </body></html>