Initializing the File-based Registry
To initialize the registry, call OEMIoControl with IOCTL_HAL_GETREGSECUREKEYS.
To initialize a file-based registry
Mount the boot hive from ROM to determine where the registry is stored.
Call the OEM through OEMIoControl with IOCTL_HAL_INITREGISTRY.
Start Device.exe if the registry value Start DevMgr under HKEY_LOCAL_MACHINE\init\BootVars is set to 1.
Load the storage manager if HKEY_LOCAL_MACHINE\System\StorageManager points to a loadable DLL.
If storage manager is loaded, create a thread to initialize it. The thread will exit when done.
Create an event called SYSTEM/BootPhase2, which will be triggered when the real system registry is loaded.
Wait for a file system to register as the storage location for registry hives.
Mount the ROM portion of the system registry.
Call the OEM with IOCTL_HAL_GET_HIVE_CLEAN_FLAG if there is a mismatch between the ROM portion of the system registry and the file portion.
Mount the RAM portion of the system registry if a clean registry is not required. If this is a clean registry, the old registry file will be deleted and a new file will be created.
Invalidate any currently open system registry handles before swapping out the boot registry hive.
When the system registry is loaded, perform the following actions:
- Mount the ROM portion of the system registry hive.
- Mount the RAM portion of the system registry hive.
- If the ROM and RAM portions of the registry are not synchronized, perform a clean boot on the system hive.
Migrate changes from the boot registry hive to the system hive.
If this is not a clean boot, set the registry value RegPersisted under HKEY_LOCAL_MACHINE to 1. At this point, non-user specific registry data becomes available.
Determine where the user profiles are stored by looking at the registry value ProfileDir under HKEY_LOCAL_MACHINE\init\BootVars.
Call the OEM with IOCTL_HAL_GET_HIVE_CLEAN_FLAG if there is a mismatch between the ROM porting of the system registry and the file portion. If you indicate that they should be cleaned, all user profile directories are removed, along with their contents.
Determine if 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 0, the default user profile is loaded.
The default user hive to load 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 boots. If it is an existing user, the appropriate user hive is loaded. If it is a new user, the user profile can be created. If DefaultUser is not set, the default user profile is loaded. You can implement this with the following registry key.
[HKEY_LOCAL_MACHINE\init\BootVars] "DefaultUser"=<username>
When the user registry is loaded, perform the following actions:
- Mount the ROM portion of the user registry hive.
- Mount the RAM portion of the user registry hive.
- If the ROM and RAM portions of the registry are not synchronized, perform a clean boot of the user profile.
- If this is not a clean registry, set the registry value RegPersisted under HKEY_CURRENT_USER to 1.
See Also
Last updated on Wednesday, April 13, 2005
© 2005 Microsoft Corporation. All rights reserved.