I have some legacy code that provides a list of the available COM ports on the PC by calling the EnumPorts() function and then filtering for the port names that start with \
It appears that it's not a simple task. Check out this: EnumSerialPorts v1.20