The information about the ports is available with the help of PORT_INFO_*structures, where PORT_INFO_1 structure is supported by all Windows versions and PORT_INFO_2 structure is supported starting with Windows NT. Let's consider these structures:
PORT_INFO_1structure serves as a descriptor of the ports supported by the system, it contains only the name of the port.
PORT_INFO_1 structure contains only one member:
LPTSTR pName - pointer to null-terminated string, which identifies the supported port (e.g., "COM1:", "LPT1:", "FILE", "\\server").
PORT_INFO_2 structure is used to identify the ports supported by the system,in comparison with PORT_INFO_1 this structure supports more parameters.
Members of PORT_INFO_2 structure:
We won't consider PORT_INFO_2 structure in detail here, as it is used for the printer port settings detection.
fCoder © 1998 - 2002