<div>Hello All</div> <div> </div> <div>I am comming accross a strange behaviour in getting list of adaptors.</div> <div> </div> <div>My code </div> <div> </div> <div>// Function to get list of adaptors</div><FONT size=2> <div>pcap_if_t* GetAllDevices () {</div> <div>pcap_if_t *l_pAllDevs;</div> <div></FONT><FONT color=#0000ff size=2>char</FONT><FONT size=2> errbuf[PCAP_ERRBUF_SIZE];</div> <div></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (pcap_findalldevs_ex (PCAP_SRC_IF_STRING, NULL, &l_pAllDevs, errbuf) == -1) {</div> <div></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> NULL;</div> <div>} </div> <div></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> l_pAllDevs;</div> <div>}</div></FONT> <div> </div> <div>// code which uses the above function to get list</div> <div> </div><FONT size=2> <div>pcap_if_t *l_Devices = NULL, *d = NULL;</div> <div>CString l_strTemp;</div> <div></FONT><FONT
color=#0000ff size=2>int</FONT><FONT size=2> l_iCount = 1;</div> <div>l_Devices = GetAllDevices ();</div> <div></div> <div></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2>(d=l_Devices; d; d=d->next)</div> <div>{</div> <div>l_strTemp.Format ("%d - %s", l_iCount++, d->description);</div></FONT><FONT color=#000000 size=2> <div>((CComboBox*)GetDlgItem (IDC_COMBO1))->AddString (l_strTemp);</div></FONT><FONT size=2> <div>}</div> <div> </div> <div> </div> <div> </div> <div>If I use the above code <STRONG>BEFORE </STRONG>calling </div><FONT size=2> <div>HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);</div> <div> </div> <div>I am getting 2 adaptors </div> <div>1 - "Network adapter 'Generic dialup adapter' on local host"</div> <div>2 - "Network adapter 'Broadcom NetXtreme Gigabit Ethernet Driver (Microsoft's Packet Scheduler) ' on local host"</div> <div> </div> <div>same code if i call <STRONG>AFTER</STRONG>
calling </div> <div>HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);</div> <div> </div> <div>I am getting 1 adaptor </div> <div>1 - "Network adapter 'Broadcom NetXtreme Gigabit Ethernet Driver (Microsoft's Packet Scheduler) ' on local host"</div> <div> </div> <div>Rest of packet capturing is working fine, I am facing issue in getting number of adaptors only. In My application I have to Initilize COM with MULTITHREAD. i can not avoid that. </div> <div> </div> <div>My clarrifications</div> <div>1) Can I use <FONT size=2>pcap_findalldevs_ex in MULTTHREADED environment?</FONT></div><FONT size=2> <div>2) what is this "Generic Dialup Adaptor"?</div> <div>3) It is good that I get only Ethernet adaptors in list. End user will not get confused with other adaptors. It raises another doubt, whether it can detect multiple Ethernet cards if present in a PC? (I don't have a PC where 2 Ethenet adaptors are used, so i could not
test)</FONT></div> <div> </div> <div>Thanks for your time,</div> <div>Ravi </div></FONT></FONT><p> 
                <hr size=1>Stay in the know. Pulse on the new Yahoo.com. <a href="http://us.rd.yahoo.com/evt=42974/*http://www.yahoo.com/preview"> Check it out.</a>