[Winpcap-users] Different Adaptor list when using initilize COM using Mulitithreads....

Ravi Sankar s_rsy at yahoo.com
Tue Oct 10 11:44:52 GMT 2006


Hello All
   
  I am comming accross a strange behaviour in getting list of adaptors.
   
  My code 
   
  // Function to get list of adaptors
  pcap_if_t* GetAllDevices () {
  pcap_if_t *l_pAllDevs;
  char errbuf[PCAP_ERRBUF_SIZE];
  if (pcap_findalldevs_ex (PCAP_SRC_IF_STRING, NULL, &l_pAllDevs, errbuf) == -1) {
  return NULL;
  } 
  return l_pAllDevs;
  }
   
  // code which uses the above function to get list
   
  pcap_if_t *l_Devices = NULL, *d = NULL;
  CString l_strTemp;
  int l_iCount = 1;
  l_Devices = GetAllDevices ();
  
  for(d=l_Devices; d; d=d->next)
  {
  l_strTemp.Format ("%d - %s", l_iCount++, d->description);
  ((CComboBox*)GetDlgItem (IDC_COMBO1))->AddString (l_strTemp);
  }
   
   
   
  If I use the above code BEFORE calling 
  HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
   
  I am getting 2 adaptors 
  1 - "Network adapter 'Generic dialup adapter' on local host"
  2 - "Network adapter 'Broadcom NetXtreme Gigabit Ethernet Driver (Microsoft's Packet Scheduler) ' on local host"
   
  same code if i call AFTER calling 
  HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
   
  I am getting 1 adaptor 
  1 - "Network adapter 'Broadcom NetXtreme Gigabit Ethernet Driver (Microsoft's Packet Scheduler) ' on local host"
   
  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. 
   
  My clarrifications
  1) Can I use pcap_findalldevs_ex in MULTTHREADED environment?
  2) what is this "Generic Dialup Adaptor"?
  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)
   
  Thanks for your time,
  Ravi 

 		
---------------------------------
Stay in the know. Pulse on the new Yahoo.com.  Check it out. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20061010/b146c959/attachment-0001.htm


More information about the Winpcap-users mailing list