다음을 통해 공유


CeReadRecordProps (RAPI) (Windows CE 5.0)

Send Feedback

This function reads properties from the current record.

CeReadRecordProps is a remote application interface (RAPI), which enables an application running on a desktop computer to make function calls on a Windows CE–based device.

CEOIDCeReadRecordProps(HANDLEhDbase, DWORDdwFlags, LPWORDlpcPropID, CEPROPID* rgPropID, LPBYTE* lplpBuffer, LPDWORDlpcbBuffer);

Parameters

  • hDbase
    [in] Handle to an open database. The database must have been opened by a previous call to the CeOpenDatabase (RAPI) function.
  • dwFlags
    [in] Specifies a bitmask of read flags. It is the following value.
    Value Description
    CEDB_ALLOWREALLOC The LocalAlloc function was used to allocate the buffer specified by the lplpBuffer parameter, and the server can reallocate the buffer if it is not large enough to hold the requested properties.
  • lpcPropID
    [in] Pointer to the number of property identifiers in the array specified by the rgPropID parameter. If rgPropID is NULL, this parameter receives the number of properties retrieved.
  • rgPropID
    [in] Pointer to an array of property identifiers for the properties to be retrieved. If this parameter is NULL, CeReadRecordProps (RAPI) retrieves all properties in the record.
  • lplpBuffer
    [out] Pointer to a long pointer to a buffer that receives the requested properties. If the dwFlags parameter includes the CEDB_ALLOWREALLOC flag, the buffer may be reallocated if necessary. If the CEDB_ALLOWREALLOC flag is specified and the content of lplpBuffer is NULL, the server uses the LocalAlloc function to allocate a buffer of the appropriate size in the caller's address space and returns a pointer to the buffer. Note that if the CEDB_ALLOWREALLOC flag is specified, it is possible for the value of this pointer to change even on failure. For example, the old memory might be freed and the allocation might then fail, leaving the pointer set to NULL.
  • lpcbBuffer
    [out] Long pointer to a variable that contains the size, in bytes, of the buffer specified by the lplpBuffer parameter. When CeReadRecordProps (RAPI) returns, lpcbBuffer receives a value that indicates the actual size of the data copied to the buffer. If the buffer was too small to contain the data, this parameter can be used to calculate the amount of memory to allocate for the buffer if CEDB_ALLOWREALLOC was not specified.

Return Values

The object identifier of the record from which the function read indicates success. Zero indicates failure. To get extended error information within a RAPI program, call CeGetLastError. Possible values for CeGetLastError include the following.

Value Description
ERROR_INVALID_PARAMETER A parameter was invalid.
ERROR_NO_DATA None of the requested properties was found. The output buffer and the size are valid.
ERROR_INSUFFICIENT_BUFFER The specified buffer was not large enough, and the reallocation failed — if the CEDB_ALLOWREALLOC flag was specified. The lpcbBuffer parameter contains the required buffer size.
ERROR_KEY_DELETED The record that was about to be read was deleted by another thread. If the current record was reached as a result of an autoseek, this error is not returned, and the next record is returned.
ERROR_NO_MORE_ITEMS The current seek pointer is at the end of the database.

Remarks

The CeReadRecordProps(RAPI) function reads the specified set of properties from the current record. If the database was opened with the autoseek flag — that is, if the dwFlags parameter of CeOpenDatabase (RAPI) was set to CEDB_AUTOINCREMENT — CeReadRecordProps (RAPI) increments the seek pointer by one so that the next call reads the next record in the current sort order. That is, if the database was opened with a sort order active, then CeReadRecordProps (RAPI) will return the records in sorted order. If the database was not opened with a sort order active, then the order in which records are returned is not predictable.

When rgPropID is set to NULL, CeReadRecordProps (RAPI) does not return properties in any specific order. When you set rgPropID to NULL, you should use a loop to read the properties returned by CeReadRecordProps (RAPI) and verify the PropID value of each property, rather than assume a specific order.

When rgPropID is non-NULL, the properties are returned in the order they are listed in rgPropID. If a requested property is not present in the record, the wFlags member of CEPROPVAL is set to CEDB_PROPNOTFOUND.

Read all needed properties from the record in a single call. The entire record is stored in a compressed format, and each time a property is read it must be decompressed. All the properties are returned in a single marshaled structure, which consists of an array of CEPROPVAL structures, one for each property requested — or one for each property found if the application set the rgPropID parameter to NULL when calling the function.

If a variable-sized property was requested, such as strings or blobs that are packed in at the end of the array, the pointers in the CEPROPVAL structures point into this marshaled structure. This means that the only memory that must be freed is the original pointer to the buffer passed in to the call. Even if the function fails, it may have allocated memory on the caller's behalf. Free the pointer returned by this function if the pointer is not NULL.

When you are done reading properties, you need to free the memory used by the lplpBuffer buffer with a call to CeRapiFreeBuffer.

Note   Earlier versions of Windows CE assigned object identifiers to objects in other file systems, such as the file allocation table (FAT) file system. These object identifiers were guaranteed to be unique within a volume, but not across multiple volumes. Effective with version 3.0, only objects in the object store have valid, unique object identifiers and the object store is the only volume that can return an object identifier.

Requirements

OS Versions: Windows CE 2.10 and later.
Header: Rapi.h.
Link Library: Rapi.lib.

See Also

RAPI Functions | CeOpenDatabase (RAPI) | CeSeekDatabase (RAPI) | LocalAlloc | CEPROPVAL

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.