rpcclient registry commands.
[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_POLICY     0x02
30 #define REG_OPEN_UNK_4      0x04
31 #define REG_UNK_1A          0x1a
32 #define REG_QUERY_KEY       0x10
33 #define REG_ENUM_KEY        0x09
34 #define REG_CREATE_KEY      0x06
35 #define REG_CREATE_VALUE    0x16
36 #define REG_GET_KEY_SEC     0x0c
37 #define REG_ENUM_VALUE      0x0a
38 #define REG_OPEN_ENTRY      0x0f
39 #define REG_INFO            0x11
40 #define REG_CLOSE           0x05
41
42
43 /* REG_Q_OPEN_POLICY */
44 typedef struct q_reg_open_policy_info
45 {
46         uint32 ptr;
47         uint16 unknown_0; /* 0xE084      - 16 bit unknown */
48         uint16 unknown_1; /* random.  changes */
49         uint32 level;     /* 0x0000 0002 - 32 bit unknown */
50
51 } REG_Q_OPEN_POLICY;
52
53 /* REG_R_OPEN_POLICY */
54 typedef struct r_reg_open_policy_info
55 {
56         POLICY_HND pol;       /* policy handle */
57         uint32 status;         /* return status */
58
59 } REG_R_OPEN_POLICY;
60
61
62 /* REG_Q_OPEN_UNK_4 */
63 typedef struct q_reg_open_unk4_info
64 {
65         uint32 ptr;
66         uint16 unknown_0; /* 0xE084      - 16 bit unknown */
67         uint16 unknown_1; /* random.  changes */
68         uint32 level;     /* 0x0000 0002 - 32 bit unknown */
69
70 } REG_Q_OPEN_UNK_4;
71
72 /* REG_R_OPEN_UNK_4 */
73 typedef struct r_reg_open_unk4_info
74 {
75         POLICY_HND pol;       /* policy handle */
76         uint32 status;         /* return status */
77
78 } REG_R_OPEN_UNK_4;
79
80
81 /* REG_Q_GET_KEY_SEC */
82 typedef struct q_reg_get_key_sec_info
83 {
84         POLICY_HND pol;         /* policy handle */
85
86         uint32 unknown;       /* 0x0000 0007 */
87
88         uint32 ptr;       /* pointer */
89         BUFHDR hdr_sec;    /* header for security data */
90         SEC_DESC_BUF *data;    /* security data */
91         
92 } REG_Q_GET_KEY_SEC;
93
94 /* REG_R_GET_KEY_SEC */
95 typedef struct r_reg_get_key_sec_info
96 {
97         uint32 unknown;       /* 0x0000 0007 */
98
99         uint32 ptr;       /* pointer */
100         BUFHDR hdr_sec;    /* header for security data */
101         SEC_DESC_BUF *data;    /* security data */
102
103         uint32 status;
104         
105 } REG_R_GET_KEY_SEC;
106
107 /* REG_Q_CREATE_VALUE */
108 typedef struct q_reg_create_value_info
109 {
110         POLICY_HND pol;    /* policy handle */
111
112         UNIHDR hdr_name;   /* name of value */
113         UNISTR2 uni_name;
114
115         uint32 type;       /* 1 = UNISTR, 3 = BYTES, 4 = DWORD, 7 = MULTI_UNISTR */
116
117         BUFFER3 *buf_value; /* value, in byte buffer */
118
119 } REG_Q_CREATE_VALUE;
120
121 /* REG_R_CREATE_VALUE */
122 typedef struct r_reg_create_value_info
123
124         uint32 status;         /* return status */
125
126 } REG_R_CREATE_VALUE;
127
128 /* REG_Q_ENUM_VALUE */
129 typedef struct q_reg_query_value_info
130 {
131         POLICY_HND pol;    /* policy handle */
132
133         uint32 val_index;  /* index */
134
135         UNIHDR hdr_name;   /* name of value */
136         UNISTR2 uni_name;
137
138         uint32 ptr_type;   /* pointer */
139         uint32 type;       /* 1 = UNISTR, 3 = BYTES, 4 = DWORD, 7 = MULTI_UNISTR */
140
141         uint32 ptr_value;  /* pointer */
142         BUFFER2 buf_value; /* value, in byte buffer */
143
144         uint32 ptr1;       /* pointer */
145         uint32 len_value1; /* */
146
147         uint32 ptr2;       /* pointer */
148         uint32 len_value2; /* */
149
150 } REG_Q_ENUM_VALUE;
151
152 /* REG_R_ENUM_VALUE */
153 typedef struct r_reg_enum_value_info
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         uint32 status;         /* return status */
171
172 } REG_R_ENUM_VALUE;
173
174 /* REG_Q_CREATE_KEY */
175 typedef struct q_reg_create_key_info
176 {
177         POLICY_HND pnt_pol;       /* parent key policy handle */
178
179         UNIHDR hdr_name;
180         UNISTR2 uni_name;
181
182         UNIHDR hdr_class;
183         UNISTR2 uni_class;
184
185         uint32 reserved; /* 0x0000 0000 */
186         SEC_INFO sam_access; /* access rights flags, see rpc_secdes.h */
187
188         uint32 ptr1;
189         uint32 unknown_0; /* 0x0000 000C */
190
191         uint32 ptr2;
192         uint32 unk_len1; /* 0x0000 0014 */
193         uint32 unk_len2; /* 0x0000 0014 */
194         uint32 unknown_1; /* 0x0002 0000 */
195         BUFFER2 buf_unk;  /* 01 00 00 80   00 00 00 00   00 00 00 00   00 00 00 00   00 00 00 00  */
196
197         uint32 unknown_2; /* 0x0000 0000 */
198 } REG_Q_CREATE_KEY;
199
200 /* REG_R_CREATE_KEY */
201 typedef struct r_reg_create_key_info
202 {
203         POLICY_HND key_pol;       /* policy handle */
204         uint32 unknown; /* 0x0000 0000 */
205
206         uint32 status;         /* return status */
207
208 } REG_R_CREATE_KEY;
209
210 /* REG_Q_QUERY_KEY */
211 typedef struct q_reg_query_info
212 {
213         POLICY_HND pol;       /* policy handle */
214         UNIHDR hdr_class;
215         UNISTR2 uni_class;
216
217 } REG_Q_QUERY_KEY;
218
219 /* REG_R_QUERY_KEY */
220 typedef struct r_reg_query_key_info
221 {
222         UNIHDR hdr_class;
223         UNISTR2 uni_class;
224
225         uint32 num_subkeys;
226         uint32 max_subkeylen;
227         uint32 max_subkeysize; /* 0x0000 0000 */
228         uint32 num_values;
229         uint32 max_valnamelen;
230         uint32 max_valbufsize; 
231         uint32 sec_desc; /* 0x0000 0078 */
232         NTTIME mod_time;  /* modified time */
233
234         uint32 status;         /* return status */
235
236 } REG_R_QUERY_KEY;
237
238
239 /* REG_Q_UNK_1A */
240 typedef struct q_reg_unk_1a_info
241 {
242         POLICY_HND pol;       /* policy handle */
243
244 } REG_Q_UNK_1A;
245
246 /* REG_R_UNK_1A */
247 typedef struct r_reg_unk_1a_info
248 {
249         uint32 unknown;         /* 0x0500 0000 */
250         uint32 status;         /* return status */
251
252 } REG_R_UNK_1A;
253
254
255 /* REG_Q_CLOSE */
256 typedef struct reg_q_close_info
257 {
258         POLICY_HND pol; /* policy handle */
259
260 } REG_Q_CLOSE;
261
262 /* REG_R_CLOSE */
263 typedef struct reg_r_close_info
264 {
265         POLICY_HND pol; /* policy handle.  should be all zeros. */
266
267         uint32 status; /* return code */
268
269 } REG_R_CLOSE;
270
271
272 /* REG_Q_ENUM_KEY */
273 typedef struct q_reg_enum_value_info
274 {
275         POLICY_HND pol;         /* policy handle */
276
277         uint32 key_index;       
278
279         uint16 key_name_len;    /* 0x0000 */
280         uint16 unknown_1;       /* 0x0414 */
281
282         uint32 ptr1;            /* pointer */
283         uint32 unknown_2;       /* 0x0000 020A */
284         uint8  pad1[8];         /* padding - zeros */
285
286         uint32 ptr2;            /* pointer */
287         uint8  pad2[8];         /* padding - zeros */
288
289         uint32 ptr3;            /* pointer */
290         NTTIME time;            /* current time? */
291
292 } REG_Q_ENUM_KEY;
293
294 /* REG_R_ENUM_KEY */
295 typedef struct r_reg_enum_key_info
296
297         uint16 key_name_len;    /* number of bytes in key name */
298         uint16 unknown_1;       /* 0x0414 - matches with query unknown_1 */
299
300         uint32 ptr1;            /* pointer */
301         uint32 unknown_2;       /* 0x0000 020A */
302         uint32 unknown_3;       /* 0x0000 0000 */
303
304         UNISTR3 key_name;
305
306         uint32 ptr2;            /* pointer */
307         uint8  pad2[8];         /* padding - zeros */
308
309         uint32 ptr3;            /* pointer */
310         NTTIME time;            /* current time? */
311
312         uint32 status;         /* return status */
313
314 } REG_R_ENUM_KEY;
315
316
317 /* REG_Q_INFO */
318 typedef struct q_reg_info_info
319 {
320         POLICY_HND pol;        /* policy handle */
321
322         UNIHDR  hdr_type;       /* unicode product type header */
323         UNISTR2 uni_type;       /* unicode product type - "ProductType" */
324
325         uint32 ptr1;            /* pointer */
326         NTTIME time;            /* current time? */
327         uint8  major_version1;  /* 0x4 - os major version? */
328         uint8  minor_version1;  /* 0x1 - os minor version? */
329         uint8  pad1[10];        /* padding - zeros */
330
331         uint32 ptr2;            /* pointer */
332         uint8  major_version2;  /* 0x4 - os major version? */
333         uint8  minor_version2;  /* 0x1 - os minor version? */
334         uint8  pad2[2];         /* padding - zeros */
335
336         uint32 ptr3;            /* pointer */
337         uint32 unknown;         /* 0x0000 0000 */
338
339 } REG_Q_INFO;
340
341 /* REG_R_INFO */
342 typedef struct r_reg_info_info
343
344         uint32 ptr1;            /* buffer pointer */
345         uint32 level;          /* 0x1 - info level? */
346
347         uint32 ptr_type;       /* pointer to o/s type */
348         BUFFER2 uni_type;      /* unicode string o/s type - "LanmanNT" */
349
350         uint32 ptr2;           /* pointer to unknown_0 */
351         uint32 unknown_0;      /* 0x12 */
352
353         uint32 ptr3;           /* pointer to unknown_1 */
354         uint32 unknown_1;      /* 0x12 */
355
356         uint32 status;         /* return status */
357
358 } REG_R_INFO;
359
360
361 /* REG_Q_OPEN_ENTRY */
362 typedef struct q_reg_open_entry_info
363 {
364         POLICY_HND pol;        /* policy handle */
365
366         UNIHDR  hdr_name;       /* unicode registry string header */
367         UNISTR2 uni_name;       /* unicode registry string name */
368
369         uint32 unknown_0;       /* 32 bit unknown - 0x0000 0000 */
370         uint32 unknown_1;       /* 32 bit unknown - 0x0200 0000 */
371
372 } REG_Q_OPEN_ENTRY;
373
374
375
376 /* REG_R_OPEN_ENTRY */
377 typedef struct r_reg_open_entry_info
378 {
379         POLICY_HND pol;       /* policy handle */
380         uint32 status;         /* return status */
381
382 } REG_R_OPEN_ENTRY;
383
384
385
386 #endif /* _RPC_REG_H */
387