rubrapack Manual←↑

41 Registry hive files (REGF)

The file format of Registry.dat and User.dat in an MSIX package. Microsoft does not publish it; every fact here is [observed]: hives written by Windows' Offline Registry Library (offreg.dll, 10.0.26100, the writer Windows' packaging tools use - its mark is in the base block) for chosen key/value sets, and rubrapack's hives for the same sets read back on Windows with OROpenHive and RegLoadAppKey into exactly the keys and values Windows enumerates in its own. Only what a freshly written hive needs is described: no transaction logs, no volatile keys, no free-cell reuse.

41.1 Layout#

41.2 The base block#

OffsetFieldValue
0signatureregf
4, 8sequence numbers1, 1 (unequal = not closed cleanly; readers refuse or replay a log)
12u64 time0 is accepted
20, 24version1, 5
28, 32type, format0, 1
36root key cell offset
40size of all bins
44clustering1
0xB0offreg's markOfRg, then u32 1
508checksumXOR of the 127 dwords before it; 0 is written as 1, 0xFFFFFFFF as 0xFFFFFFFE

Everything else is zero.

41.3 Keys (nk)#

nk, u16 flags, u64 time, u32 access bits (0), u32 parent (none for the root), u32 subkey count, u32 volatile subkey count (0), u32 subkey list, u32 volatile list (none), u32 value count, u32 value list, u32 security cell, u32 class (none), u32 longest subkey name, u32 longest class (0), u32 longest value name, u32 largest value data, u32 work var (0), u16 name length, u16 class length (0), then the name.

41.4 Subkey lists (lh, ri)#

41.5 Values (vk) and value lists#

41.6 The security cell (sk)#

One sk cell shared by every key: sk, u16 0, u32 next and u32 previous (both itself), u32 reference count (the number of keys), u32 descriptor length, then a self-relative security descriptor. offreg's: owner and group Administrators; SYSTEM and Administrators full access, Everyone and RESTRICTED read, all container-inherit.

41.7 Reproducible hives#

With every time field 0 and cells laid out depth first (a key; after the root key the security cell; the key's subkey lists, its value list, each value followed by its data; then its subkeys in sorted order), the same keys and values give the same bytes on any host. Windows reads such a hive without complaint.