CD/DVD-ROM drive doesn't mount when using the Hive-Based registry

We received the following question today on our Base Team Blog email alias. I figured it would be worth making the reply into a post since I've heard the same issue arise on a few other occasions.

Question:

We are working on a platform with two attached IDE devices on the same IDE bus. The first device is a hard disk that we want to use as storage for the persistent registry hives. The other device is a CD-ROM drive. When we do not enable persistent hive based registry, both the hard disk and the CD-ROM appear to work properly. However, when we enable the persistent hive-based registry using the following environment variables, the CD-ROM no longer appears (though persistent registry works properly):

PRJ_ENABLE_FSREGHIVE=1
PRJ_BOOTDEVICE_ATAPI=1

What's going on?

Answer:

This problem occurs because the storage driver managing your hard disk (atapi) is started early in the boot sequence in order to store the registry hives. The same storage driver is used to manage your CDROM drive. When this driver is started, only the contents of the boot registry (boot.hv) are available. So, the registry keys required to mount your CDROM drive are not present because they are not in the boot registry. You can work-around this problem by manually adding the appropriate registry keys for the CDROM drive to the boot registry. You will need to copy keys from common.reg into your platform.reg or project.reg file and wrap them in ; HIVE BOOT SECTION / ; END HIVE BOOT SECTION tags. You will need the following set of keys:

; HIVE BOOT SECTION

; Default values for udfs.
[HKEY_LOCAL_MACHINE\System\StorageManager\UDFS]
"FriendlyName"="CDFS/UDFS FileSystem"
"Dll"="udfs.dll"
"Paging"=dword:1

; Storage Profile for ATAPI CD/DVD-ROM drives.
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\CDProfile]
"Name"="IDE CDROM/DVD Drive"
"Folder"=LOC_STORE_CD_FOLDER
"DefaultFileSystem"="UDFS"
"PartitionDriver"=""

; Empty partition mapping table for CD/DVD-ROM drives.
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\CDProfile\PartitionTable]

; END HIVE BOOT SECTION

 

Comments are welcome as always.

Andrew