Microsoft KB Archive/152788

{|
 * width="100%"|

BUG: Printer Port Redirection Not Effective for Windows Apps

 * }

Q152788

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface
 * Microsoft Windows 95

-

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:

"Q152551 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 kbOSWin95bug kbWNet kbGrpDSNet

Issue type : kbbug

Technology :