BUG: UngetCommChar() Causes Character Loss or GP FaultsLast reviewed: January 5, 1995Article ID: Q100183 |
The information in this article applies to:
SYMPTOMSAn application that uses the UngetCommChar() function in Microsoft Windows version 3.1 loses characters or experiences general protection (GP) faults.
CAUSEThe ReadComm() function does not correctly account for a character buffered by UngetCommChar().
RESOLUTIONThere are two methods to avoid this problem:
STATUSMicrosoft has confirmed this to be a bug in Microsoft Windows version 3.1. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATIONThe UngetCommChar() function places a character into a single character- holding variable. When ReadComm() is subsequently called, the character is copied from the holding variable to the application's buffer before any new characters are read from the comm driver. If version 3.0 of the comm driver is installed, ReadComm() transfers the remaining characters from the comm driver one character at a time by calling the comm driver exported function RECCOM. During this process, the application buffer pointer and character count variables are correctly incremented and decremented, respectively. However, if version 3.1 of the comm driver is installed, ReadComm() transfers the remaining characters from the comm driver by a single call to the comm driver exported function READCOMMSTRING. During this process, the application buffer pointer is correctly incremented after copying the character from the UngetCommChar() holding variable, but the character count is not correctly decremented. This results in one extra character being copied from the comm driver into the application's buffer. The extra character is "lost" because the application is not aware that an extra character has been read. This can also cause a GP fault if copying an extra character to the application's buffer exceeds the buffer segment limit. This problem occurs only on the first ReadComm call that follows an UngetCommChar() call. This problem never occurs if UngetCommChar() is never called.
|
Additional reference words: buglist3.10 3.10 gpf gp-fault
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |