Microsoft KB Archive/312151

= PRB: Serial MDD Driver Does Not Properly Close Port When Process Quits Unexpectedly =

Article ID: 312151

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Encarta Reference Suite 2001

-



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\ \ \CE\ 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.

Additional query words: com_mdd serial port close

Keywords: kbfix kbprb KB312151

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.