Mozilla Profile registry.dat File Format

This document describes the file format of the loved/hated registry.dat file.

Overview

The registry file begins with a file header, followed by a tree. The tree consist of keys, each may containing one or more sub-keys. Each key may also contain entries. Both entries and keys have names. Entries also have values associated.

The registry file is in an optimized binary format. Consequently this document may be confusing on the first or second read. Byte-by-byte analysis of a sample file is provided. You are recommendated to print out the sample file analysis and consult it when you read this document.

File Header

The file header begins with with a 32-bit constant (0x76644441L) which identifies the file as a Registry.

The next two fields, major_version and minor_version signifies the file version. major_version is for incompatible changes and must be the same. minor_vesion is for backward-compatible changes.

The next field, next_avail, establishes where the next new node can be inserted. If a node has been deleted, this field points to that node. Otherwise this field points to one byte after the end of the file.

The last field, root_node, points to the location of the root node (node /).

Nodes

Each node has an associated name. The node and its name may or may not be stored together. In a clean registry, name is typically stored right before the node.

A node may follow two structures. If the node is a key, then its structure is as followed:

locationlong
name_locationlong
name_lengthshort
typeshort
leftlong
subkeylong
entrylong
--long
parentlong

If the node is an entry, then its structure is:

locationlong
name_locationlong
name_lengthshort
typeshort
leftlong
value_lengthlong
value_locationlong
value_lengthlong
parentlong

A node begins with the field location. The value points to the offset of that field for verifictaion purpose.

The next field is name_location. The value points to where the node name is stored. Next is name_length which stores the length of the node name (including the null terminating charactor).

The next field, type, determines if the node is a key or an entry. The value is compared against an integer mask, which may be:

Users root key0x01
Common root key0x02
Current user root key0x03
Private root key0x04
UTF string entry0x0010 + 1
32-bit integer entry0x0010 + 2
byte entry entry0x0010 + 3
file entry0x0010 + 4

The next field is left which points to the next sibling node. The value is 0 if there is no next node at the same level.

The last field, parent, points to the location of the parent node. The value is 0 if there is no parent.

For a key node, subkey points to the location of the first sub-key, and entry points to the first entry of the key.

For an entry node, value_location points to the location of the entry value and the two duplicate value_length fields specify the byte-length of the value.

Sample file

At the end of this document is portions of an actual registry file. The sample has the following structure:

(o)-+ /
   (o)-+ Users
   (o)-+ Common
      (o)-+ Profiles
         [] CurrentProfile: default
         [] AutoStartWithLast: 0
         (o)-+ default
   (o)-+ Version Registry
   (o)-+ Private Arenas
Sample File
offsetraw datafieldvalue
file header
00041 44 64 76 magic number0x76644441L
00401 00 version major1
00602 00 version minor2
0082B 04 00 00 next available node1067
01282 00 00 00 root node130
Reserved space
01600
: 00
12700
key /
1282F 00 name/
13082 00 00 00 location130
13480 00 00 00 name location128
13802 00 name length2
14001 00 type0x01 (user key)
14200 00 00 00 left0, no sibling key
146A8 00 00 00 subkey168, first sub-key is Users
15000 00 00 00 entry0, no entry
15400 00 00 00 ---
15800 00 00 00 parent0, no parent key
key Users
16255 73 .. 00nameUsers
168A8 00 00 00 location168
172A2 00 00 00 name location162
17606 00 name length6
17801 00 type0x01 (user key)
180CF 00 00 00 left207, the next sibling key is Common
18400 00 00 00 subkey0, there is no sub-key
18800 00 00 00 entry0, no entry
19200 00 00 00 ---
19682 00 00 00 parent130, the parent is /
key Common
20043 6F .. 00nameCommon
207CF 00 00 00 location207
211C8 00 00 00 name location200
21507 00 name length7
21701 00 type0x01 (user key)
21900 01 00 00 left256, the next sibling key is Version Registry (not shown)
22358 01 00 00 subkey344, the next sub-key is Profiles
22700 00 00 00 entry0, no entry
23100 00 00 00 ---
23582 00 00 00 parent130, the parent is /
key Profiles
33550 72 .. 00nameProfiles
34458 01 00 00 location344
3484F 01 00 00 name location335
35209 00 name length9
35401 00 type0x01 (user key)
35600 00 00 00 left0, no sibling key
36012 02 00 00 subkey530, the first sub-key is default (not shown)
2760B 04 00 00 entry1035, the first entry is CurrentProfile
28000 00 00 00 ---
284CF 00 00 00 parent207, the parent is Common
key AutoStartWithLast
46841 75 .. 00nameAutoStartWithLast
48600 00 00 00valuefalse
490EA 01 00 00 location490
494D1 01 00 00 name location468
49812 00 name length18
35412 00 type0x02 (32-bit integer)
356B4 01 00 00 left436, the next entry is HavePregInfo (not shown)
36004 00 00 00 value_length4, the byte-length of value
276E6 01 00 00 value_location1027, the value is at offset 1027
28004 00 00 00 value_length4, the byte-length of value
28458 01 00 00 parent344, the parent is Profile
entry CurrentProfile
101243 75 .. 00nameCurrentProfile
102764 65 .. 00valuedefault
10350B 04 00 00 location1035
1039F4 03 00 00 name location1012
10430F 00 name length15, the length of name
104511 00 type0x11 (UTF string entry)
1047EA 01 00 00 left490, the next entry is AutoStartWithLast
105108 00 00 00 value_length8, the length of value
105503 04 00 00 value_location1027, the value is at offset 1027
105908 00 00 00 value_length8, the length of value
106358 01 00 00 parent344, the parent is Profile
1