Hi Gianluca, Thank you _very_ much. The problem was fixed by adding CoInitialize(NULL) and CoUninitialize in my thread.
Everyone using the TSnoop component suite for Delphi should beware of that this suite doesn't call CoInitialize and furthermore opens the adapter in the main-thread and uses pcap_next_ex in a different packet-receiver-thread. On WindowsXP everything is working as expected, but on Windows2k you have a new random device :)... It works sometimes, sometimes not. Thank you again. This should surely go into the FAQ. Regards /Marc PS: Shouldn't you use CoInitializeEx(0, COINIT_APARTMENTTHREADED) in wanpacket.cpp??? Or perhaps COINIT_MULTITHREADED? > -----Original Message----- > From: Gianluca Varenni [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 16, 2004 7:12 PM > To: [EMAIL PROTECTED] > Subject: Re: Update: [WinPcap-users] Problems with 3.1b3 and opening > \Device\NPF_GenericNdisWanAdapter > > Hi. > > Is the secondary thread using COM (or better, have you called > CoInitialize(ex) before using pcap_open() on that thread)? > > WinPcap makes use of a COM component internally to capture from NdisWan > adapters, maybe the threading model used by WinPcap is incompatible with > yours. > > Have a nice day > GV > > ----- Original Message ----- > From: "Marc Wetzel" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, June 16, 2004 1:04 PM > Subject: Update: [WinPcap-users] Problems with 3.1b3 and opening > \Device\NPF_GenericNdisWanAdapter > > > > > > As I just found out, this ONLY happens if pcap_open is called from > inside > a > > thread. If I use it only inside main all works as expected. > > > > Clueless... > > > > /Marc > > > > > -----Original Message----- > > > From: Marc Wetzel [mailto:[EMAIL PROTECTED] > > > Sent: Wednesday, June 16, 2004 12:08 PM > > > To: [EMAIL PROTECTED] > > > Subject: [WinPcap-users] Problems with 3.1b3 and opening > > > \Device\NPF_GenericNdisWanAdapter > > > > > > Hi, > > > > > > I have some problems opening the \Device\NPF_GenericNdisWanAdapter > > > Adapter. > > > > > > I tried to open it with pcap_open but also with pcap_open_live but it > > > fails > > > always with > > > Error: "Could not open adapter. System could not find the device." > > > (translated from german error-msg.) > > > > > > The passed device strings were retrieved by pcap_findalldevs(). As far > as > > > I > > > can see in my debugger, > > > The passed string looks ok. > > > > > > Some secondary information: > > > - All other (Ethernet-card) devices work as expected. I can open them, > and > > > all packets are delivered. > > > - Ethereal can open the device \Device\NPF_GenericNdisWanAdapter. Here > are > > > no problems. > > > > > > I also tried various other combinations as explained in the developer > > > documentation > > > I passed a pointer to null (to get the first device). => exception in > > > wpcap.dll > > > I passed rpcap://\Device\NPF_GenericNdisWanAdapter. => same error-msg. > as > > > without rpcap. > > > > > > I wonder what I can do wrong, if one device works and the other one > not??? > > > > > > I'm using WindowsXP,SP1. > > > > > > > > > Thanks in advance > > > > > > Marc > > > > > > > > > > > > ================================================================== > > > This is the WinPcap users list. It is archived at > > > http://www.mail-archive.com/[EMAIL PROTECTED]/ > > > > > > To unsubscribe use > > > mailto: [EMAIL PROTECTED] > > > ================================================================== > > > > > > > > ================================================================== > > This is the WinPcap users list. It is archived at > > http://www.mail-archive.com/[EMAIL PROTECTED]/ > > > > To unsubscribe use > > mailto: [EMAIL PROTECTED] > > ================================================================== > > > > > > > > ================================================================== > This is the WinPcap users list. It is archived at > http://www.mail-archive.com/[EMAIL PROTECTED]/ > > To unsubscribe use > mailto: [EMAIL PROTECTED] > ================================================================== ================================================================== This is the WinPcap users list. It is archived at http://www.mail-archive.com/[EMAIL PROTECTED]/ To unsubscribe use mailto: [EMAIL PROTECTED] ==================================================================
