Windows registry content type

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.

  • Otherwise, the value is interpreted and stored as a string (REG_SZ).
  • 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

    Данные, представленные целым числом (4 байта, 32 бита). Многие параметры служб и драйверов устройств имеют этот тип и отображаются в двоичном, шестнадцатеричном или десятичном форматах. Эквивалентами типа DWORD являются DWORD_LITTLE_ENDIAN (самый младший байт хранится в памяти в первом числе) и REG_DWORD_BIG_ENDIAN (самый младший байт хранится в памяти в последнем числе).

    REG_EXPAND_SZ

    Расширяемая строка данных. Эта строка представляет собой текст, содержащий переменную, которая может быть заменена при вызове со стороны приложения.

    REG_MULTI_SZ

    Многострочное поле. Значения, которые фактически представляют собой списки текстовых строк в формате, удобном для восприятия человеком, обычно имеют именно этот тип данных. Записи разделяются пробелами, запятыми или другими символами.

    REG_SZ

    Текстовая строка в формате, удобном для восприятия человеком. Значениям, представляющим собой описания компонентов, обычно присваивается именно этот тип данных. Имеет фиксированную длину.

    Символическая ссылка в формате Юникод.

    REG_FULL_RESOURCE_DESCRIPTOR

    Последовательность вложенных массивов. Служит для хранения списка ресурсов, которые используются физическим устройством. Обнаруженные данные система сохраняет в разделе \HardwareDescription. В окне редактора реестра эти данные отображаются в виде двоичного параметра в шестнадцатеричном формате

    REG_RESOURCE_LIST

    Последовательность вложенных массивов. Служит для хранения списка ресурсов, которые используются драйвером устройства или управляемым им физическим устройством. Обнаруженные данные система сохраняет в разделе \ResourceMap. В окне редактора реестра эти данные отображаются в виде двоичного параметра в шестнадцатеричном формате

    REG_RESOURCE_REQUIREMENTS_LIST

    Последовательность вложенных массивов. Служит для хранения списка драйверов аппаратных ресурсов, которые могут быть использованы определенным драйвером устройства или управляемым им физическим устройством. Часть этого списка система записывает в раздел \ResourceMap. Данные определяются системой. В окне редактора реестра они отображаются в виде двоичного параметра в шестнадцатеричном формате

    REG_QWORD

    Данные, представленные в виде 64-разрядного целого. Начиная с Windows 2000, такие данные отображаются в окне редактора реестра в виде двоичного параметра

    REG_NONE

    Данные, не имеющие определенного типа. Такие данные записываются в реестр системой или приложением. В окне редактора реестра отображаются в виде двоичного параметра в шестнадцатеричном формате

    Structure of the Registry

    The registry is a hierarchical database that contains data that is critical for the operation of Windows and the applications and services that run on Windows. The data is structured in a tree format. Each node in the tree is called a key. Each key can contain both subkeys and data entries called values. Sometimes, the presence of a key is all the data that an application requires; other times, an application opens a key and uses the values associated with the key. A key can have any number of values, and the values can be in any form. For more information, see Registry Value Types and Registry Element Size Limits.

    Each key has a name consisting of one or more printable characters. Key names are not case sensitive. Key names cannot include the backslash character (), but any other printable character can be used. Value names and data can include the backslash character.

    The name of each subkey is unique with respect to the key that is immediately above it in the hierarchy. Key names are not localized into other languages, although values may be.

    The following illustration is an example registry key structure as displayed by the Registry Editor.

    Each of the trees under My Computer is a key. The HKEY_LOCAL_MACHINE key has the following subkeys: HARDWARE, SAM, SECURITY, SOFTWARE, and SYSTEM. Each of these keys in turn has subkeys. For example, the HARDWARE key has the subkeys DESCRIPTION, DEVICEMAP, and RESOURCEMAP; the DEVICEMAP key has several subkeys including VIDEO.

    Each value consists of a value name and its associated data, if any. MaxObjectNumber and VgaCompatible are values that contain data under the VIDEO subkey.

    A registry tree can be 512 levels deep. You can create up to 32 levels at a time through a single registry API call.

    Читайте также:  Microsoft windows phone free apps
    Оцените статью
    Наименование Тип данных Назначение
    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 Строковый Текст