Persistent Registry Storage on Block Devices

In addition to database information, linear flash memory cards can store registry information. However, Windows CE cannot use registry information stored in linear flash memory directly. The information must first be copied to the RAM-based registry.

Windows CE versions 2.0 and earlier implement the registry as a RAM-based heap file. However, this means that registry information is lost if power is lost to the platform’s RAM, a circumstance that forces Windows CE to reload the registry from ROM. Windows CE 2.10 provides new functions for saving and restoring registry information to and from any storage location, such as linear flash memory devices. The registry is saved to non-volatile linear flash memory when the platform is turned off and restored when power is restored. The RegCopyFile function saves registry information, and the RegRestoreFile function loads registry information. For full documentation on these two functions, see the Windows CE Platform SDK.

One solution for restoring registry information involves a dual-boot setup of the platform. In this case, the cold boot restores the registry, and a warm boot turns on the system. A warm boot maintains RAM, which means that the restored registry information is available to control the boot sequence. OEMs can provide a special registry cold-boot tool to copy saved registry information from linear flash memory into RAM after the Device Manager loads the TrueFFS. The utility then forces a warm boot of the system.

A single-boot solution is possible if the system uses the internal ROM file system code to restore the registry from its saved location. This is accomplished by using the WriteRegistryToOEM and ReadRegistryFromOEM functions in the platform’s OAL layer. Implementing these two functions can be complex because, at the time they are called, very little system support is present. The Device Manager has not yet been loaded, and no device drivers are available. Therefore, these functions need enough understanding of the external registry storage mechanism to locate and load the registry information without the help of the TrueFFS device driver. For full documentation of WriteRegistryToOEM and ReadRegistryFromOEM, see the Platform Builder.