Storage and loading of the wince Registry

Source: Internet
Author: User

 

Principles:

Registry types include OSS-based registry and hive-based registry. You can only choose one of them when customizing the kernel.
Theoretically, both Registries can permanently store registry data, but different types may affect the startup sequence and startup speed of CE,
It also affects the memory usage. I still tend to use the hive-based registry to permanently store registry data, which is also a development trend.
Before explaining this, let's briefly describe how to load the stored registry data when ce uses a hive-based registry:

1. Run nk.exeand start filesys.exe.
2. filesys.exe loads and directs hive in the file after NK. Bin decompression.
3. filesys.exestart device.exe, and wait until device.exe includes the driver of the hive file system and storage device.ProgramLoad completed.
4. The driver of the file system and storage device exists in the boot hive.
5. device.exe loads the aforementioned file system driver and storage device driver to get started. After that, device.exe is in the waiting status.
6. filesys.exe is awakened, loaded, and installed with hive. Filesys.exe is in the waiting state.
7. nk.exe starts initialization according to the system hive information. These include loading drivers and starting some applications.
Specifically, the ghost driver is generally executed by device.exe, and the startup application is executed by filesys.exe. At this time, device.exeand filesys.exe have been awakened.

Because there must be duplicates between the hive pilot and the system hive, the drivers may be repeatedly loaded or the application may be started.
To this end, Ce allows duplicate-proof flag to be added to the registry information describing the driver, and applications can use event objects to prevent repeated startup,
For example, device.exe.

The following describes how to set a hive-based registry in two scenarios: hard disk-based and flash-based.

You can also refer to Microsoft's help.

Scenario 1: hard disk-based Permanent storage

Add "hive-based registry" to Pb. If it is a geode platform, add the bsp_enable_fsreghive environment variable.
Open Platform. Reg and find the following information:; hive boot section
[HKEY_LOCAL_MACHINE \ init \ bootvars]
"Systemhive" = "events and Settings \ System. HV"
"Profiledir" = "Documents and Settings"
"Start devmgr" = DWORD: 0
If bsp_enable_fsreghive
"Start devmgr" = DWORD: 1
Endif
; End hive boot section
The value of "systemhive" is the path of the system hive file.
"Start devmgr" is a Boolean value that indicates that the Device Manager device.exe is executed when the supervisor starts. According to the CE help document,
Only when you want to store hive in OSS is set to 0. Therefore, you must set hive to 1.
For multiple users, enter "defaultuser" = "" in the Registry to specify the default user name. If it is a single-user system, you can leave it unspecified.
Ensure that the Registry Information of the file system driver that contains the system hive and the Registry Information of the driver that stores the device are included in
Between "; hive boot section" and "; end hive boot section", the registry data between the two statements belongs to the pilot hive.
If we store the system hive file system. HV on the hard disk and use the FAT file system.
In this case, the [HKEY_LOCAL_MACHINE \ SYSTEM \ storagemanager \ fatfs] and
[HKEY_LOCAL_MACHINE \ SYSTEM \ storagemanager \ profiles \ hdprofile] Move to "; hive boot section.

Add the following flag to the registry information of all drivers between "; hive boot section" and "; end hive boot section:

"Flags" = DWORD: 1000

This flag is a bitmask that can be used with other existing "Flags" or operations.
The value is bytes. This type of device.exe does not load the current driver twice.
In the registry information of the driver that contains the storage device of the system hive, add the following sign (assuming it is a hard disk ):
[HKEY_LOCAL_MACHINE \ SYSTEM \ storagemanager \ profiles \ hdprofile]
"Mountflags" = DWORD: 2

This indicates that the storage device contains the system hive file.
You can store registry data permanently by setting the kernel as described above. The execution of saving registry data must be clarified here:
Under normal circumstances, CE can ensure that important registry data can be flushed from memory to (flush) permanent memory.
However, this does not completely guarantee that all data can be completely stored without being lost. Therefore, we must ensure that nothing is lost,
You should actively call the regflushkey function to forcibly fl the data in the memory to the permanent memory.
This function has only one parameter, that is, the Registry branch. Ce also adds a registry key (as shown below ),
It automatically calls the regflushkey function whenever the regclosekey function is called.
[HKEY_LOCAL_MACHINE \ init \ bootvars]
"Registryflags" = DWORD: 1
If ce finds a system hive error during startup, it will automatically delete the file and create a default system hive file. If the following registry key appears, it indicates that this kind of problem has occurred. [HKEY_LOCAL_MACHINE]
"Regpersisted" = DWORD: 1

2. Flash-based

1. In "file systems and data store" -- "Registry storage,
Select "hive-based registry". You do not need to modify any other information.
The fat file system does not need to be added.

2. Modify the part of platform. Reg.
Find the following and modify
Modify location 1:
; @ Cesysgen if filesys_fsreghive
; Hive boot section
[HKEY_LOCAL_MACHINE \ init \ bootvars]
"Systemhive" = "system. HV"
; "Profiledir" = "Documents and Settings"; removed directly
"Start devmgr" = DWORD: 1; change 0 to 1
; End hive boot section
; @ Cesysgen endif filesys_fsreghive

[HKEY_LOCAL_MACHINE \ init \ bootvars]; added
"Defaultuser" = "default"; added

Modify Location 2:
; Hive boot section; added by yourself. I don't know if it is useless.
[HKEY_LOCAL_MACHINE \ SYSTEM \ storagemanager \ autoload \ flashdrv]
"Driverpath" = "Drivers \ blockdevice \ flashdrv"
"Loadflags" = DWORD: 1
"Mountflags" = DWORD: 11
"Bootphase" = DWORD: 0
"Flags" = DWORD: 1000; self-added

[HKEY_LOCAL_MACHINE \ drivers \ blockdevice \ flashdrv]
"Prefix" = "DSK"
"DLL" = "flashdrv. dll"
"Order" = DWORD: 0
"IOCTL" = DWORD: 4
"Profile" = "flashdrv"
"Friendlyname" = "Ms Flash Driver"
"Mountflags" = DWORD: 11
"Bootphase" = DWORD: 0
"Flags" = DWORD: 1000; self-added

; Bind binfs to the block driver
[HKEY_LOCAL_MACHINE \ SYSTEM \ storagemanager \ profiles \ flashdrv]
"Defaultfilesystem" = "binfs"
"Partitiondriver" = "mspart. dll"
"Automount" = DWORD: 1
"Autopart" = DWORD: 1
"Mountflags" = DWORD: 2; 11-> 2
"Folder" = "residentflash"
"Name" = "Microsoft flash disk"
"Bootphase" = DWORD: 0
"Flags" = DWORD: 1000; self-added
; End hive boot section; added by yourself. I don't know if it is useless.

In this way,
My questions are as follows:
Microsoft's help documentation says,
Set the following flag bit on each driver that is loaded during the first boot phase.
[HKEY_LOCAL_MACHINE \ drivers \...]
"Flags" = DWORD: 1000
I did not pay attention to this. Of course I still added flash in the above, but not in many places in common. Reg.
But can be used.
Also, I did not try the one I added above.
; Hive boot section
; End hive boot section
The original idea was that we wanted the system to load the necessary drivers before loading the registry, but I thought we should add a semicolon (;) before loading the registry.
Blocked. I don't know if it works,
Which drivers should be loaded before you set up to load your registry.
In addition, I hope that some netizens can make better settings. I guess this may be a problem.

 

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.