Under Windows NT, Win16 Applications Opening MS-DOS Devices Fail

Last reviewed: September 25, 1997
Article ID: Q167969
The information in this article applies to:
  • Microsoft Windows NT Workstation version 4.0
  • Microsoft Windows NT Server version 4.0

SYMPTOMS

Under certain circumstances, data written to LPT1 from a 16-bit Windows application running under Windows NT can corrupt other files. This corruption occurs when the application opens any MS-DOS device (as listed by MEM /D; for example, LPT1, COM1, CON, and so on) through the _lopen() RTL function and opens other data files. When the application writes data out through the LPT1 handle, the data is misrouted to one of the other files.

CAUSE

Some devices are handled internally by NTDOS without calling on the Win32 I/O system directly. For example, LPT1 is handled by calling the Windows NT emulated BIOS, which in turn uses OUT instructions to feed the data to the emulated LPT1 port. In this case, WOW mishandles several Interrupt 21 calls, including read file and write file, trying to pass these calls to Win32 but using an uninitialized bit of memory instead of a valid Win32 file handle. In some cases, this uninitialized memory will contain a value that is a valid handle value in the WOW process, and the data will be read from or written to that file instead of the intended device. In other cases, the Win32 file API fails because the handle is invalid.

STATUS

Microsoft has confirmed this to be a problem in Windows NT version 4.0. A supported fix is now available, but has not been fully regression-tested and should be applied only to systems experiencing this specific problem. Unless you are severely impacted by this specific problem, Microsoft recommends that you wait for the next Service Pack that contains this fix. Contact Microsoft Technical Support for more information.

MORE INFORMATION

It is highly irregular for a 16-bit Windows application to write to LPT1 through MS-DOS; the entire Windows 3.1/Windows 95 GUI will stop responding if the printer is slow or out of paper. The correct way would be to use OpenComm() and WriteComm(), which perform the write in the background (using an interrupt service routine) instead of blocking the computer (or WOW in this case) until the write completes.

Keywords          : kbbug4.00 nt16ap NTSrvWkst kb3rdparty kbbuglist
Version           : WinNT:4.0
Platform          : winnt
Hardware          : x86
Issue type        : kbbug
Solution Type     : kbfix


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 25, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.