Simply put the hive based registry is one of the possible ways to provide for registry persistence in a Windows CE system. Persistence is a term used to mean keep the data even after a power loss or hard reset. The hive based registry saves the changes, or deltas, to the registry in files on a disk.
Early Windows CE device tended to lose all of their user data, like the registry changes, when power was removed. Prior to Windows CE 4.0, the registry could be persisted if the device OEM wrote a couple of functions in the kernel. These function allowed the OEM to save the registry data to some storage device, like flash memory, and then retrieve the data when the system rebooted. The functions are still available, but the hive based registry is a little easy to implement and maintain.
The hive based registry requires some “disk” that can save data. Disk in this case may not include spinning platters, but is probably a solid state disk in flash memory either soldered to the board or it could be an SD, Compact Flash or USB memory device. The OEM is responsible for identifying the disk to be used for the hive registry. It is possible that the hive files are stored in RAM, in which case they will not persist.
The hive registry works something like this:
  • The registry in ROM is divided into a boot and system registry
    • The boot hive contains registry settings to be used until the registry hive is loaded. This means that each and every time the system boots it will use these settings. While these settings can be changed, the changes will typically never be used.
    • The system hive contains registry settings that can be modified and saved in the hive registry.
  • The boot hive will be used by the kernel and filesys to start the system and mount a disk
  • The system registry will be loaded from ROM
  • Once the disk is mounted, it will be checked to see if hive files exist
    • If hive files exist, they will be checked to see if they are consistent with the system ROM registry
      • If they are consistent, they will be loaded
      • If they are not consistent they will be deleted and new files will be created
  • During operation of the device, the registry hives will be saved when:
    • RegFlushKey() is called by an application (one application that calls RegFlushKey() is wceload.exe, the CAB file installer.)
    • The system suspends
    • Optionally the system can be configured to save the hive when some number of changes are made or some time period expires and any changes are made.
This desciption of the hive based registry was meant to be an introduction, for more details on how it works and how to set up a system to use hive based registry please refer to Platform Builder Help.
Copyright © 2009 – Bruce Eitman
All Rights Reserved