build-docs: Change to the right directory before calling 'make clean'.
[Samba.git] / source / include / rpc_reg.h
blobc454a1d6f949d3ff02fff095bb35de49e72b7953
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 /* RPC opnum */
30 #define REG_OPEN_HKCR 0x00
31 #define REG_OPEN_HKLM 0x02
32 #define REG_OPEN_HKPD 0x03
33 #define REG_OPEN_HKU 0x04
34 #define REG_CLOSE 0x05
35 #define REG_CREATE_KEY_EX 0x06
36 #define REG_DELETE_KEY 0x07
37 #define REG_DELETE_VALUE 0x08
38 #define REG_ENUM_KEY 0x09
39 #define REG_ENUM_VALUE 0x0a
40 #define REG_FLUSH_KEY 0x0b
41 #define REG_GET_KEY_SEC 0x0c
42 #define REG_OPEN_ENTRY 0x0f
43 #define REG_QUERY_KEY 0x10
44 #define REG_QUERY_VALUE 0x11
45 #define REG_RESTORE_KEY 0x13
46 #define REG_SAVE_KEY 0x14
47 #define REG_SET_KEY_SEC 0x15
48 #define REG_SET_VALUE 0x16
49 #define REG_SHUTDOWN 0x18
50 #define REG_ABORT_SHUTDOWN 0x19
51 #define REG_OPEN_HKPT 0x20
52 #define REG_GETVERSION 0x1a
53 #define REG_SHUTDOWN_EX 0x1e
56 #define HKEY_CLASSES_ROOT 0x80000000
57 #define HKEY_CURRENT_USER 0x80000001
58 #define HKEY_LOCAL_MACHINE 0x80000002
59 #define HKEY_USERS 0x80000003
60 #define HKEY_PERFORMANCE_DATA 0x80000004
62 #define KEY_HKLM "HKLM"
63 #define KEY_HKU "HKU"
64 #define KEY_HKCR "HKCR"
65 #define KEY_HKPD "HKPD"
66 #define KEY_HKPT "HKPT"
67 #define KEY_SERVICES "HKLM\\SYSTEM\\CurrentControlSet\\Services"
68 #define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print"
69 #define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers"
70 #define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports"
71 #define KEY_EVENTLOG "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog"
72 #define KEY_SHARES "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares"
73 #define KEY_TREE_ROOT ""
75 /* Registry data types */
77 #define REG_NONE 0
78 #define REG_SZ 1
79 #define REG_EXPAND_SZ 2
80 #define REG_BINARY 3
81 #define REG_DWORD 4
82 #define REG_DWORD_LE 4 /* DWORD, little endian */
83 #define REG_DWORD_BE 5 /* DWORD, big endian */
84 #define REG_LINK 6
85 #define REG_MULTI_SZ 7
86 #define REG_RESOURCE_LIST 8
87 #define REG_FULL_RESOURCE_DESCRIPTOR 9
88 #define REG_RESOURCE_REQUIREMENTS_LIST 10
91 * Registry key types
92 * Most keys are going to be GENERIC -- may need a better name?
93 * HKPD and HKPT are used by reg_perfcount.c
94 * they are special keys that contain performance data
96 #define REG_KEY_GENERIC 0
97 #define REG_KEY_HKPD 1
98 #define REG_KEY_HKPT 2
101 * container for function pointers to enumeration routines
102 * for virtual registry view
105 typedef struct {
106 /* functions for enumerating subkeys and values */
107 int (*fetch_subkeys)( const char *key, REGSUBKEY_CTR *subkeys);
108 int (*fetch_values) ( const char *key, REGVAL_CTR *val );
109 BOOL (*store_subkeys)( const char *key, REGSUBKEY_CTR *subkeys );
110 BOOL (*store_values)( const char *key, REGVAL_CTR *val );
111 BOOL (*reg_access_check)( const char *keyname, uint32 requested, uint32 *granted, NT_USER_TOKEN *token );
112 } REGISTRY_OPS;
114 typedef struct {
115 const char *keyname; /* full path to name of key */
116 REGISTRY_OPS *ops; /* registry function hooks */
117 } REGISTRY_HOOK;
120 /* structure to store the registry handles */
122 typedef struct _RegistryKey {
123 uint32 type;
124 char *name; /* full name of registry key */
125 uint32 access_granted;
126 REGISTRY_HOOK *hook;
127 } REGISTRY_KEY;
130 * RPC REGISTRY STRUCTURES
133 /***********************************************/
135 typedef struct {
136 uint16 *server;
137 uint32 access;
138 } REG_Q_OPEN_HIVE;
140 typedef struct {
141 POLICY_HND pol;
142 WERROR status;
143 } REG_R_OPEN_HIVE;
146 /***********************************************/
148 typedef struct {
149 POLICY_HND pol;
150 } REG_Q_FLUSH_KEY;
152 typedef struct {
153 WERROR status;
154 } REG_R_FLUSH_KEY;
157 /***********************************************/
159 typedef struct {
160 POLICY_HND handle;
161 uint32 sec_info;
162 uint32 ptr;
163 BUFHDR hdr_sec;
164 SEC_DESC_BUF *data;
165 } REG_Q_SET_KEY_SEC;
167 typedef struct {
168 WERROR status;
169 } REG_R_SET_KEY_SEC;
172 /***********************************************/
174 typedef struct {
175 POLICY_HND handle;
176 uint32 sec_info;
177 uint32 ptr;
178 BUFHDR hdr_sec;
179 SEC_DESC_BUF *data;
180 } REG_Q_GET_KEY_SEC;
182 typedef struct {
183 uint32 sec_info;
184 uint32 ptr;
185 BUFHDR hdr_sec;
186 SEC_DESC_BUF *data;
187 WERROR status;
188 } REG_R_GET_KEY_SEC;
190 /***********************************************/
192 typedef struct {
193 POLICY_HND handle;
194 UNISTR4 name;
195 uint32 type;
196 RPC_DATA_BLOB value;
197 uint32 size;
198 } REG_Q_SET_VALUE;
200 typedef struct {
201 WERROR status;
202 } REG_R_SET_VALUE;
204 /***********************************************/
206 typedef struct {
207 POLICY_HND pol;
208 uint32 val_index;
209 UNISTR4 name;
210 uint32 *type;
211 REGVAL_BUFFER *value; /* value, in byte buffer */
212 uint32 *buffer_len;
213 uint32 *name_len;
214 } REG_Q_ENUM_VALUE;
216 typedef struct {
217 UNISTR4 name;
218 uint32 *type;
219 REGVAL_BUFFER *value;
220 uint32 *buffer_len1;
221 uint32 *buffer_len2;
222 WERROR status;
223 } REG_R_ENUM_VALUE;
225 /***********************************************/
227 typedef struct {
228 POLICY_HND handle;
229 UNISTR4 name;
230 UNISTR4 key_class;
231 uint32 options;
232 uint32 access;
234 /* FIXME! collapse all this into one structure */
235 uint32 *sec_info;
236 uint32 ptr2;
237 BUFHDR hdr_sec;
238 uint32 ptr3;
239 SEC_DESC_BUF *data;
241 uint32 *disposition;
242 } REG_Q_CREATE_KEY_EX;
244 typedef struct {
245 POLICY_HND handle;
246 uint32 disposition;
247 WERROR status;
248 } REG_R_CREATE_KEY_EX;
250 /***********************************************/
252 typedef struct {
253 POLICY_HND handle;
254 UNISTR4 name;
255 } REG_Q_DELETE_KEY;
257 typedef struct {
258 WERROR status;
259 } REG_R_DELETE_KEY;
261 /***********************************************/
263 typedef struct {
264 POLICY_HND handle;
265 UNISTR4 name;
266 } REG_Q_DELETE_VALUE;
268 typedef struct {
269 WERROR status;
270 } REG_R_DELETE_VALUE;
272 /***********************************************/
274 typedef struct {
275 POLICY_HND pol;
276 UNISTR4 key_class;
277 } REG_Q_QUERY_KEY;
279 typedef struct {
280 UNISTR4 key_class;
281 uint32 num_subkeys;
282 uint32 max_subkeylen;
283 uint32 reserved; /* 0x0000 0000 - according to MSDN (max_subkeysize?) */
284 uint32 num_values;
285 uint32 max_valnamelen;
286 uint32 max_valbufsize;
287 uint32 sec_desc; /* 0x0000 0078 */
288 NTTIME mod_time; /* modified time */
289 WERROR status;
290 } REG_R_QUERY_KEY;
293 /***********************************************/
295 typedef struct {
296 POLICY_HND pol;
297 } REG_Q_GETVERSION;
299 typedef struct {
300 uint32 win_version;
301 WERROR status;
302 } REG_R_GETVERSION;
305 /***********************************************/
307 typedef struct {
308 POLICY_HND pol;
309 UNISTR4 filename;
310 uint32 flags;
311 } REG_Q_RESTORE_KEY;
313 typedef struct {
314 WERROR status; /* return status */
315 } REG_R_RESTORE_KEY;
318 /***********************************************/
321 /* I have no idea if this is correct since I
322 have not seen the full structure on the wire
323 as of yet */
325 typedef struct {
326 uint32 max_len;
327 uint32 len;
328 SEC_DESC *secdesc;
329 } REG_SEC_DESC_BUF;
331 typedef struct {
332 uint32 size; /* size in bytes of security descriptor */
333 REG_SEC_DESC_BUF secdesc;
334 uint8 inherit; /* see MSDN for a description */
335 } SECURITY_ATTRIBUTE;
337 typedef struct {
338 POLICY_HND pol;
339 UNISTR4 filename;
340 SECURITY_ATTRIBUTE *sec_attr;
341 } REG_Q_SAVE_KEY;
343 typedef struct {
344 WERROR status; /* return status */
345 } REG_R_SAVE_KEY;
348 /***********************************************/
350 typedef struct {
351 POLICY_HND pol; /* policy handle */
352 } REG_Q_CLOSE;
354 typedef struct {
355 POLICY_HND pol;
356 WERROR status;
357 } REG_R_CLOSE;
360 /***********************************************/
362 typedef struct {
363 POLICY_HND pol;
364 uint32 key_index;
365 uint16 key_name_len;
366 uint16 unknown_1; /* 0x0414 */
367 uint32 ptr1;
368 uint32 unknown_2; /* 0x0000 020A */
369 uint8 pad1[8];
370 uint32 ptr2;
371 uint8 pad2[8];
372 uint32 ptr3;
373 NTTIME time;
374 } REG_Q_ENUM_KEY;
376 typedef struct {
377 UNISTR4 keyname;
378 UNISTR4 *classname;
379 NTTIME *time;
380 WERROR status; /* return status */
381 } REG_R_ENUM_KEY;
384 /***********************************************/
386 typedef struct {
387 POLICY_HND pol; /* policy handle */
388 UNISTR4 name;
390 uint32 ptr_reserved; /* pointer */
392 uint32 ptr_buf; /* the next three fields follow if ptr_buf != 0 */
393 uint32 ptr_bufsize;
394 uint32 bufsize;
395 uint32 buf_unk;
397 uint32 unk1;
398 uint32 ptr_buflen;
399 uint32 buflen;
401 uint32 ptr_buflen2;
402 uint32 buflen2;
404 } REG_Q_QUERY_VALUE;
406 typedef struct {
407 uint32 *type;
408 REGVAL_BUFFER *value; /* key value */
409 uint32 *buf_max_len;
410 uint32 *buf_len;
411 WERROR status; /* return status */
412 } REG_R_QUERY_VALUE;
415 /***********************************************/
417 typedef struct {
418 POLICY_HND pol;
419 UNISTR4 name;
420 uint32 unknown_0; /* 32 bit unknown - 0x0000 0000 */
421 uint32 access;
422 } REG_Q_OPEN_ENTRY;
424 typedef struct {
425 POLICY_HND handle;
426 WERROR status;
427 } REG_R_OPEN_ENTRY;
429 /***********************************************/
431 typedef struct {
432 uint16 *server;
433 UNISTR4 *message;
434 uint32 timeout; /* in seconds */
435 uint8 force; /* boolean: force shutdown */
436 uint8 reboot; /* boolean: reboot on shutdown */
437 } REG_Q_SHUTDOWN;
439 typedef struct {
440 WERROR status; /* return status */
441 } REG_R_SHUTDOWN;
443 /***********************************************/
445 typedef struct {
446 uint16 *server;
447 UNISTR4 *message;
448 uint32 timeout; /* in seconds */
449 uint8 force; /* boolean: force shutdown */
450 uint8 reboot; /* boolean: reboot on shutdown */
451 uint32 reason; /* reason - must be defined code */
452 } REG_Q_SHUTDOWN_EX;
454 typedef struct {
455 WERROR status;
456 } REG_R_SHUTDOWN_EX;
458 /***********************************************/
460 typedef struct {
461 uint16 *server;
462 } REG_Q_ABORT_SHUTDOWN;
464 typedef struct {
465 WERROR status;
466 } REG_R_ABORT_SHUTDOWN;
469 #endif /* _RPC_REG_H */