Registry Table
The Registry table holds the registry information that the application needs to set in the system registry.
The Registry table has the following columns.
Column | Type | Key | Nullable |
---|---|---|---|
Registry | Identifier | Y | N |
Root | Integer | N | N |
Key | RegPath | N | N |
Name | Formatted | N | Y |
Value | Formatted | N | Y |
Component_ | Identifier | N | N |
Columns
Primary key used to identify a registry record.
The predefined root key for the registry value. Enter a value of -1 in this field to make the root key dependent on the type of installation. Enter one of the other values in the following table to force the registry value to be written under a particular root key.
Constant | Hexadecimal | Decimal | Root key |
---|---|---|---|
(none) | — 0x001 | -1 | If this is a per-user installation, the registry value is written under HKEY_CURRENT_USER. If this is a per-machine installation, the registry value is written under HKEY_LOCAL_MACHINE. Note that a per-machine installation is specified by setting the ALLUSERS property to 1. |
msidbRegistryRootClassesRoot | 0x000 | 0 | HKEY_CLASSES_ROOTThe installer writes or removes the value from the HKCU\Software\Classes hive during installation in the per-user installation context. The installer writes or removes the value from the HKLM\Software\Classes hive during per-machine installations. |
msidbRegistryRootCurrentUser | 0x001 | 1 | HKEY_CURRENT_USER |
msidbRegistryRootLocalMachine | 0x002 | 2 | HKEY_LOCAL_MACHINE |
msidbRegistryRootUsers | 0x003 | 3 | HKEY_USERS |
Note that it is recommended that registry entries written to the HKCU hive reference a component having the RegistryKeyPath bit set in the Attributes column of the Component table. This ensures that the installer writes the necessary registry entries when there are multiple users on the same computer.
The localizable key for the registry value.
This column contains the registry value name (localizable). If this is Null, then the data entered into the Value column are written to the default registry key.
If the Value column is Null, then the strings shown in the following table in the Name column have special significance.
String | Meaning |
---|---|
+ | The key is to be created, if absent, when the component is installed. |
— | The key is to be deleted, if present, with all of its values and subkeys, when the component is uninstalled. |
* | The key is to be created, if absent, when the component is installed. Additionally, the key is to be deleted, if present, with all of its values and subkeys, when the component is uninstalled. |
Note that the RemoveRegistry table must be used if an installed registry key is to be deleted, with its values and subkeys, when the component is installed.
This column is the localizable registry value. The field is Formatted. If the value is attached to one of the following prefixes (i.e. #%value) then the value is interpreted as described in the table. Note that each prefix begins with a number sign (#). If the value begins with two or more consecutive number signs (#), the first # is ignored and value is interpreted and stored as a string.
Prefix | Meaning |
---|---|
#x | The value is interpreted and stored as a hexadecimal value (REG_BINARY). |
#% | The value is interpreted and stored as an expandable string (REG_EXPAND_SZ). |
# | The value is interpreted and stored as an integer (REG_DWORD). |
- If the value contains the sequence tilde [
], then the value is interpreted as a Null-delimited list of strings (REG_MULTI_SZ). For example, to specify a list containing the three strings a, b and c, use «a[
]c».
The sequence [
] within the value separates the individual strings and is interpreted and stored as a Null character.
If a [
] precedes the string list, the strings are to be appended to any existing registry value strings. If an appending string already occurs in the registry value, the original occurrence of the string is removed.
If a [
] follows the end of the string list, the strings are to be prepended to any existing registry value strings. If a prepending string already occurs in the registry value, the original occurrence of the string is removed.
If a [
] is at both the beginning and the end or at neither the beginning nor the end of the string list, the strings are to replace any existing registry value strings.
External key into the first column of the Component table referencing the component that controls the installation of the registry value.
Remarks
The WriteRegistryValues and RemoveRegistryValues actions in sequence tables process the information in this table. For information about using sequence tables, see Using a Sequence Table.
The registry information is written out to the system registry when the corresponding component has been selected to be installed locally or run from source.
Note that the installer removes a registry key after removing the last value or subkey under the key. To prevent an empty registry key from being removed when uninstalling, write a dummy value under the key you need to keep and enter + in the Name column. If * is in the Name column, the key is deleted, with all of its values and subkeys, when the component is removed.
A custom action can be used to add rows to the Registry table during an installation, uninstallation, or repair transaction. These rows do not persist in the Registry table and the information is only available during the current transaction. The custom action must therefore be run in every installation, uninstallation, or repair transaction that requires the information in these additional rows. The custom action must come before the RemoveRegistryValues and WriteRegistryValues actions in the action sequence.
For information on how to secure a registry key see the MsiLockPermissionsEx Table and LockPermissions Table.
Типы данных реестра
Как уже говорилось ранее, в реестре хранится громадное количество информации, включающее профили всех пользователей, сведения об установленном программном обеспечении и типах документов, которые могут быть созданы каждой программой, информация о свойствах папок и значках приложений, а также установленном оборудовании и используемых портах.
Поскольку реестр Microsoft Windows представляет собой сложную реляционную базу данных, вся информация, которая может храниться в конечных информационных контейнерах этой базы (параметрах), должна быть строго классифицирована. Классификация хранящихся в параметрах значений производится по типу данных, представляющих это значение. Всего насчитывается 11 таких типов
Раздел и подраздел могут содержать 0, 1 или несколько параметров, параметр по умолчанию, а также 0 или несколько подразделов. Каждый параметр имеет имя, тип и значение.
Три части параметра реестра всегда располагаются в определенном порядке: Имя, Тип данных, значение (например: [RegistrySizeLimit] [REG_DWORD] [0x8000000]).
В таблице, которая будет приведена ниже, содержится список типов данных, определенных и используемых Windows на сегодняшний день.
Максимальная длина имени параметра:
- 16 383 символов для Windows Server 2003, Windows XP и Windows Vista
- 260 символов ANSI или 16 383 символа Юникод для Windows 2000
- 255 символов для Windows 95, Windows 98 и Windows Millennium Edition
Значения большого размера (больше 2048 байт) хранятся во внешних файлах, а в реестр заносится имя такого файла. Это способствует повышению эффективности использования реестра.
Максимальный размер параметра:
- Вся доступная память для Windows NT 4.0/Windows 2000/Windows XP/Windows Server 2003/Windows Vista
- 16 300 байт для Windows 95, Windows 98 и Windows Millennium Edition
Наименование | Тип данных | Назначение |
REG_BINARY | Двоичный | Двоичные данные |
REG_DWORD | Числовой | Число |
REG_QWORD | Числовой | 64-разрядное числовое значение |
REG_EXPAND_SZ | Строковый | Текст и переменные |
REG_FULL_RESOURCE_DESCRIPTOR | Строковый | Идентификатор ресурса устройства |
REG_LINK | Строковый | Путь к файлу |
REG_MULTI_SZ | Многостроковый | Массив строк |
REG_NONE | Неизвестный | Зашифрованные данные |
REG_RESOURCE_LIST | Строковый | Список ресурсов устройств |
REG_RESOURCE_REQUIREMENTS_LIST | Строковый | Идентификатор ресурса устройства |
REG_SZ | Строковый | Текст |