2 Unix SMB/CIFS implementation.
4 Copyright (C) Gerald Carter 2002.
5 Copyright (C) Jelmer Vernooij 2003-2004.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifndef _REGISTRY_H /* _REGISTRY_H */
25 /* Handles for the predefined keys */
26 #define HKEY_CLASSES_ROOT 0x80000000
27 #define HKEY_CURRENT_USER 0x80000001
28 #define HKEY_LOCAL_MACHINE 0x80000002
29 #define HKEY_USERS 0x80000003
30 #define HKEY_PERFORMANCE_DATA 0x80000004
31 #define HKEY_CURRENT_CONFIG 0x80000005
32 #define HKEY_DYN_DATA 0x80000006
33 #define HKEY_PERFORMANCE_TEXT 0x80000050
34 #define HKEY_PERFORMANCE_NLSTEXT 0x80000060
39 * The general idea here is that every backend provides a 'hive'. Combining
40 * various hives gives you a complete registry like windows has
43 #define REGISTRY_INTERFACE_VERSION 1
45 /* structure to store the registry handles */
52 struct registry_hive *hive;
59 unsigned int data_type;
64 typedef void (*reg_key_notification_function) (void);
65 typedef void (*reg_value_notification_function) (void);
68 * Container for function pointers to enumeration routines
69 * for virtual registry view
71 * Backends can provide :
72 * - just one hive (example: nt4, w95)
73 * - several hives (example: rpc).
75 * Backends should always do case-insensitive compares
76 * (everything is case-insensitive but case-preserving,
79 * There is no save function as all operations are expected to
83 struct hive_operations {
86 /* Implement this one */
87 WERROR (*open_hive) (struct registry_hive *, struct registry_key **);
90 WERROR (*open_key) (TALLOC_CTX *, const struct registry_key *, const char *name, struct registry_key **);
92 WERROR (*num_subkeys) (const struct registry_key *, uint32_t *count);
93 WERROR (*num_values) (const struct registry_key *, uint32_t *count);
94 WERROR (*get_subkey_by_index) (TALLOC_CTX *, const struct registry_key *, int idx, struct registry_key **);
96 /* Can not contain more then one level */
97 WERROR (*get_subkey_by_name) (TALLOC_CTX *, const struct registry_key *, const char *name, struct registry_key **);
98 WERROR (*get_value_by_index) (TALLOC_CTX *, const struct registry_key *, int idx, struct registry_value **);
100 /* Can not contain more then one level */
101 WERROR (*get_value_by_name) (TALLOC_CTX *, const struct registry_key *, const char *name, struct registry_value **);
103 /* Security control */
104 WERROR (*key_get_sec_desc) (TALLOC_CTX *, const struct registry_key *, struct security_descriptor **);
105 WERROR (*key_set_sec_desc) (const struct registry_key *, const struct security_descriptor *);
108 WERROR (*request_key_change_notify) (const struct registry_key *, reg_key_notification_function);
109 WERROR (*request_value_change_notify) (const struct registry_value *, reg_value_notification_function);
112 WERROR (*add_key)(TALLOC_CTX *, const struct registry_key *, const char *name, uint32_t access_mask, struct security_descriptor *, struct registry_key **);
113 WERROR (*del_key)(const struct registry_key *, const char *name);
114 WERROR (*flush_key) (const struct registry_key *);
116 /* Value management */
117 WERROR (*set_value)(const struct registry_key *, const char *name, uint32_t type, const DATA_BLOB data);
118 WERROR (*del_value)(const struct registry_key *, const char *valname);
123 const struct hive_operations *functions;
124 struct registry_key *root;
126 const char *location;
129 /* Handle to a full registry
130 * contains zero or more hives */
131 struct registry_context {
133 WERROR (*get_predefined_key) (struct registry_context *, uint32_t hkey, struct registry_key **);
136 struct reg_init_function_entry {
137 const struct hive_operations *hive_functions;
138 struct reg_init_function_entry *prev, *next;
141 #endif /* _REGISTRY_H */