How to import and export the Registry on Windows Mobile and how to use the smart device cab Project

Source: Internet
Author: User

Although, we can. to operate the registry in the INF file (in VS 2005, we only need to add registry operations to the smart cab project), but sometimes, for example, the space on the machine is limited, because the cab file occupies space, if we use Program Copy the files to the corresponding directory and modify the Registry to save the space required by the cab, especially when the space is enough to store only one application; when the OEM generates the software Rom, We need to manually operate the Registry. At this time, we need to write the Registry file by ourselves. You can use Google to search for a series of articles about how to compile a registry. Article . However, you can use Windows Mobile's remote tool to obtain the Registry file without writing it yourself (you only need to modify some parameters ).
The following is an experiment on a Windows Mobile 5.0 for Pocket PC (Chinese version) simulator.
Export the Registry File
Take the example of exporting the Hanwang registry of an application in PPC as an example. First, use activesyn 4.x to synchronize the PPC simulator. (If you only export the registry, do not synchronize it. Just open the simulator ); secondly, use Windows Mobile's remote tools (in VS 2005, called visual stidio remote tools, you can choose Remote Registry Editor under "start"> "All Programs>" Microsoft Visual Studio 2005 ">" Visual Studio remote Tools "to connect to the simulator opened on. Next, find the directory of Hanwang in the Registry (in HKEY_LOCAL_MACHINE \ SOFTWARE \ Hanwang), and click "Hanwang". Then, click "Registry"-> "Export registry files... ", Name the exported file, select the save file path, and click" save "to export the file.
Note: If the registry contains Chinese characters, Chinese characters cannot be exported. It may be a comma (,).
The file (you need to change the extension to Reg) is as follows:
Regedit4

[HKEY_LOCAL_MACHINE \ SOFTWARE \ Hanwang]

[HKEY_LOCAL_MACHINE \ SOFTWARE \ Hanwang \ hangwang pen for wince]
"Study" = "0"
"Sound on" = "1"
"Screen segment" = "1"
"Default Input Panel" = "0"
"Ink speed" = "10"
"Ink width" = "1"
"Ink color" = "0"
"Ink type" = "2"
"Recognizer delay" =" 400"
"Recognizer range" = "600e"
To verify, You need to modify the preceding file directory to distinguish it from the original registry key.
This registry file program may not be complete, for this Hanwang program. If you are interested, you can study it on your own.
Import registry files
If we directly put the exported registry file to PPC, double-click the file and run it. There is no problem with this operation on the PC. However, the following error occurs in PPC:

It turns out that "on Windows Mobile, programs such as regiedit are not associated by default and cannot be imported automatically ". All, can be imported in other ways.
The strange thing is that the Remote Registry Editor should have the function of importing registry files, however, I did not find the corresponding button operation in the Remote Registry Editor (except for items, keys, and value-by-value creation). If you know, please let me know.
The method I selected is to create a smart cab project to import the Registry file.
Under Visual Studio 2005, select "new"-> "project"-> "other project types"-> "setup and deployment"-> "smart device cab projects ", enter the file name and select the path, and click "OK" to create the project. Then, click the Registry Editor on the green icon above the project opened in IDE. The Registry on target machine and four directories frequently used in the registry will appear on the Right of IDE, right-click the green icon "Registry Editor"-> "import" on the right to import the exported file.
Because there are any files in this project, the following error occurs during "build:
Error: You tried to build a setup project but did not include any files. You must specify at least one file before continuing.
At this time, you can add a file to the project (right-click the project name, add-> file, add the file, or click File System editor on the project name for corresponding operations ).
After the file is added, "rebuild" is used to generate the cab file. You can find the file INF in the release folder.
The statements about the registry in the INF file are as follows:
[Regkeys]
"HKLM", "SOFTWARE \ Hanwang \ hangwang pen for wince", "ink color", "0x00000000", "0"
"HKLM", "SOFTWARE \ Hanwang \ hangwang pen for wince", "sound on", "0x00000000", "1"
"HKLM", "SOFTWARE \ Hanwang \ hangwang pen for wince", "Default Input Panel", "0x00000000", "0"
"HKLM", "SOFTWARE \ Hanwang \ hangwang pen for wince", "ink width", "0x00000000", "1"
"HKLM", "SOFTWARE \ Hanwang \ hangwang pen for wince", "ink type", "0x00000000", "2"
"HKLM", "SOFTWARE \ Hanwang \ hangwang pen for wince", "recognizer range", "0x00000000", "600e"
"HKLM", "SOFTWARE \ Hanwang \ hangwang pen for wince", "ink speed", "0x00000000", "10"
"HKLM", "SOFTWARE \ Hanwang \ hangwang pen for wince", "study", "0x00000000", "0"
"HKLM", "SOFTWARE \ Hanwang \ hangwang pen for wince", "recognizer delay", "0x00000000", "400"
"HKLM", "SOFTWARE \ Hanwang \ hangwang pen for wince", "screen segment", "0x00000000", "1"
In this way, you can compare the Registry statement syntax of the INF file with that of the reg file. It can be found that 0x00000000 In the INF file indicates that the key value is of the string type, while 0x00010001 indicates that the key value is of the DWORD type, but it is strange that the 0x00000002 type is exported from the registry and then the INF file is generated, it is changed to the 0x00000000 type. It is estimated that 0x00000002 is also a string type,What are the differences between 0x0000000 and 0x00000002? Does anyone know about this?
Finally, you can copy the cab file to the simulator to run and install it. In this way, you can check whether the modified or written registry is correct. Because the cab file is used for installation, you can delete it by deleting the program. Therefore, the requirements of the program in the Rom are not met, this can be used to verify whether the reg file is correct and how to convert the [regkeys] section of the INF file to the reg file.
In actual projects, it is more common to first generate the cab file of the application file and install the cab file on Windows Mobile, use the Remote Registry Editor to export the registry key of the application. In addition, create a smart device cab project and install it on Windows Mobile for verification. However, this test process is usually not necessary.

Related Article

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.