The ReadFile function returns the buffer size as the number of bytes that are read in Windows CE Platform Builder 4.2 (891900)
The information in this article applies to:
- Microsoft Windows CE Platform Builder 4.2
SYMPTOMSIn 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.CAUSEThis problem occurs because there is a coding problem in the %WINCEROOT%\Public\Common\Oak\Drivers\Usb\Hcd\Ohcd2\Cpipe.cpp file.RESOLUTIONTo 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.
Modification Type: | Major | Last Reviewed: | 3/25/2005 |
---|
Keywords: | kbtshoot kbprb KB891900 kbAudDeveloper |
---|
|