A key node points at a list of its values: a cell holding one
4-byte offset for each value, in no required order. Each offset points at a key value (vk). This page
follows Maxim Suhanov’s Windows registry file format specification.
Key value
| Offset | Length | Field | Meaning |
|---|---|---|---|
| 0 | 2 | Signature | vk |
| 2 | 2 | Name length | Bytes; may be 0, meaning the value has no name (the default value) |
| 4 | 4 | Data size | Bytes; may be 0 (the value is not set). The most significant bit has a special meaning, below |
| 8 | 4 | Data offset | Offset of the data’s cell, or the data itself |
| 12 | 4 | Data type | Below |
| 16 | 2 | Flags | Below |
| 18 | 2 | Spare | Not used |
| 20 | … | Value name string | ASCII (extended) or UTF-16LE, see the flags |
Where the data is
When the most significant bit of the data size is 1, the data (four bytes or fewer) is stored in the data offset field itself; data shorter than four bytes is stored at the start of that field. The bit is ignored when the size is worked out. When the bit is 0 the data is in the cell the data offset points at, or, for large data, in several cells listed by a big data record in that cell.
Flags
| Mask | Name | Meaning |
|---|---|---|
0x0001 | VALUE_COMP_NAME | The name is an ASCII string, possibly extended ASCII; otherwise UTF-16LE |
0x0002 | IsTombstone | A tombstone value (Windows 10 “Redstone 1” Insider builds on): the type is REG_NONE, the size 0 and the data offset 0xFFFFFFFF |
Data types
| Value | Name |
|---|---|
0x00000000 | REG_NONE |
0x00000001 | REG_SZ |
0x00000002 | REG_EXPAND_SZ |
0x00000003 | REG_BINARY |
0x00000004 | REG_DWORD, REG_DWORD_LITTLE_ENDIAN |
0x00000005 | REG_DWORD_BIG_ENDIAN |
0x00000006 | REG_LINK |
0x00000007 | REG_MULTI_SZ |
0x00000008 | REG_RESOURCE_LIST |
0x00000009 | REG_FULL_RESOURCE_DESCRIPTOR |
0x0000000a | REG_RESOURCE_REQUIREMENTS_LIST |
0x0000000b | REG_QWORD, REG_QWORD_LITTLE_ENDIAN |
Other values are allowed as well but are not predefined. What each type holds (how a string is encoded, how a multi-string ends) is described for the text export on .REG syntax and value types; the hive specification itself only names the types. In practice the string types are UTF-16LE with a terminating zero, REG_MULTI_SZ is a run of such strings ended by an empty one, and REG_LINK holds the target path as UTF-16LE without a terminator.
Big data
Data over 16,344 bytes is stored through a big data record, used when the base block’s minor version is greater than 3. The data offset of the value points at a cell holding:
| Offset | Length | Field | Meaning |
|---|---|---|---|
| 0 | 2 | Signature | db |
| 2 | 2 | Number of segments | |
| 4 | 4 | Offset of a list of segments | Points at a cell holding the list |
The list of segments is one 4-byte offset for each segment; each offset points at a cell whose data is one segment. A segment holds at most 16,344 bytes, and every segment except the last has exactly that size. The value’s data is the segments joined in order, cut to the data size.