Partager via


CeStreamRead (EDB) (Windows Embedded CE 6.0)

1/6/2010

This function reads data from a stream.

This function does not work with CEDB databases. For more information about CEDB, see CEDB Reference.

Syntax

BOOL CeStreamRead(
  HANDLE hStream,
  LPBYTE lprgbBuffer,
  DWORD cbRead,
  LPDWORD lpcbRead
);

Parameters

  • hStream
    [in] Handle to the stream object. The handle is obtained with the CeOpenStream (EDB) function.
  • lprgbBuffer
    [out] Pointer to the buffer into which data is written as it is read.
  • cbRead
    [in] Number of bytes to read from the stream.
  • lpcbRead
    [out] On return, contains the actual number of bytes read. This value can be less than the value specified by the cbReadparameter. This parameter can be set to NULL.

Return Value

TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError. The following table lists possible values.

Return Value Description

ERROR_INVALID_HANDLE

The hStream parameter is set to NULL or equal to INVALID_HANDLE_VALUE.

ERROR_INVALID_PARAMETER

The lprgbBuffer parameter is set to NULL.

ERROR_KEY_DELETED

The parent record of the stream object has been deleted. This can happen only if the stream object was opened for read access. When a stream is opened for write access, the parent record is locked for write access, which prevents the record from being deleted.

ERROR_NO_MORE_ITEMS

The database from which the stream object was opened had its current record seek position changed. To prevent this, open a stream, perform the operations, and then close the stream before doing anything else on the parent database.

Remarks

When using this function, the data is read from the current seek position of the stream. You can adjust the seek position of a stream with the CeStreamSeek (EDB) function. If the requested amount of data to read, specified by cbRead, cannot be entirely read, this function still succeeds, returning the actual number of bytes read in pcbRead.

To read from a stream, you must have specified the GENERIC_READ flag when opening the stream with CeOpenStream. While a stream is opened for read access, the parent row is not locked, and other threads can make changes to the stream object. Other threads can also make changes to the parent record of the stream object, including deleting the parent record. If a stream is opened for GENERIC_WRITE, the row is locked and, although no other thread can make changes to the stream, other threads can read the old data in the stream. Once the stream that is writing saves its changes, the new data is visible to other threads.

To ensure that a read can examine data without affecting that data by a concurrent write operation, you can protect the read by reading in a transaction at the repeatable read isolation level.

After the read has completed successfully, the current seek position of the stream is incremented by the number of bytes read.

For more information, see Multiuser Support in EDB.

Requirements

Header windbase.h
Library coredll.lib
Windows Embedded CE Windows CE 5.0 and later

See Also

Reference

EDB Functions
CeOpenStream (EDB)

Concepts

Multiuser Support in EDB