I managed to extract the device path of all connected USB devices on my computer using SetupDiGetDeviceInterfaceDetail. They usually look like the following:
\\?\hid#vid_0461&pid_4d15#6&219e7220&1&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Given this, what's the cleanest way of extracting vid (0461), pid (4d15) and serial number (6&219e7220&1&0000)?
I thought about using IndexOf(vid_) and reading 4 characters from there (similarly for others as well), but this solution looks pretty dirty.
Or is there a known Win32 API that extracts that information nicely without having to parse that info?