I am developing a .NET application (running on Windows 7) that communicates with multiple serial devices from various vendors. I want to be able to uniquely identify the devices and create a device to COM port mapping so in case the devices are re-enumerated to a different COM number I’ll be able to identify a new mapping before I attempt to use the device/s.
I have been looking at the WMI library but wasn’t able to run a query that can show all the devices (using WIN32_SerialPorts or Win32_PnPDevice), however device manager is shoing all.
I also tried to use SetupDiEnumDeviceInterfaces and SetupDiGetDeviceInterfaceDetail calls using setupapi.dll but wasn’t able to get it to work.
Does anyone have a working example of something similar I will be able to use? Any suggestions on how to do this?