Registry File

Makeimg.exe uses registry (.reg) files to establish the registry entries for an OS image.

When you cold boot your target device, Filesys.exe uses the registry files to create a default registry.

Platform.reg defines the hardware registry settings for the target device, and Project.reg defines the registry settings for the Windows CE-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" 

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, which execute a block of registry settings when an environment variable is set or equal to a particular value.

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

IF/ENDIF blocks can be nested.

The 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 code example shows how you can add entries to the registry that create a new key with a new value set to a string value. In this 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

When Makeimg.exe processes all registry (.reg) files to create a single file, any duplicate entries found result in a warning message. The message indicates a duplicate entry in the final .reg file, Default.fdf or System.hiv or User.hiv.

The duplication may be valid in some cases. The OEM should verify the duplication.

When the OS cold boots, as in the case of the Default.fdf file, the last version of the duplicated data is the version that is created and stored in the real registry. In the case of the .HIV files, the data contained in it is the last version found during Makeimg.exe.

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

See Also

How to Create a Device Driver

 Last updated on Friday, October 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.