U S B
1 Dialog program to scan for USB devices


download the exe program
download the source code
void CUSBV6Dlg::OnButScan() 
{
	SearchAllUsbDevices();
	m_strText.Format("%s",bufout);  
	UpdateData(false);
}



void CUSBV6Dlg::SearchAllUsbDevices()
{

SP_DEVINFO_DATA devInfo;
  HDEVINFO		  devs;
  DWORD devIndex, nr;
  char buffer[264];
  

  devs = SetupDiGetClassDevs(0, 0, 0, DIGCF_PRESENT | DIGCF_ALLCLASSES);
  if(devs == INVALID_HANDLE_VALUE) return;

  ptrx = bufout;
  devInfo.cbSize = sizeof(devInfo);

  for(devIndex = 0; SetupDiEnumDeviceInfo(devs,devIndex,&devInfo); devIndex++)
  {
    if(SetupDiGetDeviceRegistryProperty(devs, &devInfo, SPDRP_DEVICEDESC, 0, (BYTE*) buffer, 264, &nr)) 
	{
    if(strstr(buffer,"USB"))
		{
		ptrx+= sprintf(ptrx,"%-60s   ",buffer);	
			if(SetupDiGetDeviceRegistryProperty(devs, &devInfo, SPDRP_FRIENDLYNAME, 0, (BYTE*) buffer, 264, &nr)) 
			{
			ptrx+= sprintf(ptrx,"%-40s  ",buffer);	
			}

			if(SetupDiGetDeviceInstanceId(devs, &devInfo, buffer, 264, &nr))
			{
			ptrx += sprintf(ptrx,"%s%c%c",buffer,0x0D,0x0A);	
			}
		}
	}
  }
  SetupDiDestroyDeviceInfoList(devs);
}

2 Enumerate Host controllers


download the exe program
download the source code