Share via


IRAPISession::CeReadFile (Windows Embedded CE 6.0)

1/6/2010

This method reads data from a file on a remote Windows Embedded CEā€“based device. The read operation starts the position indicated by the file pointer. After the read operation has been completed, the file pointer is adjusted by the number of bytes actually read.

Syntax

BOOL CeReadFile ( 
  HANDLE hFile, 
  LPVOID lpBuffer, 
  DWORD nNumberOfBytesToRead, 
  LPDWORD lpNumberOfBytesRead, 
  LPOVERLAPPED lpOverlapped 
);

Parameters

  • hFile
    [in] Handle to the file to be read. The file handle must have been created with GENERIC_READ access to the file. This parameter cannot be a socket handle.
  • lpBuffer
    [out] Pointer to the buffer that receives the data read from the file.
  • nNumberOfBytesToRead
    [in] Number of bytes to be read from the file.
  • lpNumberOfBytesRead
    [out] Pointer to the number of bytes read. IRAPISession::CeReadFile sets this value to zero before doing any work or error checking.
  • lpOverlapped
    [in] Unsupported; set to NULL.

Return Value

The IRAPISession::CeReadFile method returns when the number of bytes requested has been read or an error occurs.

Nonzero indicates success. Zero indicates failure. If the return value is nonzero and the number of bytes read is zero, the file pointer was beyond the end of the file at the time of the read operation. To get extended error information, call IRAPISession::CeGetLastError and IRAPISession::CeRapiGetError.

Remarks

If part of the file is locked by another process and the read operation overlaps the locked portion, this method fails.

Accessing the input buffer while a read operation is using the buffer may lead to corruption of the data read into that buffer. Applications must not read from, write to, reallocate, or free the input buffer that a read operation is using until the read operation completes.

The IRAPISession::ReadFile function may fail and return ERROR_INVALID_USER_BUFFER or ERROR_NOT_ENOUGH_MEMORY whenever there are too many outstanding asynchronous I/O requests.

When a synchronous read operation reaches the end of a file, IRAPISession::ReadFile returns TRUE and sets *lpNumberOfBytesRead to zero. Windows Embedded CE does not support asynchronous read operations on files.

Requirements

Header rapi2.h
Library ole32.lib, rapiuuid.lib
Windows Embedded CE Windows Embedded CE 6.0 and later

See Also

Reference

IRAPISession
IRAPISession::CeCreateFile
IRAPISession::CeFindAllFiles