The Registry is an important part of Windows CE and allows you to manage many parts of the system's behavior.  You have two registry files available to you to use for managing the registry in your system; platform.reg and project.reg. 
  • Platform.reg is used to make changes that apply to your BSP, if you are developing a BSP
  • Project.reg is used to make changes that apply to your project
You can use these files to add new registry keys and values, you can change existing values and you can delete keys and values.  Modifying or deleting values can be done because during makeimg the registry files are merged together to create the system's registry, and because the entries at the top of they system's registry are overwritten by the entries that occur later in the system registry.  The system registry is in reginit.ini.  I discuss the order more in Platform Builder: Pulling it all together with Makeimg.
Note:  The following discusses editing platform.reg and project.reg.   These files can be found in the _FLATRELEASEDIR, but you should not edit the files there as they are output files and therefore your changes could be lost.   Instead edit the files in your FILES folder in your Platform or Project folders.
Adding Values in the Registry
You may use either platform.reg or project.reg to add any new registry values and keys to the registry to satisfy your system requirements.  So pick the file that is appropriate to your development needs and add the values and keys that you need to add. 
Modifying Values in the Registry
Example of using project.reg:
 
The following comes from common.reg:
 ; @CESYSGEN IF CE_MODULES_SDMEMORY
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\SDMemory]
                 "Name"="SD Memory Card"
                "Folder"="Storage Card"

This defines settings for SD memory cards.  This includes setting the folder name to be "Storage Card" when a user inserts a storage card.  But you want the users to more clearly know that the folder is the SD memory card, so you want the folder to be "SD Card".  In project.reg add the following:
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\SDMemory]
    "Folder"="SD Card"  ; change the name to SD Card
When the registry files are merged to create reginit.ini, the project.reg settings will be closer to the bottom of the file than are the settings in common.reg, so the folder name will be "SD Card".
Deleting Values in the Registry
You can also delete values, using:
            "Value Name"=-
Example of deleting a value, Shell.reg contains (For more on starting applications with the Init key, see Windows CE: Starting an Application when the System Boots):
[HKEY_LOCAL_MACHINE\init]
               "Launch50"="explorer.exe"
               "Depend50"=hex:14,00, 1e,00

Which defines that the explorer shell, or desktop, is to be started when the system starts.  You want to include the explorer shell, but you don't want it to start automatically because your app will be a kiosk type
application, but you do want your service people to be able to start the desktop to make changes to the system.  To do this add the following to your project.reg:

[HKEY_LOCAL_MACHINE\init]
                "Launch50"=-
                "Depend50"=-

When the registry files are merged, reginit.ini will have the deletion entries later than the insertion entries, so explorer.exe will not automatically start.
The delete value entry can also be used to remove messages in makeimg.  The example of changing Storage Card to SD Card will produce this message:
 regcomp: Overwriting existing value [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\SDMemory] "Folder" in system registry
This message can be avoided by adding:
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\SDMemory]
                 "Folder"=-  ; remove message from makeimg output
                 "Folder"="SD Card"  ; change the name to SD Card
Deleting Keys in the Registry
You can delete keys, using:
        [-key name]
Example of deleting a key by adding the following to project.reg: 
; Shut off the FTP server
[-HKEY_LOCAL_MACHINE\Services\FTPD]
[-HKEY_LOCAL_MACHINE\COMM\FTPD]
the FTP server will not be started.  I used this one to satisfy a requirement to include the FTP server, but to not have it automatically start when the system boots.
Getting your changes into the OS Image
Now that you have edited the registry file, you will need to build the changes into the registry within the OS image.  To do this you will first need to copy the changed file to the _FLATRELEASEDIR.  The easiest, but slowest way to copy the file is to run buildrel (from the Platform Builder menu "Copy files to Release Directory"), but you can also use Windows Explorer or any other method to copy the changed file.
Once your changed registry file is in the _FLATRELEASEDIR, run makeimg (from the Platform Builder menu "Make Run-time Image".)
You may also want to look at Summary of Registry Posts
Tags: 
 
Copyright © 2008 – Bruce Eitman
All Rights Reserved