Microsoft KB Archive/69803

PRINT Requires a Well-Formed Pathname ID Number: Q69803

4.00 4.01 MS-DOS

Summary: According to page 1428 in the “MS-DOS Encyclopedia” (Microsoft Press), when submitting files to the PRINT.COM spooler terminate-and-stay-resident (TSR) program via the INT 2F interface it is required that the name of the file be a fully qualified pathname. Submitting a partial pathname can cause the spooler to hang.

More Information:

The MS-DOS Print command consists of two sections; the transient portion and the resident portion. The resident code installs itself into memory and attaches to the timer so that it can feed data out the printer port. The transient portion handles the parsing of the command line and processing the submission of files to the resident portion, and then is removed from memory.

The Print command’s transient portion processes the filenames offered on the command line for submission to ensure that they are well-formed pathnames. Once the pathname has been verified, the transient portion of the Print command will submit the fully qualified pathname to the resident portion.

The resident portion also offers an interface for print job submission that is independent of the Print command’s transient code. This interface allows application programs to submit a print job directly. When using this interface, the pathname for the submitted file MUST be formed properly, and the file MUST exist. The resident portion of the Print command does no checking for invalid filenames. The file handling code within the spooler assumes that the filename is correct, and if it is not, it may hang the system.