Hive-based Registry Initialization (Windows Embedded CE 6.0)

1/6/2010

The following steps show the process that Filesys.dll uses to initialize the hive-based registry.

  1. Filesys.dll calls OEMIoControl with IOCTL_HAL_GETREGSECUREKEYS twice. The first call is a query to obtain the required data buffer size. The second call is a query to obtain the buffer of secure key data. **

  2. Filesys.dll mounts the boot hive (Boot.hv) from ROM. The boot hive contains information that Filesys.dll needs to determine where the registry is stored and to start the drivers that are required to access it.

  3. Filesys.dll calls OEMIoControl with I/O control IOCTL_HAL_INITREGISTRY, to enable the OEM adaptation layer (OAL) to add data to the registry early during startup.

  4. Filesys.dll creates named events for all event names in the HKEY_LOCAL_MACHINE\System\Events registry location in the boot hive. These events are set by the processes that own them. For more information, see Ready-Event Registration.

  5. Filesys.dll loads Storage Manager if HKEY_LOCAL_MACHINE\System\StorageManager points to a loadable DLL. Filesys.dll creates a thread to initialize Storage Manager. The thread exits when initialization is complete.

  6. If the Flags value is set to 1 or 4, Filesys.dll starts boot phase zero. For more information about boot phases, see Boot Phases.

  7. The system locale is initialized.

  8. If the Flags value is set to 1 or 4, Filesys.dll starts phase one of startup. For more information about boot phases, see Boot Phases.

  9. If the Flags value is set to 2 or 8, Filesys.dll starts Device.exe.

  10. Filesys.dll creates an event called "SYSTEM/BootPhase2", which occurs when the file system containing the system registry is loaded. This file system is identified by the "MountFlags"=2 bit mask in its Storage Manager profile.
    For versions of Windows CE 5.0 and later, the MountFlags value is deprecated. Instead, the file system containing the system registry is identified by the following registry setting:

       "MountAsBootable"=dword:1
    
  11. Filesys.dll waits for a file system to register as the storage location for registry hives.

  12. If the registry hives are not stored on a file system, Filesys.dll calls OEMIoControl with IOCTL_HAL_GET_HIVE_RAM_REGION to determine whether the registry data should be stored in a reserved area of RAM, instead of in a file.

  13. Filesys.dll mounts the ROM portion of the system registry, Default.hv.

  14. Filesys.dll calls OEMIoControl with IOCTL_HAL_GET_HIVE_CLEAN_FLAG and the HIVECLEANFLAG_SYSTEM flag to determine whether the OAL indicates that the system hive should be cleaned and recreated with data from ROM.

  15. If a clean registry is not required, the system registry hive file (System.hv) is loaded from the file system that contains it. A signature in the system hive file is checked against a signature in the ROM portion of the system registry. If the signatures do not match, a clean registry is required, even if this is not indicated by IOCTL_HAL_GET_HIVE_CLEAN_FLAG.

  16. If a clean registry is required, the old registry hive file is deleted, and a new hive file is created.

  17. Filesys.dll invalidates any currently open system registry handles before swapping out the boot registry hive.

  18. Filesys.dll migrates the changes from the boot registry hive to the system hive.

  19. If the boot is not a clean boot, Filesys.dll sets the registry value RegPersisted under HKEY_LOCAL_MACHINE to 1. At this point, non-user-specific registry data becomes available.

  20. Filesys.dll determines where the user profiles are stored by looking at the registry value ProfileDir under HKEY_LOCAL_MACHINE\init\BootVars.

  21. Filesys.dll calls OEMIoControl with IOCTL_HAL_GET_HIVE_CLEAN_FLAG and the HIVECLEANFLAG_USERS flag, to determine whether the OAL indicates that the user profiles should be cleaned. If so, all user profile directories are removed, along with their contents.

  22. Filesys.dll determines whether the default user profile should be loaded. If the registry value NoDefaultUser under HKEY_LOCAL_MACHINE\init\BootVars is set to 1, a call to SetCurrentUser is required to load a user profile. If NoDefaultUser is set to zero, the default user profile is loaded.
    The name of the default user is determined by the value of DefaultUser, a REG_SZ value, in HKEY_LOCAL_MACHINE\init\BootVars. The DefaultUser is set to the name of the user to use as the default profile when the system starts. If it is an existing user, the appropriate user hive is loaded. If it is a new user, the user profile is created. If DefaultUser is not set, a user profile with the name "default" is loaded. You can choose a default user name with the following registry key:

    [HKEY_LOCAL_MACHINE\init\BootVars]
       "DefaultUser"=<username>
    
  23. When Filesys.dll loads the user registry, it performs the following actions:

    1. Mounts the ROM portion of the user registry hive from the User.hv file in ROM.
    2. Mounts the remaining portion of the user registry hive from the User.hv file in the user profile directory on the persistent file system.
    3. A signature in the user hive file is checked against a signature in the ROM portion of the user registry. If the signatures do not match, a clean registry is required. The User.hv file in the user profile directory is deleted, and a new hive file is created. No other files in the user profile directory are affected.
    4. If the user registry is not clean, Filesys.dll sets the registry value RegPersisted under HKEY_CURRENT_USER to 1.

See Also

Concepts

Hive-Based Registry
File System Boot Process
OAL Initialization of RAM-based Registry