Microsoft KB Archive/167969

From BetaArchive Wiki
Knowledge Base


Article ID: 167969

Article Last Modified on 11/1/2006



APPLIES TO

  • Microsoft Windows NT Server 4.0, Terminal Server Edition
  • Microsoft Windows NT Workstation 4.0 Developer Edition
  • Microsoft Windows NT Server 4.0 Standard Edition



This article was previously published under Q167969

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.

RESOLUTION

To resolve this problem, obtain the latest service pack for Windows NT 4.0 or Windows NT Server 4.0, Terminal Server Edition. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

152734 How to Obtain the Latest Windows NT 4.0 Service Pack




STATUS

Microsoft has confirmed that this is a problem in Windows NT 4.0 and Windows NT Server 4.0, Terminal Server Edition. This problem was first corrected in Windows NT 4.0 Service Pack 4.0 and Windows NT Server 4.0, Terminal Server Edition Service Pack 4.


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: kbhotfixserver kbqfe kb3rdparty kbbug kbfix KB167969