changed syntax of registry commands so keys can start with HKLM or HKU.
[tprouty/samba.git] / source / include / rpc_reg.h
1 /* 
2    Unix SMB/Netbios implementation.
3    Version 1.9.
4    SMB parameters and setup
5    Copyright (C) Andrew Tridgell 1992-1997
6    Copyright (C) Luke Kenneth Casson Leighton 1996-1997
7    Copyright (C) Paul Ashton 1997
8    
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24 #ifndef _RPC_REG_H /* _RPC_REG_H */
25 #define _RPC_REG_H 
26
27
28 /* winreg pipe defines */
29 #define REG_OPEN_HKLM       0x02
30 #define REG_OPEN_HKU        0x04
31 #define REG_FLUSH_KEY       0x0B
32 #define REG_UNK_1A          0x1a
33 #define REG_QUERY_KEY       0x10
34 #define REG_ENUM_KEY        0x09
35 #define REG_CREATE_KEY      0x06
36 #define REG_DELETE_KEY      0x07
37 #define REG_DELETE_VALUE    0x08
38 #define REG_CREATE_VALUE    0x16
39 #define REG_GET_KEY_SEC     0x0c
40 #define REG_ENUM_VALUE      0x0a
41 #define REG_OPEN_ENTRY      0x0f
42 #define REG_INFO            0x11
43 #define REG_CLOSE           0x05
44
45 #define HKEY_LOCAL_MACHINE 0x80000000
46 #define HKEY_USERS         0x80000003
47
48 /* REG_Q_OPEN_HKLM   */
49 typedef struct q_reg_open_policy_info
50 {
51         uint32 ptr;
52         uint16 unknown_0; /* 0xE084      - 16 bit unknown */
53         uint16 unknown_1; /* random.  changes */
54         uint32 level;     /* 0x0000 0002 - 32 bit unknown */
55
56 } REG_Q_OPEN_HKLM  ;
57
58 /* REG_R_OPEN_HKLM   */
59 typedef struct r_reg_open_policy_info
60 {
61         POLICY_HND pol;       /* policy handle */
62         uint32 status;         /* return status */
63
64 } REG_R_OPEN_HKLM;
65
66
67 /* REG_Q_OPEN_HKU */
68 typedef struct q_reg_open_unk4_info
69 {
70         uint32 ptr;
71         uint16 unknown_0; /* 0xE084      - 16 bit unknown */
72         uint16 unknown_1; /* random.  changes */
73         uint32 level;     /* 0x0000 0002 - 32 bit unknown */
74
75 } REG_Q_OPEN_HKU;
76
77 /* REG_R_OPEN_HKU */
78 typedef struct r_reg_open_unk4_info
79 {
80         POLICY_HND pol;       /* policy handle */
81         uint32 status;         /* return status */
82
83 } REG_R_OPEN_HKU;
84
85
86 /* REG_Q_FLUSH_KEY */
87 typedef struct q_reg_open_flush_key_info
88 {
89         POLICY_HND pol;       /* policy handle */
90
91 } REG_Q_FLUSH_KEY;
92
93 /* REG_R_FLUSH_KEY */
94 typedef struct r_reg_open_flush_key_info
95 {
96         uint32 status;         /* return status */
97
98 } REG_R_FLUSH_KEY;
99
100
101 /* REG_Q_GET_KEY_SEC */
102 typedef struct q_reg_get_key_sec_info
103 {
104         POLICY_HND pol;         /* policy handle */
105
106         uint32 unknown;       /* 0x0000 0007 */
107
108         uint32 ptr;       /* pointer */
109         BUFHDR hdr_sec;    /* header for security data */
110         SEC_DESC_BUF *data;    /* security data */
111         
112 } REG_Q_GET_KEY_SEC;
113
114 /* REG_R_GET_KEY_SEC */
115 typedef struct r_reg_get_key_sec_info
116 {
117         uint32 unknown;       /* 0x0000 0007 */
118
119         uint32 ptr;       /* pointer */
120         BUFHDR hdr_sec;    /* header for security data */
121         SEC_DESC_BUF *data;    /* security data */
122
123         uint32 status;
124         
125 } REG_R_GET_KEY_SEC;
126
127 /* REG_Q_CREATE_VALUE */
128 typedef struct q_reg_create_value_info
129 {
130         POLICY_HND pol;    /* policy handle */
131
132         UNIHDR hdr_name;   /* name of value */
133         UNISTR2 uni_name;
134
135         uint32 type;       /* 1 = UNISTR, 3 = BYTES, 4 = DWORD, 7 = MULTI_UNISTR */
136
137         BUFFER3 *buf_value; /* value, in byte buffer */
138
139 } REG_Q_CREATE_VALUE;
140
141 /* REG_R_CREATE_VALUE */
142 typedef struct r_reg_create_value_info
143
144         uint32 status;         /* return status */
145
146 } REG_R_CREATE_VALUE;
147
148 /* REG_Q_ENUM_VALUE */
149 typedef struct q_reg_query_value_info
150 {
151         POLICY_HND pol;    /* policy handle */
152
153         uint32 val_index;  /* index */
154
155         UNIHDR hdr_name;   /* name of value */
156         UNISTR2 uni_name;
157
158         uint32 ptr_type;   /* pointer */
159         uint32 type;       /* 1 = UNISTR, 3 = BYTES, 4 = DWORD, 7 = MULTI_UNISTR */
160
161         uint32 ptr_value;  /* pointer */
162         BUFFER2 buf_value; /* value, in byte buffer */
163
164         uint32 ptr1;       /* pointer */
165         uint32 len_value1; /* */
166
167         uint32 ptr2;       /* pointer */
168         uint32 len_value2; /* */
169
170 } REG_Q_ENUM_VALUE;
171
172 /* REG_R_ENUM_VALUE */
173 typedef struct r_reg_enum_value_info
174
175         UNIHDR hdr_name;        /* name of value */
176         UNISTR2 uni_name;
177
178         uint32 ptr_type;            /* pointer */
179         uint32 type;        /* 1 = UNISTR, 3 = BYTES, 4 = DWORD, 7 = MULTI_UNISTR */
180
181         uint32 ptr_value;       /* pointer */
182         BUFFER2 *buf_value;    /* value, in byte buffer */
183
184         uint32 ptr1;            /* pointer */
185         uint32 len_value1;       /* */
186
187         uint32 ptr2;            /* pointer */
188         uint32 len_value2;       /* */
189
190         uint32 status;         /* return status */
191
192 } REG_R_ENUM_VALUE;
193
194 /* REG_Q_CREATE_KEY */
195 typedef struct q_reg_create_key_info
196 {
197         POLICY_HND pnt_pol;       /* parent key policy handle */
198
199         UNIHDR hdr_name;
200         UNISTR2 uni_name;
201
202         UNIHDR hdr_class;
203         UNISTR2 uni_class;
204
205         uint32 reserved; /* 0x0000 0000 */
206         SEC_INFO sam_access; /* access rights flags, see rpc_secdes.h */
207
208         uint32 ptr1;
209         uint32 unknown_0; /* 0x0000 000C */
210
211         uint32 ptr2;
212         uint32 sec_len1; /* 0x14 - length of security descriptor, bytes */
213         uint32 sec_len2; /* 0x14 - length of security descriptor, bytes */
214         uint32 sec_len3; /* 0x0 - length of security descriptor, bytes */
215         uint32 sec_len4; /* 0x14 - length of security descriptor, bytes */
216         uint32 sec_len5; /* 0x0 - length of security descriptor, bytes */
217         uint32 sec_len6; /* 0x14 - length of security descriptor, bytes */
218 #if 0
219         SEC_DES sec_desc;
220 #else
221         uint8 buf_unk[20];  /* 01 00 00 80   00 00 00 00   00 00 00 00   00 00 00 00   00 00 00 00  */
222 #endif
223
224         uint32 unknown_2; /* 0x0000 0000 */
225
226 } REG_Q_CREATE_KEY;
227
228 /* REG_R_CREATE_KEY */
229 typedef struct r_reg_create_key_info
230 {
231         POLICY_HND key_pol;       /* policy handle */
232         uint32 unknown; /* 0x0000 0000 */
233
234         uint32 status;         /* return status */
235
236 } REG_R_CREATE_KEY;
237
238 /* REG_Q_DELETE_KEY */
239 typedef struct q_reg_delete_key_info
240 {
241         POLICY_HND pnt_pol;       /* parent key policy handle */
242
243         UNIHDR hdr_name;
244         UNISTR2 uni_name;
245 } REG_Q_DELETE_KEY;
246
247 /* REG_R_DELETE_KEY */
248 typedef struct r_reg_delete_key_info
249 {
250         POLICY_HND key_pol;       /* policy handle */
251
252         uint32 status;         /* return status */
253
254 } REG_R_DELETE_KEY;
255
256 /* REG_Q_DELETE_VALUE */
257 typedef struct q_reg_delete_val_info
258 {
259         POLICY_HND pnt_pol;       /* parent key policy handle */
260
261         UNIHDR hdr_name;
262         UNISTR2 uni_name;
263
264 } REG_Q_DELETE_VALUE;
265
266 /* REG_R_DELETE_VALUE */
267 typedef struct r_reg_delete_val_info
268 {
269         POLICY_HND key_pol;       /* policy handle */
270
271         uint32 status;         /* return status */
272
273 } REG_R_DELETE_VALUE;
274
275 /* REG_Q_QUERY_KEY */
276 typedef struct q_reg_query_info
277 {
278         POLICY_HND pol;       /* policy handle */
279         UNIHDR hdr_class;
280         UNISTR2 uni_class;
281
282 } REG_Q_QUERY_KEY;
283
284 /* REG_R_QUERY_KEY */
285 typedef struct r_reg_query_key_info
286 {
287         UNIHDR hdr_class;
288         UNISTR2 uni_class;
289
290         uint32 num_subkeys;
291         uint32 max_subkeylen;
292         uint32 max_subkeysize; /* 0x0000 0000 */
293         uint32 num_values;
294         uint32 max_valnamelen;
295         uint32 max_valbufsize; 
296         uint32 sec_desc; /* 0x0000 0078 */
297         NTTIME mod_time;  /* modified time */
298
299         uint32 status;         /* return status */
300
301 } REG_R_QUERY_KEY;
302
303
304 /* REG_Q_UNK_1A */
305 typedef struct q_reg_unk_1a_info
306 {
307         POLICY_HND pol;       /* policy handle */
308
309 } REG_Q_UNK_1A;
310
311 /* REG_R_UNK_1A */
312 typedef struct r_reg_unk_1a_info
313 {
314         uint32 unknown;         /* 0x0500 0000 */
315         uint32 status;         /* return status */
316
317 } REG_R_UNK_1A;
318
319
320 /* REG_Q_CLOSE */
321 typedef struct reg_q_close_info
322 {
323         POLICY_HND pol; /* policy handle */
324
325 } REG_Q_CLOSE;
326
327 /* REG_R_CLOSE */
328 typedef struct reg_r_close_info
329 {
330         POLICY_HND pol; /* policy handle.  should be all zeros. */
331
332         uint32 status; /* return code */
333
334 } REG_R_CLOSE;
335
336
337 /* REG_Q_ENUM_KEY */
338 typedef struct q_reg_enum_value_info
339 {
340         POLICY_HND pol;         /* policy handle */
341
342         uint32 key_index;       
343
344         uint16 key_name_len;    /* 0x0000 */
345         uint16 unknown_1;       /* 0x0414 */
346
347         uint32 ptr1;            /* pointer */
348         uint32 unknown_2;       /* 0x0000 020A */
349         uint8  pad1[8];         /* padding - zeros */
350
351         uint32 ptr2;            /* pointer */
352         uint8  pad2[8];         /* padding - zeros */
353
354         uint32 ptr3;            /* pointer */
355         NTTIME time;            /* current time? */
356
357 } REG_Q_ENUM_KEY;
358
359 /* REG_R_ENUM_KEY */
360 typedef struct r_reg_enum_key_info
361
362         uint16 key_name_len;    /* number of bytes in key name */
363         uint16 unknown_1;       /* 0x0414 - matches with query unknown_1 */
364
365         uint32 ptr1;            /* pointer */
366         uint32 unknown_2;       /* 0x0000 020A */
367         uint32 unknown_3;       /* 0x0000 0000 */
368
369         UNISTR3 key_name;
370
371         uint32 ptr2;            /* pointer */
372         uint8  pad2[8];         /* padding - zeros */
373
374         uint32 ptr3;            /* pointer */
375         NTTIME time;            /* current time? */
376
377         uint32 status;         /* return status */
378
379 } REG_R_ENUM_KEY;
380
381
382 /* REG_Q_INFO */
383 typedef struct q_reg_info_info
384 {
385         POLICY_HND pol;        /* policy handle */
386
387         UNIHDR  hdr_type;       /* unicode product type header */
388         UNISTR2 uni_type;       /* unicode product type - "ProductType" */
389
390         uint32 ptr1;            /* pointer */
391         NTTIME time;            /* current time? */
392         uint8  major_version1;  /* 0x4 - os major version? */
393         uint8  minor_version1;  /* 0x1 - os minor version? */
394         uint8  pad1[10];        /* padding - zeros */
395
396         uint32 ptr2;            /* pointer */
397         uint8  major_version2;  /* 0x4 - os major version? */
398         uint8  minor_version2;  /* 0x1 - os minor version? */
399         uint8  pad2[2];         /* padding - zeros */
400
401         uint32 ptr3;            /* pointer */
402         uint32 unknown;         /* 0x0000 0000 */
403
404 } REG_Q_INFO;
405
406 /* REG_R_INFO */
407 typedef struct r_reg_info_info
408
409         uint32 ptr1;            /* buffer pointer */
410         uint32 level;          /* 0x1 - info level? */
411
412         uint32 ptr_type;       /* pointer to o/s type */
413         BUFFER2 uni_type;      /* unicode string o/s type - "LanmanNT" */
414
415         uint32 ptr2;           /* pointer to unknown_0 */
416         uint32 unknown_0;      /* 0x12 */
417
418         uint32 ptr3;           /* pointer to unknown_1 */
419         uint32 unknown_1;      /* 0x12 */
420
421         uint32 status;         /* return status */
422
423 } REG_R_INFO;
424
425
426 /* REG_Q_OPEN_ENTRY */
427 typedef struct q_reg_open_entry_info
428 {
429         POLICY_HND pol;        /* policy handle */
430
431         UNIHDR  hdr_name;       /* unicode registry string header */
432         UNISTR2 uni_name;       /* unicode registry string name */
433
434         uint32 unknown_0;       /* 32 bit unknown - 0x0000 0000 */
435         uint32 unknown_1;       /* 32 bit unknown - 0x0200 0000 */
436
437 } REG_Q_OPEN_ENTRY;
438
439
440
441 /* REG_R_OPEN_ENTRY */
442 typedef struct r_reg_open_entry_info
443 {
444         POLICY_HND pol;       /* policy handle */
445         uint32 status;         /* return status */
446
447 } REG_R_OPEN_ENTRY;
448
449
450
451 #endif /* _RPC_REG_H */
452