How to Use hive-based registry in wince. net

Source: Internet
Author: User

Abstract:

Wince itself is a system that runs completely in the memory. At each startup, You need to copy NK. bin to the corresponding address in the memory. Such a system does not require system maintenance, but how to "permanent" Storage settings becomes a problem. This article describes how to save settings permanently in wince.

Keywords:

Wince, embedded operating system, hive-based registry

Author

Tony

Email: gzci@163.com

Windows CE. Net is a successor to Windows CE 3.0. Windows CE. Net is a new design for the embedded market and provides a robust real-time operating system for quickly building next-generation smart mobile devices and devices with small memory usage. Windows CE. net has a complete Operating System feature set package and end-to-end development environment, which includes everything required to create a Windows CE-based custom device, such: powerful networking capabilities, strong real-time performance, small memory usage, and rich multimedia and web browsing features.

Wince itself is a system that runs completely in the memory. At each startup, You need to copy NK. bin to the corresponding address in the memory. Data in the memory will disappear after shutdown ". Such a system does not require system maintenance, but how to "permanent" Storage settings becomes a problem. Find a solution provided by Microsoft by searching for information. The specific implementation method is as follows:

Step 1: Add hive-based registry to our platform in the Pb catalog.

 

Step 2: In platform. Reg, modify the settings under [HKEY_LOCAL_MACHINE \ init \ bootvars]:

"Systemhive" = ""

"Start devmgr" = DWORD:

In our system, it is started directly from the CF card, which is equivalent to the C drive of the Windows system. The specific changes are as follows: "systemhive" = "Documents and Settings \ System. HV"

"Profiledir" = "Documents and Settings"

"Start devmgr" = DWORD: 1

Systemhive is the path for saving the system. HV file. Start devmgr is to select whether to start the Device Manager. The purpose of starting the Device Manager is to start the devices required by hive-based registry. (Start devmgr is a Boolean value indicating whether or not to start the Device Manager so it can start the drivers necessary
To reach the registry hives. A value of 1 causes the Device Manager to start; 0 keeps the Device Manager from starting. the only case in which the Device Manager shocould not start is if you want to store the hives in the object store, which causes the hives
To be lost on a cold boot. Typically, the hives are stored outside Ram, so it is necessary to start the Device Manager .)

Step 3: modify "defaultuser" = "" under [HKEY_LOCAL_MACHINE \ init \ bootvars] in platform. reg to determine which Default User's hive-based registry to call. If not, you can leave the settings unspecified.

Step 4: Check whether the registration items of all startup drivers in platform. Reg and common. Reg are set. You can search in platform. Reg and common. Reg

; Hive boot section

; End hive boot section

Such fields. There are many items that need to be set, including IRQ, Io, PCI, etc. However, if you have not modified them, you can do it by default. These settings tell Rom registry builder what to add to boot hive.

 

Step 5: Start the driver that must be started in the first startup phase. Let's take a look at the following description about the first startup phase of the notebook:

 

Obviously, filesys must be started in the first startup phase. Find the relevant file system settings in common. Reg and add "Flags" = DWORD: 1000. We use the FAT file system. Specific settings

Step 6: Set the registration value of mountflags to DWORD: 2. In common. Reg:

[HKEY_LOCAL_MACHINE \ SYSTEM \ storagemanager \ profiles \]

Set: "mountflags" = DWORD: 2

Step 7: Determine whether the registry refresh mechanism is required. Generally, the system automatically refresh and save the Registry when the OS is suspended or restarted. However, when the system suddenly loses power, the Registry will not be saved. Therefore, you need to refresh the registry after changing the settings. The general solution is to run the save setup program (call regflushkey) after the user sets the settings to save the settings; do not regularly refresh the Registry, which will make the entire system slow.

Step 8: completely re-build, make image, and re-generate NK. Bin.

The above settings can be permanently saved in the wince system.

 

References:

Microsoft Windows CE. Net 4.2 Help Version 4.0

 

Next, I will share with you on wince5. 0. Save the settings. (The armsys2440 platform is used. It is very simple. I will not talk much about the theory. The two articles mentioned above are clear ):

STEP (1) Add hive-based registry support under the current platform;

STEP (2) search for "; hive boot section" in the Registry platform. Reg. There are two places, in the second place (originally: If bsp_nonandfs! Place), replace the content between; hive boot section and; end hive boot section:

[HKEY_LOCAL_MACHINE \ init \ bootvars]
"Systemhive" = "system. HV"
"Start devmgr" = DWORD: 1
"Registryflags" = DWORD: 1
[HKEY_LOCAL_MACHINE \ init \ bootvars]
"Defaultuser" = "default"

If bsp_nonandfs!
[HKEY_LOCAL_MACHINE \ SYSTEM \ storagemanager \ autoload \ smflash]
"Driverpath" = "Drivers \ builtin \ smflash"
; Loadflags 0x01 = load synchronously
"Loadflags" = DWORD: 1
"Bootphase" = DWORD: 0

[HKEY_LOCAL_MACHINE \ drivers \ builtin \ smflash]
"Prefix" = "DSK"
"DLL" = "smflash. dll"
"Index" = DWORD: 1
"Order" = DWORD: 0
"Profile" = "smflash"
"Iclass" = "{A4E7EDDA-E575-4252-9D6B-4195D48BB865 }"
"Flags" = DWORD: 1000 ;;;;;;;;;;

[HKEY_LOCAL_MACHINE \ SYSTEM \ storagemanager \ profiles \ smflash]
"Defaultfilesystem" = "binfs"
"Autopart" = DWORD: 1
"Automount" = DWORD: 1
"Partitiondriver" = "mspart. dll"
"Name" = "Microsoft flash disk"
"Folder" = "residentflash"
"Bootphase" = DWORD: 0
"Mountflags" = DWORD: 2
"Flags" = DWORD: 1000 ;;;;;;;;;;

; Keep fatfs from trying to shadow \ WINDOWS
[HKEY_LOCAL_MACHINE \ SYSTEM \ storagemanager \ profiles \ smflash \ fatfs]
"Flags" = DWORD: 14
"Formattfat" = DWORD: 1
"Checkforformat" = DWORD: 1

[HKEY_LOCAL_MACHINE \ SYSTEM \ storagemanager \ fatfs]
"Flags" = DWORD: 00000014; fatfs_tfat_always | fatfs_force_tfat
"Mountflags" = DWORD: 0

Endif; bsp_nonandfs
; End hive boot section

Step (3), last step, re-run sysgen (select clean before building), and finally build BSP and makeimg.

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.