2 Definitions for the REGF registry file format as used by
5 Written by Jelmer Vernooij, 2005
7 Based on two files from Samba 3:
8 regedit.c by Richard Sharpe
9 regfio.c by Jerry Carter
11 Thanks to Wilco Baan Hofman for some of the info on li and ri fields.
23 /* 1.3.0.1 for WinNT 4
29 "regf" is obviously the abbreviation for "Registry file". "regf" is the
30 signature of the header-block which is always 4kb in size, although only
31 the first 64 bytes seem to be used and a checksum is calculated over
32 the first 0x200 bytes only!
35 typedef [public] struct {
36 [charset(DOS)] uint8 REGF_ID[4]; /* 'regf' */
37 uint32 update_counter1;
38 uint32 update_counter2;
43 [value(1)] uint32 uk7; /* 1 */
44 [charset(UTF16)] uint16 description[0x40];
45 uint32 padding[83]; /* Padding */
46 /* Checksum of first 0x200 bytes XOR-ed */
51 hbin probably means hive-bin (what bin stands for I don't know)
52 This block is always a multiple
55 typedef [public] struct {
56 [charset(DOS)] uint8 HBIN_ID[4]; /* hbin */
57 uint32 off_from_first; /* Offset from 1st hbin-Block */
58 uint32 off_to_next; /* Offset to the next hbin-Block */
61 uint32 block_size; /* Block size */
62 uint8 data[block_size]; /* Filled with hbin_data blocks */
67 [charset(DOS)] uint8 header[2]; /* li, lh, ri, nk, vk, sk, lf or \0\0 */
78 The nk-record can be treated as a combination of tree-record and
79 key-record of the win 95 registry.
88 uint32 subkeys_offset;
96 uint16 clsname_length;
97 [charset(DOS)] uint8 key_name[name_length];
100 /* sk (? Security Key ?) is the ACL of the registry. */
107 uint8 sec_desc[rec_size];
112 uint32 base37; /* base37 of key name */
117 lh_hash hashes[key_count];
122 uint32 offset_nk[key_count];
127 uint32 offset[key_count]; /* li/lh offset */
130 /* The vk-record consists information to a single value (value key). */
133 uint32 data_length; /* If top-bit set, offset contains the data */
136 uint16 flag; /* =1, has name, else no name (=Default). */
138 [charset(DOS)] uint8 data_name[name_length];
147 The lf-record is the counterpart to the RGKN-record (the
152 hash_record hr[key_count]; /* Array of hash records, depending on key_count */