PRB: Serial MDD Driver Does Not Properly Close Port When Process Quits Unexpectedly (312151)
The information in this article applies to:
- Microsoft Windows CE Platform Builder 3.0
This article was previously published under Q312151 SYMPTOMS
When a process that opens a serial port from a secondary thread quits unexpectedly, the serial MDD driver does not properly close the port. As a result, you cannot use the serial port again until you restart the computer. This behavior can occur if you use the COM_MDD implementation of the MDD serial port with your platform.
NOTE: The new serial MDD implementation, COM_MDD2, does not exhibit this behavior.
CAUSE
The COM_MDD implementation of the MDD serial port, in its ProcessExiting function, mistakenly decrements the internal port-open counter, pSerialHead->OpenCnt. As a result, the COM_Close function assumes that the port is not open and therefore skips the code that closes the port.
RESOLUTION
To resolve this issue, follow these steps:
- Create a backup copy of MDD.C.
MDD.C can be found in the following location:
Wince300\Public\Common\Oak\Drivers\Serial
-
Modify the implementation of the ProcessExiting function in MDD.C at line 1123 by commenting the --(pSerialHead->OpenCnt); statement, as follows:
Before modification:
line 1122: if ( pSerialHead->OpenCnt ) {
line 1123: --(pSerialHead->OpenCnt);
After modification:
line 1122: if ( pSerialHead->OpenCnt ) {
line 1123: // --(pSerialHead->OpenCnt);
-
In Platform Builder 3.0, open your platform project. On the Build menu, click Open Build Release Directory.
-
In the Build Command window, navigate to the Wince300\Public\Common\Oak\Drivers\Serial directory. Issue a build -c command.
MDD.C is compiled and linked, and the COM_MDD.LIB and COM_MDD.PDB files in the Wince300\Public\Common\Oak\Lib\processor family\processor\CE\build type directory are updated.
-
On the Platform Builder 3.0 Build menu, click Clean, and then click Rebuild Platform.
Your platform is rebuilt and an updated version of the Serial.dll file is included in your image.
| Modification Type: | Minor | Last Reviewed: | 8/18/2005 |
|---|
| Keywords: | kbfix kbprb KB312151 |
|---|
|