rpcclient shutdown command
[samba.git] / source3 / 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_SET_KEY_SEC     0x15
41 #define REG_ENUM_VALUE      0x0a
42 #define REG_OPEN_ENTRY      0x0f
43 #define REG_INFO            0x11
44 #define REG_CLOSE           0x05
45 #define REG_SHUTDOWN        0x18
46
47 #define HKEY_LOCAL_MACHINE 0x80000000
48 #define HKEY_USERS         0x80000003
49
50 /* REG_Q_OPEN_HKLM   */
51 typedef struct q_reg_open_policy_info
52 {
53         uint32 ptr;
54         uint16 unknown_0; /* 0xE084      - 16 bit unknown */
55         uint16 unknown_1; /* random.  changes */
56         uint32 level;     /* 0x0000 0002 - 32 bit unknown */
57
58 } REG_Q_OPEN_HKLM  ;
59
60 /* REG_R_OPEN_HKLM   */
61 typedef struct r_reg_open_policy_info
62 {
63         POLICY_HND pol;       /* policy handle */
64         uint32 status;         /* return status */
65
66 } REG_R_OPEN_HKLM;
67
68
69 /* REG_Q_OPEN_HKU */
70 typedef struct q_reg_open_unk4_info
71 {
72         uint32 ptr;
73         uint16 unknown_0; /* 0xE084      - 16 bit unknown */
74         uint16 unknown_1; /* random.  changes */
75         uint32 level;     /* 0x0000 0002 - 32 bit unknown */
76
77 } REG_Q_OPEN_HKU;
78
79 /* REG_R_OPEN_HKU */
80 typedef struct r_reg_open_unk4_info
81 {
82         POLICY_HND pol;       /* policy handle */
83         uint32 status;         /* return status */
84
85 } REG_R_OPEN_HKU;
86
87
88 /* REG_Q_FLUSH_KEY */
89 typedef struct q_reg_open_flush_key_info
90 {
91         POLICY_HND pol;       /* policy handle */
92
93 } REG_Q_FLUSH_KEY;
94
95 /* REG_R_FLUSH_KEY */
96 typedef struct r_reg_open_flush_key_info
97 {
98         uint32 status;         /* return status */
99
100 } REG_R_FLUSH_KEY;
101
102
103 /* REG_Q_SET_KEY_SEC */
104 typedef struct q_reg_set_key_sec_info
105 {
106         POLICY_HND pol;         /* policy handle */
107
108         uint32 sec_info;       /* xxxx_SECURITY_INFORMATION */
109
110         uint32 ptr;       /* pointer */
111         BUFHDR hdr_sec;    /* header for security data */
112         SEC_DESC_BUF *data;    /* security data */
113         
114 } REG_Q_SET_KEY_SEC;
115
116 /* REG_R_SET_KEY_SEC */
117 typedef struct r_reg_set_key_sec_info
118 {
119         uint32 status;
120         
121 } REG_R_SET_KEY_SEC;
122
123
124 /* REG_Q_GET_KEY_SEC */
125 typedef struct q_reg_get_key_sec_info
126 {
127         POLICY_HND pol;         /* policy handle */
128
129         uint32 sec_info;       /* xxxx_SECURITY_INFORMATION */
130
131         uint32 ptr;       /* pointer */
132         BUFHDR hdr_sec;    /* header for security data */
133         SEC_DESC_BUF *data;    /* security data */
134         
135 } REG_Q_GET_KEY_SEC;
136
137 /* REG_R_GET_KEY_SEC */
138 typedef struct r_reg_get_key_sec_info
139 {
140         uint32 sec_info;       /* xxxx_SECURITY_INFORMATION */
141
142         uint32 ptr;       /* pointer */
143         BUFHDR hdr_sec;    /* header for security data */
144         SEC_DESC_BUF *data;    /* security data */
145
146         uint32 status;
147         
148 } REG_R_GET_KEY_SEC;
149
150 /* REG_Q_CREATE_VALUE */
151 typedef struct q_reg_create_value_info
152 {
153         POLICY_HND pol;    /* policy handle */
154
155         UNIHDR hdr_name;   /* name of value */
156         UNISTR2 uni_name;
157
158         uint32 type;       /* 1 = UNISTR, 3 = BYTES, 4 = DWORD, 7 = MULTI_UNISTR */
159
160         BUFFER3 *buf_value; /* value, in byte buffer */
161
162 } REG_Q_CREATE_VALUE;
163
164 /* REG_R_CREATE_VALUE */
165 typedef struct r_reg_create_value_info
166
167         uint32 status;         /* return status */
168
169 } REG_R_CREATE_VALUE;
170
171 /* REG_Q_ENUM_VALUE */
172 typedef struct q_reg_query_value_info
173 {
174         POLICY_HND pol;    /* policy handle */
175
176         uint32 val_index;  /* index */
177
178         UNIHDR hdr_name;   /* name of value */
179         UNISTR2 uni_name;
180
181         uint32 ptr_type;   /* pointer */
182         uint32 type;       /* 1 = UNISTR, 3 = BYTES, 4 = DWORD, 7 = MULTI_UNISTR */
183
184         uint32 ptr_value;  /* pointer */
185         BUFFER2 buf_value; /* value, in byte buffer */
186
187         uint32 ptr1;       /* pointer */
188         uint32 len_value1; /* */
189
190         uint32 ptr2;       /* pointer */
191         uint32 len_value2; /* */
192
193 } REG_Q_ENUM_VALUE;
194
195 /* REG_R_ENUM_VALUE */
196 typedef struct r_reg_enum_value_info
197
198         UNIHDR hdr_name;        /* name of value */
199         UNISTR2 uni_name;
200
201         uint32 ptr_type;            /* pointer */
202         uint32 type;        /* 1 = UNISTR, 3 = BYTES, 4 = DWORD, 7 = MULTI_UNISTR */
203
204         uint32 ptr_value;       /* pointer */
205         BUFFER2 *buf_value;    /* value, in byte buffer */
206
207         uint32 ptr1;            /* pointer */
208         uint32 len_value1;       /* */
209
210         uint32 ptr2;            /* pointer */
211         uint32 len_value2;       /* */
212
213         uint32 status;         /* return status */
214
215 } REG_R_ENUM_VALUE;
216
217 /* REG_Q_CREATE_KEY */
218 typedef struct q_reg_create_key_info
219 {
220         POLICY_HND pnt_pol;       /* parent key policy handle */
221
222         UNIHDR hdr_name;
223         UNISTR2 uni_name;
224
225         UNIHDR hdr_class;
226         UNISTR2 uni_class;
227
228         uint32 reserved; /* 0x0000 0000 */
229         SEC_ACCESS sam_access; /* access rights flags, see rpc_secdes.h */
230
231         uint32 ptr1;
232         uint32 sec_info; /* xxxx_SECURITY_INFORMATION */
233
234         uint32 ptr2;       /* pointer */
235         BUFHDR hdr_sec;    /* header for security data */
236         uint32 ptr3;       /* pointer */
237         SEC_DESC_BUF *data;
238
239         uint32 unknown_2; /* 0x0000 0000 */
240
241 } REG_Q_CREATE_KEY;
242
243 /* REG_R_CREATE_KEY */
244 typedef struct r_reg_create_key_info
245 {
246         POLICY_HND key_pol;       /* policy handle */
247         uint32 unknown; /* 0x0000 0000 */
248
249         uint32 status;         /* return status */
250
251 } REG_R_CREATE_KEY;
252
253 /* REG_Q_DELETE_KEY */
254 typedef struct q_reg_delete_key_info
255 {
256         POLICY_HND pnt_pol;       /* parent key policy handle */
257
258         UNIHDR hdr_name;
259         UNISTR2 uni_name;
260 } REG_Q_DELETE_KEY;
261
262 /* REG_R_DELETE_KEY */
263 typedef struct r_reg_delete_key_info
264 {
265         POLICY_HND key_pol;       /* policy handle */
266
267         uint32 status;         /* return status */
268
269 } REG_R_DELETE_KEY;
270
271 /* REG_Q_DELETE_VALUE */
272 typedef struct q_reg_delete_val_info
273 {
274         POLICY_HND pnt_pol;       /* parent key policy handle */
275
276         UNIHDR hdr_name;
277         UNISTR2 uni_name;
278
279 } REG_Q_DELETE_VALUE;
280
281 /* REG_R_DELETE_VALUE */
282 typedef struct r_reg_delete_val_info
283 {
284         POLICY_HND key_pol;       /* policy handle */
285
286         uint32 status;         /* return status */
287
288 } REG_R_DELETE_VALUE;
289
290 /* REG_Q_QUERY_KEY */
291 typedef struct q_reg_query_info
292 {
293         POLICY_HND pol;       /* policy handle */
294         UNIHDR hdr_class;
295         UNISTR2 uni_class;
296
297 } REG_Q_QUERY_KEY;
298
299 /* REG_R_QUERY_KEY */
300 typedef struct r_reg_query_key_info
301 {
302         UNIHDR hdr_class;
303         UNISTR2 uni_class;
304
305         uint32 num_subkeys;
306         uint32 max_subkeylen;
307         uint32 max_subkeysize; /* 0x0000 0000 */
308         uint32 num_values;
309         uint32 max_valnamelen;
310         uint32 max_valbufsize; 
311         uint32 sec_desc; /* 0x0000 0078 */
312         NTTIME mod_time;  /* modified time */
313
314         uint32 status;         /* return status */
315
316 } REG_R_QUERY_KEY;
317
318
319 /* REG_Q_UNK_1A */
320 typedef struct q_reg_unk_1a_info
321 {
322         POLICY_HND pol;       /* policy handle */
323
324 } REG_Q_UNK_1A;
325
326 /* REG_R_UNK_1A */
327 typedef struct r_reg_unk_1a_info
328 {
329         uint32 unknown;         /* 0x0500 0000 */
330         uint32 status;         /* return status */
331
332 } REG_R_UNK_1A;
333
334
335 /* REG_Q_CLOSE */
336 typedef struct reg_q_close_info
337 {
338         POLICY_HND pol; /* policy handle */
339
340 } REG_Q_CLOSE;
341
342 /* REG_R_CLOSE */
343 typedef struct reg_r_close_info
344 {
345         POLICY_HND pol; /* policy handle.  should be all zeros. */
346
347         uint32 status; /* return code */
348
349 } REG_R_CLOSE;
350
351
352 /* REG_Q_ENUM_KEY */
353 typedef struct q_reg_enum_value_info
354 {
355         POLICY_HND pol;         /* policy handle */
356
357         uint32 key_index;       
358
359         uint16 key_name_len;    /* 0x0000 */
360         uint16 unknown_1;       /* 0x0414 */
361
362         uint32 ptr1;            /* pointer */
363         uint32 unknown_2;       /* 0x0000 020A */
364         uint8  pad1[8];         /* padding - zeros */
365
366         uint32 ptr2;            /* pointer */
367         uint8  pad2[8];         /* padding - zeros */
368
369         uint32 ptr3;            /* pointer */
370         NTTIME time;            /* current time? */
371
372 } REG_Q_ENUM_KEY;
373
374 /* REG_R_ENUM_KEY */
375 typedef struct r_reg_enum_key_info
376
377         uint16 key_name_len;    /* number of bytes in key name */
378         uint16 unknown_1;       /* 0x0414 - matches with query unknown_1 */
379
380         uint32 ptr1;            /* pointer */
381         uint32 unknown_2;       /* 0x0000 020A */
382         uint32 unknown_3;       /* 0x0000 0000 */
383
384         UNISTR3 key_name;
385
386         uint32 ptr2;            /* pointer */
387         uint8  pad2[8];         /* padding - zeros */
388
389         uint32 ptr3;            /* pointer */
390         NTTIME time;            /* current time? */
391
392         uint32 status;         /* return status */
393
394 } REG_R_ENUM_KEY;
395
396
397 /* REG_Q_INFO */
398 typedef struct q_reg_info_info
399 {
400         POLICY_HND pol;        /* policy handle */
401
402         UNIHDR  hdr_type;       /* unicode product type header */
403         UNISTR2 uni_type;       /* unicode product type - "ProductType" */
404
405         uint32 ptr1;            /* pointer */
406         NTTIME time;            /* current time? */
407         uint8  major_version1;  /* 0x4 - os major version? */
408         uint8  minor_version1;  /* 0x1 - os minor version? */
409         uint8  pad1[10];        /* padding - zeros */
410
411         uint32 ptr2;            /* pointer */
412         uint8  major_version2;  /* 0x4 - os major version? */
413         uint8  minor_version2;  /* 0x1 - os minor version? */
414         uint8  pad2[2];         /* padding - zeros */
415
416         uint32 ptr3;            /* pointer */
417         uint32 unknown;         /* 0x0000 0000 */
418
419 } REG_Q_INFO;
420
421 /* REG_R_INFO */
422 typedef struct r_reg_info_info
423
424         uint32 ptr1;            /* buffer pointer */
425         uint32 level;          /* 0x1 - info level? */
426
427         uint32 ptr_type;       /* pointer to o/s type */
428         BUFFER2 uni_type;      /* unicode string o/s type - "LanmanNT" */
429
430         uint32 ptr2;           /* pointer to unknown_0 */
431         uint32 unknown_0;      /* 0x12 */
432
433         uint32 ptr3;           /* pointer to unknown_1 */
434         uint32 unknown_1;      /* 0x12 */
435
436         uint32 status;         /* return status */
437
438 } REG_R_INFO;
439
440
441 /* REG_Q_OPEN_ENTRY */
442 typedef struct q_reg_open_entry_info
443 {
444         POLICY_HND pol;        /* policy handle */
445
446         UNIHDR  hdr_name;       /* unicode registry string header */
447         UNISTR2 uni_name;       /* unicode registry string name */
448
449         uint32 unknown_0;       /* 32 bit unknown - 0x0000 0000 */
450         uint32 unknown_1;       /* 32 bit unknown - 0x0200 0000 */
451
452 } REG_Q_OPEN_ENTRY;
453
454
455
456 /* REG_R_OPEN_ENTRY */
457 typedef struct r_reg_open_entry_info
458 {
459         POLICY_HND pol;       /* policy handle */
460         uint32 status;         /* return status */
461
462 } REG_R_OPEN_ENTRY;
463
464
465 /* REG_Q_SHUTDOWN */
466 typedef struct q_reg_shutdown_info
467 {
468         uint32 ptr_0;
469         uint32 ptr_1;
470         uint32 ptr_2;
471         UNIHDR hdr_msg;   /* shutdown message */
472         UNISTR2 uni_msg;
473         uint32 timeout; /* seconds */
474         uint16 flags;       
475
476 } REG_Q_SHUTDOWN;
477
478 /* REG_R_SHUTDOWN */
479 typedef struct r_reg_shutdown_info
480
481         uint32 status; /* return status */
482
483 } REG_R_SHUTDOWN;
484
485
486 #endif /* _RPC_REG_H */
487