After several days, the CF card was powered off by hive-based registry on ce5.0 to save the Registry. I used the FAT file system.
First, let's take the following steps:
(1) Add hive-based registry to the OS IN THE Pb catalog.
(2) Add the following registry fields to platform. Reg:
; Hive boot section
[HKEY_LOCAL_MACHINE/init/bootvars]
"Systemhive" = "Documents and Settings // system. HV"
"Profiledir" = "Documents and Settings"
"Start devmgr" = DWORD: 1
"Registryflags" = DWORD: 1
[HKEY_LOCAL_MACHINE/init/bootvars]
"Defaultuser" = "default"
[HKEY_LOCAL_MACHINE/system/storagemanager/fatfs]
"Friendlyname" = "Fat filesystem"
"DLL" = "fatfsd. dll"
"Flags" = DWORD: 00000064
"Paging" = DWORD: 1
"Enablecache" = DWORD: 1
"Cachesize" = DWORD: 0
"Util" = "fatutil. dll"
"Cachedll" = "diskcache. dll"
[HKEY_LOCAL_MACHINE/Drivers/PCMCIA/atadisk]
"DLL" = "atadisk. dll"
"Prefix" = "DSK"
"IOCTL" = DWORD: 4
"Profile" = "pcmcia"
; Indicate we are a power manageable interface and a storage driver
"Iclass" = multi_sz: "{8dd679ce-8ab4-43c8-a14a-ea4963faa715}", "{A4E7EDDA-E575-4252-9D6B-4195D48BB865 }"
[HKEY_LOCAL_MACHINE/Drivers/PCMCIA/detect/50]
"DLL" = "atadisk. dll"
"Entry" = "detectatadisk"
[HKEY_LOCAL_MACHINE/system/storagemanager/profiles/hdprofile]
"Mountasroot" = DWORD: 1
[HKEY_LOCAL_MACHINE/system/storagemanager/profiles/hdprofile]
"Mountasbootable" = DWORD: 1
[HKEY_LOCAL_MACHINE/system/storagemanager/profiles/hdprofile]
"Name" = "IDE Hard Disk Drive"
"Folder" = "Hard Disk"
[HKEY_LOCAL_MACHINE/system/storagemanager/profiles/hdprofile/fatfs]
"Enablecachewarm" = DWORD: 0
; End hive boot section
Next, we will analyze the principles. the Registry under wince is divided into two parts: boot. HV and system. HV. the former is the registry key at startup, and the latter is the system registry key. the so-called hive registry is to load boot first. HV: load the storage driver and file system where the registry is saved first, and then load the system. HV, that is, to read the registry key of the system from the disk. load boot at startup. the labels of HV are hive boot section and end boot section.
In [HKEY_LOCAL_MACHINE/init/bootvars], "systemhive" means to save system. HV path, "registryflags" = DWORD: 1 is to automatically refresh the registry and save. because the hive Registry is also running in the memory, the difference is that the modified table items will be read from the disk at startup, so your registry changes are also made in the memory, at this time, if you do not save the values in the memory to the disk, these changes will still be lost. of course, you can also program the implementation (call regflushkey ). to implement hive, You need to implement two parts: the driver for storing hive media and the corresponding items of the file system. since I saved it on a CF card (equivalent to a hard disk. add storagemanager/profiles/hdprofile in the atadisk driver and storage management in Reg, and then add system/storagemanager/fatfs to load the FAT file system.
Gains: 1. changes to the hive configuration file include three parts: (1) the bootvars table item, which is used for saving the location, multiple users, and automatic refresh mechanism. (2) storage media driver, in my case, that is, the hard disk driver; (3) File System loading (fatfs ).
2. See some Article Add "Flags" = DWORD: 1000 to the storage driver to load the file only once.
3. "mountasbootable" = DWORD: 1 is equivalent to mountflag = DWORD: 2 in 4.2.
This statement indicates that the Registry is saved in the drive system of the disk. I have verified that mountflag = DWORD: 2 is still valid under wince5.0.