r10207: Add some const
[bbaumbach/samba-autobuild/.git] / source4 / lib / registry / regf.idl
1 /*
2  Definitions for the REGF registry file format as used by 
3  Windows NT4 and above. 
4
5  Written by Jelmer Vernooij, 2005
6    
7  Based on two files from Samba 3:
8         regedit.c by Richard Sharpe
9     regfio.c by Jerry Carter
10  
11  Thanks to Wilco Baan Hofman for some of the info on li and ri fields.
12 */
13
14 interface regf
15 {
16         const int REGF_OFFSET_NONE = 0xffffffff;
17
18         /* 
19          * Registry version number
20          * 1.3.0.1 for WinNT 4
21          * 1.5.0.1 for WinXP
22          */
23         
24         typedef [noprint] struct {
25                 [value(1)] uint32 major; 
26                 [value(3)] uint32 minor;
27                 [value(0)] uint32 release;
28                 [value(1)] uint32 build;
29         } regf_version;
30
31         /* 
32                 "regf" is obviously the abbreviation for "Registry file". "regf" is the
33                 signature of the header-block which is always 4kb in size, although only
34                 the first 64 bytes seem to be used and a checksum is calculated over
35                 the first 0x200 bytes only!
36          */
37         
38         typedef [public,noprint] struct {
39                 [charset(DOS)] uint8 REGF_ID[4];     /* 'regf' */
40                 uint32 update_counter1;
41                 uint32 update_counter2;
42                 NTTIME modtime;
43                 regf_version version;
44                 uint32 data_offset;       
45                 uint32 last_block;
46                 [value(1)] uint32 uk7;                  /* 1 */
47                 [charset(UTF16)] uint16 description[0x40];
48                 uint32 padding[83];                                     /* Padding */
49                 /* Checksum of first 0x200 bytes XOR-ed */
50                 uint32 chksum;  
51         } regf_hdr;
52
53         /* 
54                 hbin probably means hive-bin (i.e. hive-container)
55                 This block is always a multiple
56                 of 4kb in size.
57      */
58         typedef [public,noprint] struct {
59                 [charset(DOS)] uint8 HBIN_ID[4]; /* hbin */
60                 uint32 offset_from_first; /* Offset from 1st hbin-Block */
61                 uint32 offset_to_next;    /* Offset to the next hbin-Block */
62                 uint32 unknown[2];
63                 NTTIME last_change;
64                 uint32 block_size;         /* Block size (including the header!) */
65                 uint8 data[offset_to_next-0x20]; 
66                 /* data is filled with:
67                         uint32 length;                  
68                                 Negative if in used, positive otherwise
69                                 Always a multiple of 8
70                         uint8_t data[length];  
71                                 Free space marker if 0xffffffff
72              */
73         } hbin_block;
74
75         typedef [base_type(uint16),noprint] enum { 
76                 REG_ROOT_KEY = 0x20, 
77                 REG_SUB_KEY  = 0x2C, 
78                 REG_SYM_LINK = 0x10 
79         } reg_key_type;
80
81         /*
82       The nk-record can be treated as a combination of tree-record and
83       key-record of the win 95 registry.
84         */
85         typedef [public,noprint] struct {
86                 [charset(DOS)] uint8 header[2];
87                 reg_key_type type;
88                 NTTIME last_change;
89                 uint32 uk1;
90                 uint32 parent_offset;
91                 uint32 num_subkeys;
92                 uint32 uk2;
93                 uint32 subkeys_offset;
94                 uint32 unknown_offset;
95                 uint32 num_values;
96                 uint32 values_offset; /* Points to a list of offsets of vk-records */
97                 uint32 sk_offset;
98                 uint32 clsname_offset;
99                 uint32 unk3[5];
100                 [value(strlen(key_name))] uint16 name_length;
101                 uint16 clsname_length;
102                 [charset(DOS)] uint8 key_name[name_length];  
103         } nk_block;
104
105         /* sk (? Security Key ?) is the ACL of the registry. */
106         typedef [noprint,public] struct {
107                 [charset(DOS)] uint8 header[2];
108                 uint16 tag;
109                 uint32 prev_offset;
110                 uint32 next_offset;
111                 uint32 ref_cnt;
112                 uint32 rec_size;
113                 uint8 sec_desc[rec_size]; 
114         } sk_block;
115
116         typedef [noprint,nopush,nopull] struct {
117                         uint32 offset_nk;
118                         uint32 base37; /* base37 of key name */
119         } lh_hash;
120         
121         /* Subkey listing with hash of first 4 characters */
122         typedef [noprint,nopush,nopull] struct {
123                 [charset(DOS)] uint8 header[2];
124                 uint16 key_count;
125                 lh_hash hashes[key_count];
126         } lh_block;
127
128         typedef [noprint,nopush,nopull] struct {
129                 [charset(DOS)] uint8 header[2];
130                 uint16 key_count;
131                 uint32 offset_nk[key_count];
132         } li_block;
133
134         typedef [noprint,nopush,nopull] struct {
135                 [charset(DOS)] uint8 header[2];
136                 uint16 key_count;
137                 uint32 offset[key_count]; /* li/lh offset */
138         } ri_block;
139
140         /* The vk-record consists information to a single value (value key). */
141         typedef [public,noprint] struct {
142                 [charset(DOS)] uint8 header[2];
143                 [value(strlen(data_name))] uint16 name_length;
144                 uint32 data_length;    /* If top-bit set, offset contains the data */
145                 uint32 data_offset;
146                 uint32 data_type;
147                 uint16 flag;        /* =1, has name, else no name (=Default). */
148                 uint16 unk1;
149                 [charset(DOS)] uint8 data_name[name_length];
150         } vk_block;
151
152         typedef [noprint] struct {
153                 uint32 nk_off;
154                 [charset(DOS)] uint8 hash[4];
155         } hash_record;
156
157         /*
158       The lf-record is the counterpart to the RGKN-record (the
159       hash-function)
160         */
161         typedef [public,noprint] struct {
162                 [charset(DOS)] uint8 header[2];
163                 uint16 key_count;
164                 hash_record hr[key_count];  /* Array of hash records, depending on key_count */
165         } lf_block;
166 }