Microsoft KB Archive/891900

= The ReadFile function returns the buffer size as the number of bytes that are read in Windows CE Platform Builder 4.2 =

Article ID: 891900

Article Last Modified on 3/25/2005

-

APPLIES TO


 * Microsoft Windows CE Platform Builder 4.2

-





SYMPTOMS
In Microsoft Windows CE Platform Builder 4.2, the ReadFile function returns the buffer size as the number of bytes that are read. For example, if you set the nNumberOfBytesToRead parameter of the ReadFile function to 100 bytes, the lpNumberOfBytesRead value is also 100 bytes. This behavior occurs even if the transferred data is 10 bytes.



CAUSE
This problem occurs because there is a coding problem in the %WINCEROOT%\Public\Common\Oak\Drivers\Usb\Hcd\Ohcd2\Cpipe.cpp file.



RESOLUTION
To resolve this problem, modify the %WINCEROOT%\Public\Common\Oak\Drivers\Usb\Hcd\Ohcd2\Cpipe.cpp file. To do this, follow these steps:  Locate and then open the %WINCEROOT%\Public\Common\Oak\Drivers\Usb\Hcd\Ohcd2\Cpipe.cpp file for editing.  Locate the following lines of code: // expected and if the last TD in the transfer is the short one. // We could assert here that this was an IN transfer. int iLast = m_transfer.numTDsComplete - 1;   Modify the code so that it looks similar to the following: // expected and if the last TD in the transfer is the short one. // We could assert here that this was an IN transfer. int iLast = m_transfer.numTDsComplete - 1; if ((m_usbEndpointDescriptor.bmAttributes & USB_ENDPOINT_TYPE_MASK) == USB_ENDPOINT_TYPE_CONTROL ) iLast--;  Save the changes.

Keywords: kbtshoot kbprb KB891900

-

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

© Microsoft Corporation. All rights reserved.