Port and language monitor function prototypes and structure definitions can be found in the Windows NT DDK winsplp.h include file.
The following table contains the print monitor API and implementation requirements on a per-monitor basis. InitializePrintMonitor and DllEntryPoint are the only two functions that a monitor’s DLL must export; the spooler accesses all other functions through the function table returned by InitializePrintMonitor. For this reason, except for InitializePrintMonitor and DllEntryPoint, the names of all other required functions are pseudonames that can, in fact, have any name that the monitor developer wishes.
Implement?* | ||||
Function Name | Description | PM | LM | LMPM |
InitializePrintMonitor | Initializes the print monitor. | X | X | X |
DllEntryPoint | Entry function; called when the spooler loads a monitor’s DLL with the Win32 LoadLibrary function. | X | X | X |
OpenPort | Opens a port for a newly connected printer. | X | – | X |
OpenPortEx | Opens a port for a newly connected printer. | – | X | X |
ClosePort | Closes a port when there are no printers connected to it. | X | X | X |
StartDocPort | Performs the tasks required to start a print job on a port. | X | X | X |
WritePort | Writes data to a printer port. | X | X | X |
ReadPort | Reads data from a printer port. | X | X | X |
EndDocPort | Performs end-of-print-job tasks on a port. | X | X | X |
AddPort or AddPortEx | Creates a port. | X | – | X |
DeletePort | Deletes a port. | X | – | X |
EnumPorts | Enumerates the ports available for printing on a server. | X | – | X |
ConfigurePort | Performs port configuration. | X | – | X |
SetPortTimeOuts | Sets a time-out value on an open port. | o | – | o |
GetPrinterDataFromPort | Gets data from a bidirectional printer by providing IEEE 1284 support. | o | o | o |
* X = required; – = do not implement, o = optional |
To perform the basic requirements of monitoring printers connected to ports and sending print job data through ports, all print monitors must implement the following functions:
InitializePrintMonitor | StartDocPort |
DllEntryPoint | WritePort |
OpenPort or OpenPortEx | ReadPort |
ClosePort | EndDocPort |
For information on DllEntryPoint, see the Win32 SDK.
Port monitors and LMPMs are required to implement the print monitor functions that perform port management. These functions are:
AddPort or AddPortEx | EnumPorts |
DeletePort | ConfigurePort |
Because port management is the port monitor’s responsibility, a pure language monitor should not implement any of these routines.
The remaining functions of the print monitor API, SetPortTimeouts and GetPrinterDataFromPort, can be optionally implemented by port monitors and LMPMs. Pure language monitors can implement GetPrinterDataFromPort, but should not implement SetPortTimeouts because it is a port management function.