Typically, on a PC, there is some non-standard set of COM ports available for use by a terminal emulator. I would like to be able to scan ports COM1-COM32 to see which (if any) of those ports can be opened as a serial port. I can do this be simply calling CreateFile() on all those ports; however, then I actually have to open/close (and affect DTR/RTS) the port momentarily.
I want to provide an accurate list to the user of the ports that are available. The problem is that I don't want to affect the DTR/RTS lines of the ports that are not currently being used because there may be hardware connected to those ports that does not want to see any transition on DTR/RTS.
Is there a way to just ask the question: "Will CreateFile() succeed?" on specified com ports?