Share via


Initializing the RAM-based Registry (Windows CE 5.0)

Send Feedback

To persist data with the RAM-based registry, you must understand how an OS initializes the RAM-based registry. The following list of steps shows the OS process of initializing the RAM-based registry:

  1. The OS initializes the kernel.
  2. The kernel runs Filesys.exe.
  3. Filesys.exe initializes the RAM file system.
  4. Filesys.exe initializes the database subsystem.
  5. Filesys.exe initializes the registry by checking for a registry in RAM. If one is found, proceed to step 7.
  6. If Filesys.exe does not find a registry in step 5, it restores the registry from ROM. Filesys.exe loads \Windows\Default.fdf, which was created using Makeimg.exe.
  7. Filesys.exe checks for the ReadRegistryFromOEM OEM adaptation layer (OAL) function. If Filesys.exe does not find ReadRegistryFromOEM it keeps the registry from ROM, as described in step 6.
  8. Filesys.exe attempts to restore \Windows\Restore.fdf, which is created with the RegCopyFile function. If Filesys.exe cannot restore \Windows\Restore.fdf, it keeps the registry from ROM, as described in step 6.
  9. Filesys.exe checks one more time for ReadRegistryFromOEM. If Filesys.exe does not find ReadRegistryFromOEM, it keeps the registry from ROM as described in step 6.

Note   Files that exist on a PC Card or a device that is serviced by a device driver cannot be accessed during initialization, because Device.exe has not been loaded. Also, memory cannot be allocated to pass to the OS because functionality for saving and loading the registry is implemented in the OAL.

The following procedure shows additional steps you must take in order to initialize the RAM-based registry of your OS.

To initialize a RAM-based registry

  1. Expose the ReadRegistryFromOEM and WriteRegistryToOEM functions in your OAL after Filesys.exe initializes the RAM file system.

    For more information about developing an OAL, see How to Develop an OEM Adaptation Layer.

  2. If an OAL is not available, use the RegCopyFile and RegRestoreFile functions to initialize a registry from RAM.

  3. After RegRestoreFile succeeds, reset your device for the new registry settings to take effect.

To keep the user unaware that a reset is occurring, you can create a boot sequence by configuring the HKEY_LOCAL_MACHINE\Init registry key. In this registry key, you can restore the registry and reboot without running Gwes.exe. You can then perform a full boot. By preventing Gwes.exe from running, the display does not become active, and therefore the user is unaware that any reset has occurred.

Using RegCopyFile and RegRestoreFile to initialize a registry from RAM requires enough of the OS to be running to restore the registry. The portions of the OS that must be running depend on where your registry file resides. For example, if your registry file resides on a PC Card, Device.exe must be running before the registry can be restored. Otherwise, the OS cannot access the registry file on the PC Card.

See Also

ReadRegistryFromOEM | RegCopyFile | WriteRegistryToOEM | How to Develop an OEM Adaptation Layer | RegRestoreFile | Persisting Data with the RAM-Based Registry

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.