r6942: * merging the registry changes back to the 3.0 tree
[Samba/nascimento.git] / source3 / include / rpc_reg.h
blob2849122667edcec9661e702edbac31410f9a3552
1 /*
2 Unix SMB/CIFS implementation.
3 SMB parameters and setup
4 Copyright (C) Andrew Tridgell 1992-1997.
5 Copyright (C) Luke Kenneth Casson Leighton 1996-1997.
6 Copyright (C) Paul Ashton 1997.
7 Copyright (C) Jeremy Cooper 2004.
8 Copyright (C) Gerald Carter 2002-2005.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #ifndef _RPC_REG_H /* _RPC_REG_H */
26 #define _RPC_REG_H
28 #include "reg_objects.h"
30 /* RPC opnum */
32 #define REG_OPEN_HKCR 0x00
33 #define REG_OPEN_HKLM 0x02
34 #define REG_OPEN_HKPD 0x03
35 #define REG_OPEN_HKU 0x04
36 #define REG_CLOSE 0x05
37 #define REG_CREATE_KEY 0x06
38 #define REG_DELETE_KEY 0x07
39 #define REG_DELETE_VALUE 0x08
40 #define REG_ENUM_KEY 0x09
41 #define REG_ENUM_VALUE 0x0a
42 #define REG_FLUSH_KEY 0x0b
43 #define REG_GET_KEY_SEC 0x0c
44 #define REG_OPEN_ENTRY 0x0f
45 #define REG_QUERY_KEY 0x10
46 #define REG_INFO 0x11
47 #define REG_RESTORE_KEY 0x13
48 #define REG_SAVE_KEY 0x14
49 #define REG_SET_KEY_SEC 0x15
50 #define REG_SET_VALUE 0x16
51 #define REG_SHUTDOWN 0x18
52 #define REG_ABORT_SHUTDOWN 0x19
53 #define REG_GETVERSION 0x1a
54 #define REG_SHUTDOWN_EX 0x1e
57 #define HKEY_CLASSES_ROOT 0x80000000
58 #define HKEY_CURRENT_USER 0x80000001
59 #define HKEY_LOCAL_MACHINE 0x80000002
60 #define HKEY_USERS 0x80000003
61 #define HKEY_PERFORMANCE_DATA 0x80000004
63 #define KEY_HKLM "HKLM"
64 #define KEY_HKU "HKU"
65 #define KEY_HKCR "HKCR"
66 #define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print"
67 #define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print"
68 #define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports"
69 #define KEY_EVENTLOG "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog"
70 #define KEY_SHARES "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares"
71 #define KEY_TREE_ROOT ""
73 /* Registry data types */
75 #define REG_NONE 0
76 #define REG_SZ 1
77 #define REG_EXPAND_SZ 2
78 #define REG_BINARY 3
79 #define REG_DWORD 4
80 #define REG_DWORD_LE 4 /* DWORD, little endian */
81 #define REG_DWORD_BE 5 /* DWORD, big endian */
82 #define REG_LINK 6
83 #define REG_MULTI_SZ 7
84 #define REG_RESOURCE_LIST 8
85 #define REG_FULL_RESOURCE_DESCRIPTOR 9
86 #define REG_RESOURCE_REQUIREMENTS_LIST 10
88 /*
89 * container for function pointers to enumeration routines
90 * for vitural registry view
91 */
93 typedef struct {
94 /* functions for enumerating subkeys and values */
95 int (*subkey_fn)( char *key, REGSUBKEY_CTR *subkeys);
96 int (*value_fn) ( char *key, REGVAL_CTR *val );
97 BOOL (*store_subkeys_fn)( char *key, REGSUBKEY_CTR *subkeys );
98 BOOL (*store_values_fn)( char *key, REGVAL_CTR *val );
99 } REGISTRY_OPS;
101 typedef struct {
102 const char *keyname; /* full path to name of key */
103 REGISTRY_OPS *ops; /* registry function hooks */
104 } REGISTRY_HOOK;
107 /* structure to store the registry handles */
109 typedef struct _RegistryKey {
111 struct _RegistryKey *prev, *next;
113 POLICY_HND hnd;
114 pstring name; /* full name of registry key */
115 REGISTRY_HOOK *hook;
117 } REGISTRY_KEY;
120 * RPC REGISTRY STRUCTURES
123 /***********************************************/
125 typedef struct {
126 uint16 *server;
127 uint32 access;
128 } REG_Q_OPEN_HIVE;
130 typedef struct {
131 POLICY_HND pol;
132 WERROR status;
133 } REG_R_OPEN_HIVE;
136 /***********************************************/
138 typedef struct {
139 POLICY_HND pol;
140 } REG_Q_FLUSH_KEY;
142 typedef struct {
143 WERROR status;
144 } REG_R_FLUSH_KEY;
147 /***********************************************/
149 typedef struct {
150 POLICY_HND pol;
151 uint32 sec_info;
152 uint32 ptr;
153 BUFHDR hdr_sec;
154 SEC_DESC_BUF *data;
155 } REG_Q_SET_KEY_SEC;
157 typedef struct {
158 WERROR status;
159 } REG_R_SET_KEY_SEC;
162 /***********************************************/
164 typedef struct {
165 POLICY_HND pol;
166 uint32 sec_info;
167 uint32 ptr;
168 BUFHDR hdr_sec;
169 SEC_DESC_BUF *data;
170 } REG_Q_GET_KEY_SEC;
172 typedef struct {
173 uint32 sec_info;
174 uint32 ptr;
175 BUFHDR hdr_sec;
176 SEC_DESC_BUF *data;
177 WERROR status;
178 } REG_R_GET_KEY_SEC;
180 /***********************************************/
182 typedef struct {
183 POLICY_HND pol;
184 UNISTR4 name;
185 uint32 type;
186 RPC_DATA_BLOB value;
187 uint32 size;
188 } REG_Q_SET_VALUE;
190 typedef struct {
191 WERROR status;
192 } REG_R_SET_VALUE;
194 /***********************************************/
196 typedef struct {
197 POLICY_HND pol;
198 uint32 val_index;
199 UNISTR4 name;
200 uint32 *type;
201 REGVAL_BUFFER *value; /* value, in byte buffer */
202 uint32 *buffer_len;
203 uint32 *name_len;
204 } REG_Q_ENUM_VALUE;
206 typedef struct {
207 UNISTR4 name;
208 uint32 *type;
209 REGVAL_BUFFER *value;
210 uint32 *buffer_len1;
211 uint32 *buffer_len2;
212 WERROR status;
213 } REG_R_ENUM_VALUE;
215 /***********************************************/
217 typedef struct {
218 POLICY_HND pnt_pol;
219 UNISTR4 name;
220 UNISTR4 class;
221 uint32 reserved;
222 uint32 access;
223 uint32 *sec_info;
224 uint32 ptr2;
225 BUFHDR hdr_sec;
226 uint32 ptr3;
227 SEC_DESC_BUF *data;
228 uint32 unknown_2; /* 0x0000 0000 */
229 } REG_Q_CREATE_KEY;
231 typedef struct {
232 POLICY_HND key_pol;
233 uint32 unknown;
234 WERROR status;
235 } REG_R_CREATE_KEY;
237 /***********************************************/
239 typedef struct {
240 POLICY_HND pnt_pol;
241 UNISTR4 name;
242 } REG_Q_DELETE_KEY;
244 typedef struct {
245 POLICY_HND key_pol;
246 WERROR status;
247 } REG_R_DELETE_KEY;
249 /***********************************************/
251 typedef struct {
252 POLICY_HND pnt_pol;
253 UNISTR4 name;
254 } REG_Q_DELETE_VALUE;
256 typedef struct {
257 POLICY_HND key_pol;
258 WERROR status;
259 } REG_R_DELETE_VALUE;
261 /***********************************************/
263 typedef struct {
264 POLICY_HND pol;
265 UNISTR4 class;
266 } REG_Q_QUERY_KEY;
268 typedef struct {
269 UNISTR4 class;
270 uint32 num_subkeys;
271 uint32 max_subkeylen;
272 uint32 reserved; /* 0x0000 0000 - according to MSDN (max_subkeysize?) */
273 uint32 num_values;
274 uint32 max_valnamelen;
275 uint32 max_valbufsize;
276 uint32 sec_desc; /* 0x0000 0078 */
277 NTTIME mod_time; /* modified time */
278 WERROR status;
279 } REG_R_QUERY_KEY;
282 /***********************************************/
284 typedef struct {
285 POLICY_HND pol; /* policy handle */
286 } REG_Q_GETVERSION;
288 typedef struct {
289 uint32 unknown; /* 0x0500 0000 */
290 WERROR status; /* return status */
291 } REG_R_GETVERSION;
294 /***********************************************/
296 typedef struct {
297 POLICY_HND pol;
298 UNISTR4 filename;
299 uint32 flags;
300 } REG_Q_RESTORE_KEY;
302 typedef struct {
303 WERROR status; /* return status */
304 } REG_R_RESTORE_KEY;
307 /***********************************************/
310 /* I have no idea if this is correct since I
311 have not seen the full structure on the wire
312 as of yet */
314 typedef struct {
315 uint32 max_len;
316 uint32 len;
317 SEC_DESC *secdesc;
318 } REG_SEC_DESC_BUF;
320 typedef struct {
321 uint32 size; /* size in bytes of security descriptor */
322 REG_SEC_DESC_BUF secdesc;
323 uint8 inherit; /* see MSDN for a description */
324 } SECURITY_ATTRIBUTE;
326 typedef struct {
327 POLICY_HND pol;
328 UNISTR4 filename;
329 SECURITY_ATTRIBUTE *sec_attr;
330 } REG_Q_SAVE_KEY;
332 typedef struct {
333 WERROR status; /* return status */
334 } REG_R_SAVE_KEY;
337 /***********************************************/
339 typedef struct {
340 POLICY_HND pol; /* policy handle */
341 } REG_Q_CLOSE;
343 typedef struct {
344 POLICY_HND pol;
345 WERROR status;
346 } REG_R_CLOSE;
349 /***********************************************/
351 typedef struct {
352 POLICY_HND pol;
353 uint32 key_index;
354 uint16 key_name_len;
355 uint16 unknown_1; /* 0x0414 */
356 uint32 ptr1;
357 uint32 unknown_2; /* 0x0000 020A */
358 uint8 pad1[8];
359 uint32 ptr2;
360 uint8 pad2[8];
361 uint32 ptr3;
362 NTTIME time;
363 } REG_Q_ENUM_KEY;
365 typedef struct {
366 UNISTR4 keyname;
367 UNISTR4 *classname;
368 NTTIME *time;
369 WERROR status; /* return status */
370 } REG_R_ENUM_KEY;
373 /***********************************************/
375 typedef struct {
376 POLICY_HND pol; /* policy handle */
377 UNISTR4 name;
379 uint32 ptr_reserved; /* pointer */
381 uint32 ptr_buf; /* the next three fields follow if ptr_buf != 0 */
382 uint32 ptr_bufsize;
383 uint32 bufsize;
384 uint32 buf_unk;
386 uint32 unk1;
387 uint32 ptr_buflen;
388 uint32 buflen;
390 uint32 ptr_buflen2;
391 uint32 buflen2;
393 } REG_Q_INFO;
395 typedef struct {
396 uint32 *type;
397 REGVAL_BUFFER *value; /* key value */
398 uint32 *buf_max_len;
399 uint32 *buf_len;
400 WERROR status; /* return status */
401 } REG_R_INFO;
404 /***********************************************/
406 typedef struct {
407 POLICY_HND pol;
408 UNISTR4 name;
409 uint32 unknown_0; /* 32 bit unknown - 0x0000 0000 */
410 uint32 access;
411 } REG_Q_OPEN_ENTRY;
413 typedef struct {
414 POLICY_HND pol;
415 WERROR status;
416 } REG_R_OPEN_ENTRY;
418 /***********************************************/
420 typedef struct {
421 uint16 *server;
422 UNISTR4 *message;
423 uint32 timeout; /* in seconds */
424 uint8 force; /* boolean: force shutdown */
425 uint8 reboot; /* boolean: reboot on shutdown */
426 } REG_Q_SHUTDOWN;
428 typedef struct {
429 WERROR status; /* return status */
430 } REG_R_SHUTDOWN;
432 /***********************************************/
434 typedef struct {
435 uint16 *server;
436 UNISTR4 *message;
437 uint32 timeout; /* in seconds */
438 uint8 force; /* boolean: force shutdown */
439 uint8 reboot; /* boolean: reboot on shutdown */
440 uint32 reason; /* reason - must be defined code */
441 } REG_Q_SHUTDOWN_EX;
443 typedef struct {
444 WERROR status;
445 } REG_R_SHUTDOWN_EX;
447 /***********************************************/
449 typedef struct {
450 uint16 *server;
451 } REG_Q_ABORT_SHUTDOWN;
453 typedef struct {
454 WERROR status;
455 } REG_R_ABORT_SHUTDOWN;
458 #endif /* _RPC_REG_H */