Registry (Windows CE 5.0)
The Windows CE registry stores data about applications, drivers, user preferences, and other configuration settings. The registry is organized in a hierarchical system of keys and values. A key is similar to a directory and can contain values and other keys. Windows CE supports four root keys.
The following table shows the four root keys that Windows CE supports, and what type of data you should store under those keys.
Key name | Contains |
---|---|
HKEY_LOCAL_MACHINE | Hardware and driver configuration data |
HKEY_CURRENT_USER | User configuration data |
HKEY_CLASSES_ROOT | OLE and file-type matching configuration data |
HKEY_USERS | Stores data that applies to all users |
The basic piece of data that is stored in the registry is called a value. A value can be a variety of types, including string or binary. Each value has a name and an associated piece of data. For example, a device that is running the Windows CE Handheld PC, Professional Edition, software uses the value name Wrap to Window in the HKEY_LOCAL_MACHINE\Software\Microsoft\Pocket Word\Settings key to store an integer piece of data.
The following table shows the different limits in the registry.
Limit | Description |
---|---|
Key or value name length | 255 characters |
Data size | 4 KB |
Key hierarchy depth | Up to 16 nested subkeys |
When programming with the registry, try to keep name and data size small. Note that registry values in Windows CE take up less memory than registry keys. Design your registry hierarchy to use as few keys as possible.
The Windows CE registry exports the Win32 registry functions for applications to call to record and access run-time and other data. Use the registry to store data that your application needs for each session. For example, you can save the state of your application during the shutdown process. Upon startup, your application can reinstate the previous settings.
The registry is also used for system initialization and is always present in RAM. Effective with version 2.10, the registry can be loaded from and stored to another persistent storage device. As of Windows CE .NET 4.0, a registry option exists to allow the registry to exist as a file on any file system.
Note Windows CE provides the option to implement the registry as a RAM-based heap file. However, if the RAM loses power, the registry data can be lost if the OEM has not implemented a registry backup procedure. Windows CE then must reload the initial registry from ROM.
See Also
Registry Fundamentals | Advanced Registry Concepts
Send Feedback on this topic to the authors