Compartilhar via


Registry File (Compact 2013)

3/26/2014

Makeimg.exe uses registry (.reg) files to establish the registry entries for a run-time image.

Platform.reg defines the hardware registry settings for the target device, and Project.reg defines the registry settings for the Windows Embedded Compact-based executable files.

The registry files have the following format.

[KEY1]
"ValueName1"={Value Type}:{data}
"ValueName2"={Value Type}:{data}
[KEY2]
"ValueName1"={Value Type}:{data}
...

You can specify the default value names by using the following format.

[KEY1]
@ = "default value name" 

If any registry value names or data use slashes, such as the location of a directory on a server, you must use a second slash to escape each existing backward slash. This is also necessary if the value names or data include quote marks. However, this format of slashes used to escape in value names or data does not apply to registry keys.

As an example, if a registry value name or data contains the string \\root\dir1\dir2 into a registry value name or data, you must use the following format.

\\\\root\\dir\\dir2

The following example shows the format to use if a registry value name or data contains quotes or slashes.

[HKEY_LOCAL_MACHINE\key1\key2]
"slashes\\in\\the\\name" = "slashes\\in\\the\\data"
"quotes\"in\"the\"name" = "quotes\"in\"the\"data"

The following table shows the possible value types.

Value type

Format

REG_SZ

"my string"

REG_DWORD

dword: NNNNN (hex number)

Type is always interpreted as a hex value.

REG_MULTI_SZ

multi_sz: "my string", "my string"

REG_BINARY

hex: xx,xx,xx,xx ...

HEX

hex(xxxxxxxx): xx,xx,xx,xx

The hex(xx) types should correspond to the remaining Microsoft® Win32® registry types.

You can also use IF/ENDIF keywords to include a block of registry settings when an environment variable is set or equal to a particular value.

To include a block of registry settings when an environment variable is not set or is not equal to a specific value, use a space and an exclamation point (!) at the end of the line.

IF/ENDIF blocks can be nested.

IF/ENDIF keywords have the following format.

IF environment variable [= value] [!]
[KEY1]
"ValueName1"={Value Type}:{data}
"ValueName2"={Value Type}:{data}
[KEY2]
"ValueName1"={Value Type}:{data}
...
ENDIF

Use the semicolon (;) to start a line of comments.

The following table shows the tasks you can perform in the registry.

Task

Description

Creating a registry entry

To create a registry entry, update the registry file using the following syntax.

[Key1]
"ValueName"="Value Type"

Deleting a registry key

To delete a registry key, place a dash (-) before the key name, using the following format.

[-KEY1]

Deleting a registry value

To delete a value, place a dash (-) after the value's equal sign, using the following format.

"ValueName1"=-

Example

The following registry key example shows how you can add entries to the registry to create a key with a value set to a string value. In the example, if the IMGNOCONDEXAMPLE environment variable is not set, an additional subkey and value are entered into the registry.

[HKEY_LOCAL_MACHINE\RegExample]
"MyValue"="MyString"
IF IMGNOCONDEXAMPLE !
[HKEY_LOCAL_MACHINE\RegExample\ConditionalSubKey]
"MyString"="This is a string"
ENDIF

Remarks

Makeimg.exe processes all .reg files to create a single file, Reginit.ini, which forms the basis for the system registry. When all of the .reg files are merged, duplicate entries result in a warning that indicates a duplicate entry in the final Reginit.ini file. This is because duplicate entries in .reg files that are processed later overwrite entries in the preceding .reg files. The last version of the duplicated data is the version created and stored in the real registry.

The duplicate entry warning always appears when registry entries are overwritten. The following example shows a duplicate entry warning created by Makeimg.exe.

regcomp: Deleting existing value
[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\KEYBD] "ContLessVKey" in system registry
regcomp: Deleting existing value
[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\KEYBD] "ContMoreVKey" in system registry
regcomp: Overwriting existing value
[HKEY_LOCAL_MACHINE\System\StorageManager] "PNPUnloadDelay" in system registry

In some cases, the duplication can be valid, and the OEM should verify the duplication.

The hive-based registry requires that .reg files have additional tags included. These tags identify what parts of the registry are contained in the boot hive file. Each registry entry that must be set in the boot hive to boot the device must be wrapped with the following tag.

; HIVE BOOT SECTION
 ... reg data...
; END HIVE BOOT SECTION

If you want to make changes in a BSP's FILES directory, you can reduce the turnaround time that is required by a full clean and rebuild. To do this, you can modify the .bib and .registry files and then run Makeimg. However, Makeimg does not copy the .bib and .reg files from the \Platform directory to the flat release directory.

There are two methods that you can use to propagate your changes.

  • Manually copy the changed .bib and .reg files to the flat release directory before running Makeimg.

- or -

  • Make the changes in the flat release directory until the desired results are achieved, and then propagate these changes back into the \Platform directory. This ensures that your changes are not lost.

See Also

Concepts

Platform Builder User Interface