Except for remote port deletion, the spooler does not support remote port configuration.
A port monitor’s ConfigurePort implementation depends on the type of port(s) that the monitor supports. For example, if the port is a serial port, ConfigurePort could allow serial port settings, such as baud rate and parity, to be configured. The configuration dialog box from the Control Panel’s Ports applet can be used for serial port configuration. Likewise, a parallel port could allow the transmission retry time-out to be configured, and a network port could allow an address to be configured.
The spooler calls a port monitor’s AddPort or AddPortEx function to create a port and add it to the spooler environment. When the monitor successfully adds a port, the spooler knows that the port is supported by and available for printing through that monitor. Then, when a printer has been associated with this port, the spooler can ask the monitor to open the port for printing.
AddPort allows a port to be added interactively, so it should prompt users to enter the port name in a dialog box on the window associated with hWnd.
A port monitor should ensure that no duplicate port names are added to the spooler environment by validating that the supplied port name is unique for all ports on the machine. It can obtain a list of the machine’s ports by calling the Win32 EnumPorts function. Port names are unique on a per machine basis. A port monitor should also verify that the port is one that it supports.
As stated previously, a port’s setup is done before printers can be associated with it. Likewise, all printers must be disassociated from a port before it can be deleted. An application that attempts to delete a port with which a printer is still associated gets an error.
Port timeouts can be established with the one-time port initializations performed by OpenPort, or by calling a port monitor’s SetPortTimeOuts implementation. To avoid hung or unreasonably delayed port responses, port monitors should always establish reasonable time-outs before actually calling a port.
SetPortTimeOuts can use the Win32 GetCommTimeouts and SetCommTimeouts functions to establish the time-out parameters for a port.