Objects and Object Identifiers

Windows CE 3.0

An object is defined as one of the following:

  • a registry key
  • a registry value
  • a file
  • a 4-kilobyte (KB) "chunk" of file data (that is, a 12-KB file will have one "file" object and three 4-KB "chunks," which are also objects)
  • a database record, which can hold up to 4 KB of data
  • an extension of a database record, which can be an additional 4 KB
  • a database
  • a database volume

Windows CE assigns each object in the object store a unique Windows CE object identifier (CEOID). The most common use for a CEOID is to access object data, such as a database record, and to obtain object data.

Because a CEOID is guaranteed to be unique within a volume, but not across multiple volumes, Windows CE also gives each database volume a predefined Windows CE globally unique identifier (CEGUID). Use the CEGUID in conjunction with the CEOIDas a unique reference for each object in the object store and in the database volumes.

Note   Earlier versions of Windows CE assigned object identifiers to objects in other file systems, such as the file allocation table (FAT) file system. Effective with version 2.1, only objects in the object store and database volumes have valid, unique object identifiers.

Obtaining the object identifier of an object is the first step in accessing or manipulating any information about that object. The following table shows where to obtain the Windows CE object identifier for the various types of objects in the object store.

Object type Where to obtain the Windows CE object identifier
Directory or file In the dwOID member of the WIN32_FIND_DATA structure, which is returned by the FindFirstFile and FindNextFile functions. Also, in the dwOID member of the BY_HANDLE_FILE_INFORMATION structure, which is returned by the GetFileInformationByHandle function.
Database In the return value of the CeCreateDatabaseEx or CeFindNextDatabaseEx function.
Database record In the return value of the CeSeekDatabase, CeReadRecordPropsEx, or CeWriteRecordProps function.
Mounted database volume The CeMountDBVol and CeEnumDBVolume functions return the CEGUID of the mounted database volume.

Use the CeOidGetInfoEx function to return object data that is associated with the Windows CE object identifier. This function returns object data in a CEOIDINFO structure. The wObjType member of CEOIDINFO contains a flag that indicates the object type, such as OBJTYPE_DATABASE for a database object, and also identifies the object structure to use to access the data. CEOIDINFO also contains a member that returns data on either a file, directory, database, or database record. These values correspond to the type of object that is indicated by the wObjType member. For example, using CeOidGetInfoEx on a database of a mounted database volume returns the database name, type identifier, number of records, database size, and sort order in a CEDBASEINFO structure, as well as the OBJTYPE_DATABASE value.

Note   If an object in the object store or a record in a database volume is saved to persistent storage and is then restored, the restored object or record is not guaranteed to have the same OID as the original. An application should not expect OIDs to be immutable during save and restore operations.

Object Identifier Reuse

As described earlier, the number of objects that can exist in the object store was increased to 222, or over four million, effective with version 3.0. Windows CE may reassign freed object identifiers to new objects. However, an object identifier will not be reused for at least 16 object allocations.