I have an application that looks for a specific FTDI serial port with customised USB descriptors. My current code uses the example from Code Project, which searches the MSSerial_PortName WMI table under root\WMI, and pulls out extra USB information from root\CIMV2\WIN32_PnPEntity.
This worked well under XP, but the application must also run under a standard user onWindows 7. In this environment access of root\WMI results in an “Access Denied” ManagementException.
Can anybody suggest a way to cross reference the DOS device name of a serial port to the USB information, while running as a standard user? So far I’ve looked at the root\CIMV2\WIN32_SerialPort* tables, but they only contain motherboard ports. I’ve also considered using SetupAPI, but I haven’t found a complete and working PInvoke template for this.
I’ve discovered an answer suitable for our case, though not a generic one. Our USB converters are all FTDI, and FTDI provide a DLL that handles this. My code using the DLL is below: