views:

22

answers:

1

I want to get the virtual port number of usb driver. This property can be found in device manager name as bus relation or children.

   if (SetupDiGetDeviceRegistryProperty(devInfo,   
                                                 &devInfoData,   
                                                 SPDRP_ADDRESS,   
                                                 NULL,   
                                                 (PBYTE)&dwAddr, //szName,   
                                                 sizeof(dwAddr),   
                                                 NULL))   
            {   

            int len=_stprintf( szBuf2,TEXT("\n%d"), dwAddr);

Can anybody guide.

A: 

If your on Windows Mobile or Windows CE, you should find the active driver in HKEY_LOCAL_MACHINE\drivers\active. Enumerate down the active drivers till you find the USB driver by "Key" and the name of the driver should be its port name, i.e. USB1 or COM8 etc.

JonWillis