r7691: * add .gdbinit to the svn:ignore files
[Samba/gbeck.git] / source / include / rpc_reg.h
blobf89571484c36fb37ab96588974e721bce0b84007
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 (*fetch_subkeys)( char *key, REGSUBKEY_CTR *subkeys);
96 int (*fetch_values) ( char *key, REGVAL_CTR *val );
97 BOOL (*store_subkeys)( char *key, REGSUBKEY_CTR *subkeys );
98 BOOL (*store_values)( char *key, REGVAL_CTR *val );
99 BOOL (*reg_access_check)( const char *keyname, uint32 requested, uint32 *granted, NT_USER_TOKEN *token );
100 } REGISTRY_OPS;
102 typedef struct {
103 const char *keyname; /* full path to name of key */
104 REGISTRY_OPS *ops; /* registry function hooks */
105 } REGISTRY_HOOK;
108 /* structure to store the registry handles */
110 typedef struct _RegistryKey {
111 struct _RegistryKey *prev, *next;
113 pstring name; /* full name of registry key */
114 uint32 access_granted;
115 REGISTRY_HOOK *hook;
116 } REGISTRY_KEY;
119 * RPC REGISTRY STRUCTURES
122 /***********************************************/
124 typedef struct {
125 uint16 *server;
126 uint32 access;
127 } REG_Q_OPEN_HIVE;
129 typedef struct {
130 POLICY_HND pol;
131 WERROR status;
132 } REG_R_OPEN_HIVE;
135 /***********************************************/
137 typedef struct {
138 POLICY_HND pol;
139 } REG_Q_FLUSH_KEY;
141 typedef struct {
142 WERROR status;
143 } REG_R_FLUSH_KEY;
146 /***********************************************/
148 typedef struct {
149 POLICY_HND pol;
150 uint32 sec_info;
151 uint32 ptr;
152 BUFHDR hdr_sec;
153 SEC_DESC_BUF *data;
154 } REG_Q_SET_KEY_SEC;
156 typedef struct {
157 WERROR status;
158 } REG_R_SET_KEY_SEC;
161 /***********************************************/
163 typedef struct {
164 POLICY_HND pol;
165 uint32 sec_info;
166 uint32 ptr;
167 BUFHDR hdr_sec;
168 SEC_DESC_BUF *data;
169 } REG_Q_GET_KEY_SEC;
171 typedef struct {
172 uint32 sec_info;
173 uint32 ptr;
174 BUFHDR hdr_sec;
175 SEC_DESC_BUF *data;
176 WERROR status;
177 } REG_R_GET_KEY_SEC;
179 /***********************************************/
181 typedef struct {
182 POLICY_HND handle;
183 UNISTR4 name;
184 uint32 type;
185 RPC_DATA_BLOB value;
186 uint32 size;
187 } REG_Q_SET_VALUE;
189 typedef struct {
190 WERROR status;
191 } REG_R_SET_VALUE;
193 /***********************************************/
195 typedef struct {
196 POLICY_HND pol;
197 uint32 val_index;
198 UNISTR4 name;
199 uint32 *type;
200 REGVAL_BUFFER *value; /* value, in byte buffer */
201 uint32 *buffer_len;
202 uint32 *name_len;
203 } REG_Q_ENUM_VALUE;
205 typedef struct {
206 UNISTR4 name;
207 uint32 *type;
208 REGVAL_BUFFER *value;
209 uint32 *buffer_len1;
210 uint32 *buffer_len2;
211 WERROR status;
212 } REG_R_ENUM_VALUE;
214 /***********************************************/
216 typedef struct {
217 POLICY_HND handle;
218 UNISTR4 name;
219 UNISTR4 class;
220 uint32 reserved;
221 uint32 access;
222 uint32 *sec_info;
223 uint32 ptr2;
224 BUFHDR hdr_sec;
225 uint32 ptr3;
226 SEC_DESC_BUF *data;
227 uint32 unknown_2; /* 0x0000 0000 */
228 } REG_Q_CREATE_KEY;
230 typedef struct {
231 POLICY_HND handle;
232 uint32 unknown;
233 WERROR status;
234 } REG_R_CREATE_KEY;
236 /***********************************************/
238 typedef struct {
239 POLICY_HND handle;
240 UNISTR4 name;
241 } REG_Q_DELETE_KEY;
243 typedef struct {
244 POLICY_HND key_pol;
245 WERROR status;
246 } REG_R_DELETE_KEY;
248 /***********************************************/
250 typedef struct {
251 POLICY_HND handle;
252 UNISTR4 name;
253 } REG_Q_DELETE_VALUE;
255 typedef struct {
256 POLICY_HND key_pol;
257 WERROR status;
258 } REG_R_DELETE_VALUE;
260 /***********************************************/
262 typedef struct {
263 POLICY_HND pol;
264 UNISTR4 class;
265 } REG_Q_QUERY_KEY;
267 typedef struct {
268 UNISTR4 class;
269 uint32 num_subkeys;
270 uint32 max_subkeylen;
271 uint32 reserved; /* 0x0000 0000 - according to MSDN (max_subkeysize?) */
272 uint32 num_values;
273 uint32 max_valnamelen;
274 uint32 max_valbufsize;
275 uint32 sec_desc; /* 0x0000 0078 */
276 NTTIME mod_time; /* modified time */
277 WERROR status;
278 } REG_R_QUERY_KEY;
281 /***********************************************/
283 typedef struct {
284 POLICY_HND pol;
285 } REG_Q_GETVERSION;
287 typedef struct {
288 uint32 win_version;
289 WERROR status;
290 } REG_R_GETVERSION;
293 /***********************************************/
295 typedef struct {
296 POLICY_HND pol;
297 UNISTR4 filename;
298 uint32 flags;
299 } REG_Q_RESTORE_KEY;
301 typedef struct {
302 WERROR status; /* return status */
303 } REG_R_RESTORE_KEY;
306 /***********************************************/
309 /* I have no idea if this is correct since I
310 have not seen the full structure on the wire
311 as of yet */
313 typedef struct {
314 uint32 max_len;
315 uint32 len;
316 SEC_DESC *secdesc;
317 } REG_SEC_DESC_BUF;
319 typedef struct {
320 uint32 size; /* size in bytes of security descriptor */
321 REG_SEC_DESC_BUF secdesc;
322 uint8 inherit; /* see MSDN for a description */
323 } SECURITY_ATTRIBUTE;
325 typedef struct {
326 POLICY_HND pol;
327 UNISTR4 filename;
328 SECURITY_ATTRIBUTE *sec_attr;
329 } REG_Q_SAVE_KEY;
331 typedef struct {
332 WERROR status; /* return status */
333 } REG_R_SAVE_KEY;
336 /***********************************************/
338 typedef struct {
339 POLICY_HND pol; /* policy handle */
340 } REG_Q_CLOSE;
342 typedef struct {
343 POLICY_HND pol;
344 WERROR status;
345 } REG_R_CLOSE;
348 /***********************************************/
350 typedef struct {
351 POLICY_HND pol;
352 uint32 key_index;
353 uint16 key_name_len;
354 uint16 unknown_1; /* 0x0414 */
355 uint32 ptr1;
356 uint32 unknown_2; /* 0x0000 020A */
357 uint8 pad1[8];
358 uint32 ptr2;
359 uint8 pad2[8];
360 uint32 ptr3;
361 NTTIME time;
362 } REG_Q_ENUM_KEY;
364 typedef struct {
365 UNISTR4 keyname;
366 UNISTR4 *classname;
367 NTTIME *time;
368 WERROR status; /* return status */
369 } REG_R_ENUM_KEY;
372 /***********************************************/
374 typedef struct {
375 POLICY_HND pol; /* policy handle */
376 UNISTR4 name;
378 uint32 ptr_reserved; /* pointer */
380 uint32 ptr_buf; /* the next three fields follow if ptr_buf != 0 */
381 uint32 ptr_bufsize;
382 uint32 bufsize;
383 uint32 buf_unk;
385 uint32 unk1;
386 uint32 ptr_buflen;
387 uint32 buflen;
389 uint32 ptr_buflen2;
390 uint32 buflen2;
392 } REG_Q_INFO;
394 typedef struct {
395 uint32 *type;
396 REGVAL_BUFFER *value; /* key value */
397 uint32 *buf_max_len;
398 uint32 *buf_len;
399 WERROR status; /* return status */
400 } REG_R_INFO;
403 /***********************************************/
405 typedef struct {
406 POLICY_HND pol;
407 UNISTR4 name;
408 uint32 unknown_0; /* 32 bit unknown - 0x0000 0000 */
409 uint32 access;
410 } REG_Q_OPEN_ENTRY;
412 typedef struct {
413 POLICY_HND handle;
414 WERROR status;
415 } REG_R_OPEN_ENTRY;
417 /***********************************************/
419 typedef struct {
420 uint16 *server;
421 UNISTR4 *message;
422 uint32 timeout; /* in seconds */
423 uint8 force; /* boolean: force shutdown */
424 uint8 reboot; /* boolean: reboot on shutdown */
425 } REG_Q_SHUTDOWN;
427 typedef struct {
428 WERROR status; /* return status */
429 } REG_R_SHUTDOWN;
431 /***********************************************/
433 typedef struct {
434 uint16 *server;
435 UNISTR4 *message;
436 uint32 timeout; /* in seconds */
437 uint8 force; /* boolean: force shutdown */
438 uint8 reboot; /* boolean: reboot on shutdown */
439 uint32 reason; /* reason - must be defined code */
440 } REG_Q_SHUTDOWN_EX;
442 typedef struct {
443 WERROR status;
444 } REG_R_SHUTDOWN_EX;
446 /***********************************************/
448 typedef struct {
449 uint16 *server;
450 } REG_Q_ABORT_SHUTDOWN;
452 typedef struct {
453 WERROR status;
454 } REG_R_ABORT_SHUTDOWN;
457 #endif /* _RPC_REG_H */