2 Definitions for the REGF registry file format as used by
5 Copyright (C) 2005 Jelmer Vernooij, jelmer@samba.org
6 Copyright (C) 2006 Wilco Baan Hofman, wilco@baanhofman.nl
8 Based on two files from Samba 3:
9 regedit.c by Richard Sharpe
10 regfio.c by Jerry Carter
16 const int REGF_OFFSET_NONE
= 0xffffffff;
19 * Registry version number
20 * 1.2.0.1 for WinNT 3.51
25 [noprint
] struct regf_version
{
26 [value
(1)] uint32 major
;
28 [value
(0)] uint32 release
;
29 [value
(1)] uint32 build
;
33 "regf" is obviously the abbreviation for "Registry file". "regf" is the
34 signature of the header-block which is always 4kb in size, although only
35 the first 64 bytes seem to be used and a checksum is calculated over
36 the first 0x200 bytes only!
39 [public,noprint
] struct regf_hdr
{
40 [charset
(DOS
)] uint8 REGF_ID
[4]; /* 'regf' */
41 uint32 update_counter1
;
42 uint32 update_counter2
;
47 [value
(1)] uint32 uk7
; /* 1 */
48 [charset
(UTF16
)] uint16 description
[0x20];
49 uint32 padding
[99]; /* Padding */
50 /* Checksum of first 0x200 bytes XOR-ed */
55 hbin probably means hive-bin (i.e. hive-container)
56 This block is always a multiple
59 [public,noprint
] struct hbin_block
{
60 [charset
(DOS
)] uint8 HBIN_ID
[4]; /* hbin */
61 uint32 offset_from_first
; /* Offset from 1st hbin-Block */
62 uint32 offset_to_next
; /* Offset to the next hbin-Block */
65 uint32 block_size
; /* Block size (including the header!) */
66 uint8 data
[offset_to_next
-0x20];
67 /* data is filled with:
69 Negative if in use, positive otherwise
70 Always a multiple of 8
72 Free space marker if 0xffffffff
76 [noprint
] enum reg_key_type
{
83 The nk-record can be treated as a combination of tree-record and
84 key-record of the win 95 registry.
86 [public,noprint
] struct nk_block
{
87 [charset
(DOS
)] uint8 header
[2];
94 uint32 subkeys_offset
;
95 uint32 unknown_offset
;
97 uint32 values_offset
; /* Points to a list of offsets of vk-records */
99 uint32 clsname_offset
;
101 [value
(strlen
(key_name
))] uint16 name_length
;
102 uint16 clsname_length
;
103 [charset
(DOS
)] uint8 key_name
[name_length
];
106 /* sk (? Security Key ?) is the ACL of the registry. */
107 [noprint
,public] struct sk_block
{
108 [charset
(DOS
)] uint8 header
[2];
114 uint8 sec_desc
[rec_size
];
117 [noprint
] struct lh_hash
{
119 uint32 base37
; /* base37 of key name */
122 /* Subkey listing with hash of first 4 characters */
123 [public,noprint
] struct lh_block
{
124 [charset
(DOS
)] uint8 header
[2];
126 lh_hash hr
[key_count
];
129 [public,noprint
] struct li_block
{
130 [charset
(DOS
)] uint8 header
[2];
132 uint32 nk_offset
[key_count
];
135 [public,noprint
] struct ri_block
{
136 [charset
(DOS
)] uint8 header
[2];
138 uint32 offset
[key_count
]; /* li/lh offset */
141 /* The vk-record consists information to a single value (value key). */
142 [public,noprint
] struct vk_block
{
143 [charset
(DOS
)] uint8 header
[2];
144 [value
(strlen
(data_name
))] uint16 name_length
;
145 uint32 data_length
; /* If top-bit set, offset contains the data */
148 uint16 flag
; /* =1, has name, else no name (=Default). */
150 [charset
(DOS
)] uint8 data_name
[name_length
];
153 [noprint
] struct hash_record
{
155 [charset
(DOS
)] uint8 hash
[4];
159 The lf-record is the counterpart to the RGKN-record (the
162 [public,noprint
] struct lf_block
{
163 [charset
(DOS
)] uint8 header
[2];
165 hash_record hr
[key_count
]; /* Array of hash records, depending on key_count */