r18893: Attempt to fix the Solaris build
[Samba.git] / source / include / rpc_reg.h
blobfe29799d27b5cc2db009452243b4dc9f55e68e84
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_HKCC "HKCC"
65 #define KEY_HKCR "HKCR"
66 #define KEY_HKPD "HKPD"
67 #define KEY_HKPT "HKPT"
68 #define KEY_HKPN "HKPN"
69 #define KEY_HKCU "HKCU"
70 #define KEY_HKDD "HKDD"
71 #define KEY_SERVICES "HKLM\\SYSTEM\\CurrentControlSet\\Services"
72 #define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print"
73 #define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers"
74 #define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports"
75 #define KEY_EVENTLOG "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog"
76 #define KEY_SHARES "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares"
77 #define KEY_TREE_ROOT ""
79 /* Registry data types */
81 #define REG_NONE 0
82 #define REG_SZ 1
83 #define REG_EXPAND_SZ 2
84 #define REG_BINARY 3
85 #define REG_DWORD 4
86 #define REG_DWORD_LE 4 /* DWORD, little endian */
87 #define REG_DWORD_BE 5 /* DWORD, big endian */
88 #define REG_LINK 6
89 #define REG_MULTI_SZ 7
90 #define REG_RESOURCE_LIST 8
91 #define REG_FULL_RESOURCE_DESCRIPTOR 9
92 #define REG_RESOURCE_REQUIREMENTS_LIST 10
93 #define REG_QWORD 11
96 * Registry key types
97 * Most keys are going to be GENERIC -- may need a better name?
98 * HKPD and HKPT are used by reg_perfcount.c
99 * they are special keys that contain performance data
101 #define REG_KEY_GENERIC 0
102 #define REG_KEY_HKPD 1
103 #define REG_KEY_HKPT 2
106 * container for function pointers to enumeration routines
107 * for virtual registry view
110 typedef struct {
111 /* functions for enumerating subkeys and values */
112 int (*fetch_subkeys)( const char *key, REGSUBKEY_CTR *subkeys);
113 int (*fetch_values) ( const char *key, REGVAL_CTR *val );
114 BOOL (*store_subkeys)( const char *key, REGSUBKEY_CTR *subkeys );
115 BOOL (*store_values)( const char *key, REGVAL_CTR *val );
116 BOOL (*reg_access_check)( const char *keyname, uint32 requested, uint32 *granted, NT_USER_TOKEN *token );
117 } REGISTRY_OPS;
119 typedef struct {
120 const char *keyname; /* full path to name of key */
121 REGISTRY_OPS *ops; /* registry function hooks */
122 } REGISTRY_HOOK;
125 /* structure to store the registry handles */
127 typedef struct _RegistryKey {
128 uint32 type;
129 char *name; /* full name of registry key */
130 uint32 access_granted;
131 REGISTRY_HOOK *hook;
132 } REGISTRY_KEY;
135 * RPC REGISTRY STRUCTURES
138 /***********************************************/
140 typedef struct {
141 uint16 *server;
142 uint32 access;
143 } REG_Q_OPEN_HIVE;
145 typedef struct {
146 POLICY_HND pol;
147 WERROR status;
148 } REG_R_OPEN_HIVE;
151 /***********************************************/
153 typedef struct {
154 POLICY_HND pol;
155 } REG_Q_FLUSH_KEY;
157 typedef struct {
158 WERROR status;
159 } REG_R_FLUSH_KEY;
162 /***********************************************/
164 typedef struct {
165 POLICY_HND handle;
166 uint32 sec_info;
167 uint32 ptr;
168 BUFHDR hdr_sec;
169 SEC_DESC_BUF *data;
170 } REG_Q_SET_KEY_SEC;
172 typedef struct {
173 WERROR status;
174 } REG_R_SET_KEY_SEC;
177 /***********************************************/
179 typedef struct {
180 POLICY_HND handle;
181 uint32 sec_info;
182 uint32 ptr;
183 BUFHDR hdr_sec;
184 SEC_DESC_BUF *data;
185 } REG_Q_GET_KEY_SEC;
187 typedef struct {
188 uint32 sec_info;
189 uint32 ptr;
190 BUFHDR hdr_sec;
191 SEC_DESC_BUF *data;
192 WERROR status;
193 } REG_R_GET_KEY_SEC;
195 /***********************************************/
197 typedef struct {
198 POLICY_HND handle;
199 UNISTR4 name;
200 uint32 type;
201 RPC_DATA_BLOB value;
202 uint32 size;
203 } REG_Q_SET_VALUE;
205 typedef struct {
206 WERROR status;
207 } REG_R_SET_VALUE;
209 /***********************************************/
211 typedef struct {
212 POLICY_HND pol;
213 uint32 val_index;
214 UNISTR4 name;
215 uint32 *type;
216 REGVAL_BUFFER *value; /* value, in byte buffer */
217 uint32 *buffer_len;
218 uint32 *name_len;
219 } REG_Q_ENUM_VALUE;
221 typedef struct {
222 UNISTR4 name;
223 uint32 *type;
224 REGVAL_BUFFER *value;
225 uint32 *buffer_len1;
226 uint32 *buffer_len2;
227 WERROR status;
228 } REG_R_ENUM_VALUE;
230 /***********************************************/
232 typedef struct {
233 POLICY_HND handle;
234 UNISTR4 name;
235 UNISTR4 key_class;
236 uint32 options;
237 uint32 access;
239 /* FIXME! collapse all this into one structure */
240 uint32 *sec_info;
241 uint32 ptr2;
242 BUFHDR hdr_sec;
243 uint32 ptr3;
244 SEC_DESC_BUF *data;
246 uint32 *disposition;
247 } REG_Q_CREATE_KEY_EX;
249 typedef struct {
250 POLICY_HND handle;
251 uint32 disposition;
252 WERROR status;
253 } REG_R_CREATE_KEY_EX;
255 /***********************************************/
257 typedef struct {
258 POLICY_HND handle;
259 UNISTR4 name;
260 } REG_Q_DELETE_KEY;
262 typedef struct {
263 WERROR status;
264 } REG_R_DELETE_KEY;
266 /***********************************************/
268 typedef struct {
269 POLICY_HND handle;
270 UNISTR4 name;
271 } REG_Q_DELETE_VALUE;
273 typedef struct {
274 WERROR status;
275 } REG_R_DELETE_VALUE;
277 /***********************************************/
279 typedef struct {
280 POLICY_HND pol;
281 UNISTR4 key_class;
282 } REG_Q_QUERY_KEY;
284 typedef struct {
285 UNISTR4 key_class;
286 uint32 num_subkeys;
287 uint32 max_subkeylen;
288 uint32 reserved; /* 0x0000 0000 - according to MSDN (max_subkeysize?) */
289 uint32 num_values;
290 uint32 max_valnamelen;
291 uint32 max_valbufsize;
292 uint32 sec_desc; /* 0x0000 0078 */
293 NTTIME mod_time; /* modified time */
294 WERROR status;
295 } REG_R_QUERY_KEY;
298 /***********************************************/
300 typedef struct {
301 POLICY_HND pol;
302 } REG_Q_GETVERSION;
304 typedef struct {
305 uint32 win_version;
306 WERROR status;
307 } REG_R_GETVERSION;
310 /***********************************************/
312 typedef struct {
313 POLICY_HND pol;
314 UNISTR4 filename;
315 uint32 flags;
316 } REG_Q_RESTORE_KEY;
318 typedef struct {
319 WERROR status; /* return status */
320 } REG_R_RESTORE_KEY;
323 /***********************************************/
326 /* I have no idea if this is correct since I
327 have not seen the full structure on the wire
328 as of yet */
330 typedef struct {
331 uint32 max_len;
332 uint32 len;
333 SEC_DESC *secdesc;
334 } REG_SEC_DESC_BUF;
336 typedef struct {
337 uint32 size; /* size in bytes of security descriptor */
338 REG_SEC_DESC_BUF secdesc;
339 uint8 inherit; /* see MSDN for a description */
340 } SECURITY_ATTRIBUTE;
342 typedef struct {
343 POLICY_HND pol;
344 UNISTR4 filename;
345 SECURITY_ATTRIBUTE *sec_attr;
346 } REG_Q_SAVE_KEY;
348 typedef struct {
349 WERROR status; /* return status */
350 } REG_R_SAVE_KEY;
353 /***********************************************/
355 typedef struct {
356 POLICY_HND pol; /* policy handle */
357 } REG_Q_CLOSE;
359 typedef struct {
360 POLICY_HND pol;
361 WERROR status;
362 } REG_R_CLOSE;
365 /***********************************************/
367 typedef struct {
368 POLICY_HND pol;
369 uint32 key_index;
370 uint16 key_name_len;
371 uint16 unknown_1; /* 0x0414 */
372 uint32 ptr1;
373 uint32 unknown_2; /* 0x0000 020A */
374 uint8 pad1[8];
375 uint32 ptr2;
376 uint8 pad2[8];
377 uint32 ptr3;
378 NTTIME time;
379 } REG_Q_ENUM_KEY;
381 typedef struct {
382 UNISTR4 keyname;
383 UNISTR4 *classname;
384 NTTIME *time;
385 WERROR status; /* return status */
386 } REG_R_ENUM_KEY;
389 /***********************************************/
391 typedef struct {
392 POLICY_HND pol; /* policy handle */
393 UNISTR4 name;
395 uint32 ptr_reserved; /* pointer */
397 uint32 ptr_buf; /* the next three fields follow if ptr_buf != 0 */
398 uint32 ptr_bufsize;
399 uint32 bufsize;
400 uint32 buf_unk;
402 uint32 unk1;
403 uint32 ptr_buflen;
404 uint32 buflen;
406 uint32 ptr_buflen2;
407 uint32 buflen2;
409 } REG_Q_QUERY_VALUE;
411 typedef struct {
412 uint32 *type;
413 REGVAL_BUFFER *value; /* key value */
414 uint32 *buf_max_len;
415 uint32 *buf_len;
416 WERROR status; /* return status */
417 } REG_R_QUERY_VALUE;
420 /***********************************************/
422 typedef struct {
423 POLICY_HND pol;
424 UNISTR4 name;
425 uint32 unknown_0; /* 32 bit unknown - 0x0000 0000 */
426 uint32 access;
427 } REG_Q_OPEN_ENTRY;
429 typedef struct {
430 POLICY_HND handle;
431 WERROR status;
432 } REG_R_OPEN_ENTRY;
434 /***********************************************/
436 typedef struct {
437 uint16 *server;
438 UNISTR4 *message;
439 uint32 timeout; /* in seconds */
440 uint8 force; /* boolean: force shutdown */
441 uint8 reboot; /* boolean: reboot on shutdown */
442 } REG_Q_SHUTDOWN;
444 typedef struct {
445 WERROR status; /* return status */
446 } REG_R_SHUTDOWN;
448 /***********************************************/
450 typedef struct {
451 uint16 *server;
452 UNISTR4 *message;
453 uint32 timeout; /* in seconds */
454 uint8 force; /* boolean: force shutdown */
455 uint8 reboot; /* boolean: reboot on shutdown */
456 uint32 reason; /* reason - must be defined code */
457 } REG_Q_SHUTDOWN_EX;
459 typedef struct {
460 WERROR status;
461 } REG_R_SHUTDOWN_EX;
463 /***********************************************/
465 typedef struct {
466 uint16 *server;
467 } REG_Q_ABORT_SHUTDOWN;
469 typedef struct {
470 WERROR status;
471 } REG_R_ABORT_SHUTDOWN;
474 #endif /* _RPC_REG_H */