Ram-based registry and hive-based registry in WinCE

Source: Internet
Author: User
Tags builtin

Two types of registries are supported in wince: Ram-based and hive-based. The ram-based registry is used by default.

1. Ram-based registry

The ram-based registry stores all registry data in the object store, that is, it is stored in Ram. It is generally used on a system with a battery backup Ram. That is to say, when the system powers down, it will automatically switch to a battery power supply. At this time, ram also has power supply, so the above data will not be lost, using the ram-based registry is very effective.

The ram-based registry is mostly used on frequently-used Warm Boot devices. It is rarely used on cold boot devices.

2. hive-based registry

The hive-based registry stores registry data into a file, that is, there is a disk on which power loss will not lose data. The Hive registry is divided into two parts: System hive and user hive, that is, system. HV and user.. In a multi-user system, there will be multiple user hive. Different user hive (user. HV) will be loaded when the user logs in and unmounted when the user logs out.

In fact, the hive-based registry consists of three parts: hive, hive, and hive, namely boot. HV, system. HV, and user. HV. Boot. HV is mainly used for the registry settings required during system boot. these settings are not stored on the disk, that is, they will be lost after the system powers down. In fact, this part should belong to the ram-based registry. It doesn't matter because this part of data does not need to be changed. System. HV stores registry settings of the system, user. HV stores and user-related registry settings.

Generally, when we compile the wince system, platform builder will. the annotation label in the reg file to determine which registry settings are put into boot. in HV, all settings between the annotation label ", hive boot secton" and "; end hive boot section" will be placed in Boot. in HV, the others will be placed in default. HV and user. in HV.

All. HV will be put into RAM, And the wince system will first read boot. configure the relevant boot time for HV, and then set default. HV and user. put HV under the specified path of the disk. This path is also set in the Registry, and then default. HV will be renamed to system.. When the system starts for the second time, it compares the. HV on the disk with the. HV in the memory. If the two are different, it copies the. HV on the disk to the memory.

We can see that the hive registry is actually stored in Ram during running, which is faster. It will be read from the disk at startup. After the user changes the registry, it will be saved on the disk and the storage time can also be set, you can save the changes to the disk immediately or reboot.

3 hive-based registry implementation

(1) Add the hive-based registry key

To support the hive-based registry in the system, select "core OS"-> "cebase"-> "file system and data store"-> "Registry storage" in "catalog item View ". "->" hive-based registry ",

(2) Add a hive annotation label

Then you need to add the corresponding registry settings. Generally, we will add hive-related settings in platform. Reg. The first thing you need to add is the hive annotation tag, as shown below:

; Hive boot section

...

 

...

; End boot section

All Registry Settings related to hive, including settings related to the drive of the disk where hive is stored, should be placed in the hive comment label.

(3) set the Registry storage location:

The following example shows how to set the storage location of system. HV and user. HV.

[HKEY_LOCAL_MACHINE/init/bootvars]

"Systemhive" = "// nandflash // system. HV"

"Profiledir" = "// nandflash // user. HV"

"Flags" = DWORD: 1

"Registryflags" = DWORD: 1

"Systemhive" is used to set the storage location of system. HV, which is stored in the root directory of the nandflash disk.

"Profiledir" is used to set the location where user. HV is stored. It is stored in the root directory of the nandflash disk.

"Flags" is used to set whether to start Device Manager immediately, mainly to start the storage devices required by hive-based.

"Registryflags" is used to set when to write the new registry settings to the disk. This indicates that the new registry settings are written immediately.

(4) modify the disk device driver Configuration

Add hive-supported settings for related disk drivers as follows:

[HKEY_LOCAL_MACHINE/Drivers/builtin/nandflash]

"Flags" = DWORD: 1000

Because the hive registry is saved in nandflash, the "Flags" settings are added to the registry settings of the nandflash device driver. The preceding settings are only required when the hive-based registry is used. If the hive registry is not used, comment out the settings.

(5) add Storage Manager configurations

The details are as follows:

[HKEY_LOCAL_MACHINE/system/storagemanager/profiles //]

"Mountbootable" = DWORD: 1

Similarly, the above settings are required when you use the hive registry. If you do not use the hive registry, you can just comment it out.

The following is the settings that I used to support the hive registry based on nandflash. They are for reference only:
 
; Hive boot section
[HKEY_LOCAL_MACHINE/init/bootvars]
"Systemhive" = "// nandflash // system. HV"; unmask this line to use flash
"Profiledir" = "// nandflash // USR. HV"
"Start devmgr" = DWORD: 1
"Defaultuser" = "default"
"Flags" = DWORD: 1
"Registryflags" = DWORD: 1
[HKEY_LOCAL_MACHINE/system/storagemanager/autoload/nsflash]
"Driverpath" = "drivers // builtin // nandflash"
"Loadflags" = DWORD: 1 "order" = DWORD: 0
[HKEY_LOCAL_MACHINE/Drivers/builtin/nandflash]
"DLL" = "ep94xxnandflash. dll"
"Prefix" = "DSK" "order" = DWORD: 0
; "IOCTL" = DWORD: 4
"Profile" = "nsflash"
"Iclass" = "{A4E7EDDA-E575-4252-9D6B-4195D48BB865 }"
"Flags" = DWORD: 1000; unmask this line when enable hive
; "Membase" = DWORD: 00000000
; "Memlen" = DWORD: 00000000
; Override names in default profile
[HKEY_LOCAL_MACHINE/system/storagemanager/profiles/nsflash]
"Name" = "ep94xx NAND Flash"
"Folder" = "nandflash"
"Partitiondriver" = "mspart. dll"
"Automount" = DWORD: 1
"Autopart" = DWORD: 1
"AutoFormat" = DWORD: 1
"Mountflags" = DWORD: 2; unmask this line when enable hive
[HKEY_LOCAL_MACHINE/system/storagemanager/profiles/nsflash/fatfs]
"Mountflags" = DWORD: 2; unmask this line when enable hive
"Enablecache" = DWORD: 1
"Cachesize" = DWORD: 1000
"Mountbootable" = DWORD: 1
"Flags" = DWORD: 00000024
; "Flags" = DWORD: 00680024
; "Formattfat" = DWORD: 1
"Checkforformat" = DWORD: 1

 

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/nanjianhui/archive/2008/06/15/2550292.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.