BUG: Printer Port Redirection Not Effective for Windows Apps

ID: Q152788

The information in this article applies to:

SYMPTOMS

Changing the redirection of an MS-DOS LPT device that is used by Windows fails. This problem occurs when using the WNetCancelConnection and WNetAddConnection functions to change a previously-redirected LPT port. Although the functions succeed and Windows reports the new device redirection, any Windows printer driver using the device continues to print to the original remote printer.

Similar behavior occurs if the Capture Printer Port feature is used in the printer properties dialog. Any attempt to change a printer port's connection to a different remote printer will appear to succeed but the print jobs arrive at the original remote printer.

This problem occurs only with Windows applications. MS-DOS applications executed within a console or "DOS" box are not affected by this problem and their output will be properly directed to the network print share for the LPTX device.

RESOLUTION

To work around this problem, do not use WNetAddConnection and MS-DOS devices to connect Windows printer drivers to network print shares. Instead, configure Windows printers to use print shares directly via network ports. This behavior is accomplished by using the Print Spooler functions: OpenPrinter, GetPrinter, SetPrinter, ClosePrinter, EnumPorts, and AddPort. Continue to use the WNet functions in Windows to redirect MS-DOS devices for MS-DOS applications.

The Print Spooler is a new feature of Windows 95 and Windows NT. For more information on using the Print Spooler APIs to configure network printers, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q152551
   TITLE     : How to Connect Local Printers to Network Print Shares

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

Additional query words:

Keywords          : kbnetwork kbAPI kbSDKPlatform kbWinOS95bug kbWNet kbGrpNet 
Issue type        : kbbug

Last Reviewed: July 31, 1998