4 #include "reg_objects.h"
7 * A REG_SZ string is not necessarily NULL terminated. When retrieving it from
8 * the net, we guarantee this however. A server might want to push it without
9 * the terminator though.
12 struct registry_string {
17 struct registry_value {
18 enum winreg_Type type;
22 struct registry_string sz;
31 /* forward declarations. definitions in reg_objects.c */
36 * container for function pointers to enumeration routines
37 * for virtual registry view
41 /* functions for enumerating subkeys and values */
42 int (*fetch_subkeys)( const char *key, struct regsubkey_ctr *subkeys);
43 int (*fetch_values) ( const char *key, struct regval_ctr *val );
44 bool (*store_subkeys)( const char *key, struct regsubkey_ctr *subkeys );
45 WERROR (*create_subkey)(const char *key, const char *subkey);
46 WERROR (*delete_subkey)(const char *key, const char *subkey);
47 bool (*store_values)( const char *key, struct regval_ctr *val );
48 bool (*reg_access_check)( const char *keyname, uint32 requested,
50 const NT_USER_TOKEN *token );
51 WERROR (*get_secdesc)(TALLOC_CTX *mem_ctx, const char *key,
52 struct security_descriptor **psecdesc);
53 WERROR (*set_secdesc)(const char *key,
54 struct security_descriptor *sec_desc);
55 bool (*subkeys_need_update)(struct regsubkey_ctr *subkeys);
56 bool (*values_need_update)(struct regval_ctr *values);
59 /* structure to store the registry handles */
61 struct registry_key_handle {
63 char *name; /* full name of registry key */
64 uint32 access_granted;
65 struct registry_ops *ops;
69 struct registry_key_handle *key;
70 struct regsubkey_ctr *subkeys;
71 struct regval_ctr *values;
72 struct nt_user_token *token;
78 * Macros that used to reside in rpc_reg.h
82 #define HKEY_CLASSES_ROOT 0x80000000
83 #define HKEY_CURRENT_USER 0x80000001
84 #define HKEY_LOCAL_MACHINE 0x80000002
85 #define HKEY_USERS 0x80000003
86 #define HKEY_PERFORMANCE_DATA 0x80000004
88 #define KEY_HKLM "HKLM"
90 #define KEY_HKCC "HKCC"
91 #define KEY_HKCR "HKCR"
92 #define KEY_HKPD "HKPD"
93 #define KEY_HKPT "HKPT"
94 #define KEY_HKPN "HKPN"
95 #define KEY_HKCU "HKCU"
96 #define KEY_HKDD "HKDD"
97 #define KEY_SERVICES "HKLM\\SYSTEM\\CurrentControlSet\\Services"
98 #define KEY_EVENTLOG "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog"
99 #define KEY_SHARES "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares"
100 #define KEY_NETLOGON_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters"
101 #define KEY_TCPIP_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
102 #define KEY_PROD_OPTIONS "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions"
103 #define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print"
104 #define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers"
105 #define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports"
106 #define KEY_CURRENT_VERSION "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
107 #define KEY_PERFLIB "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib"
108 #define KEY_PERFLIB_009 "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009"
109 #define KEY_GROUP_POLICY "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Group Policy"
110 #define KEY_WINLOGON "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"
111 #define KEY_SMBCONF "HKLM\\SOFTWARE\\Samba\\smbconf"
112 #define KEY_SAMBA_GROUP_POLICY "HKLM\\SOFTWARE\\Samba\\Group Policy"
113 #define KEY_TREE_ROOT ""
115 #define KEY_GP_MACHINE_POLICY "HKLM\\Software\\Policies"
116 #define KEY_GP_MACHINE_WIN_POLICY "HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies"
117 #define KEY_GP_USER_POLICY "HKCU\\Software\\Policies"
118 #define KEY_GP_USER_WIN_POLICY "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies"
122 * Most keys are going to be GENERIC -- may need a better name?
123 * HKPD and HKPT are used by reg_perfcount.c
124 * they are special keys that contain performance data
126 #define REG_KEY_GENERIC 0
127 #define REG_KEY_HKPD 1
128 #define REG_KEY_HKPT 2
131 /* The following definitions come from registry/reg_api.c */
133 WERROR reg_openhive(TALLOC_CTX *mem_ctx, const char *hive,
134 uint32 desired_access,
135 const struct nt_user_token *token,
136 struct registry_key **pkey);
137 WERROR reg_openkey(TALLOC_CTX *mem_ctx, struct registry_key *parent,
138 const char *name, uint32 desired_access,
139 struct registry_key **pkey);
140 WERROR reg_enumkey(TALLOC_CTX *mem_ctx, struct registry_key *key,
141 uint32 idx, char **name, NTTIME *last_write_time);
142 WERROR reg_enumvalue(TALLOC_CTX *mem_ctx, struct registry_key *key,
143 uint32 idx, char **pname, struct registry_value **pval);
144 WERROR reg_queryvalue(TALLOC_CTX *mem_ctx, struct registry_key *key,
145 const char *name, struct registry_value **pval);
146 WERROR reg_queryinfokey(struct registry_key *key, uint32_t *num_subkeys,
147 uint32_t *max_subkeylen, uint32_t *max_subkeysize,
148 uint32_t *num_values, uint32_t *max_valnamelen,
149 uint32_t *max_valbufsize, uint32_t *secdescsize,
150 NTTIME *last_changed_time);
151 WERROR reg_createkey(TALLOC_CTX *ctx, struct registry_key *parent,
152 const char *subkeypath, uint32 desired_access,
153 struct registry_key **pkey,
154 enum winreg_CreateAction *paction);
155 WERROR reg_deletekey(struct registry_key *parent, const char *path);
156 WERROR reg_setvalue(struct registry_key *key, const char *name,
157 const struct registry_value *val);
158 WERROR reg_deletevalue(struct registry_key *key, const char *name);
159 WERROR reg_getkeysecurity(TALLOC_CTX *mem_ctx, struct registry_key *key,
160 struct security_descriptor **psecdesc);
161 WERROR reg_setkeysecurity(struct registry_key *key,
162 struct security_descriptor *psecdesc);
163 WERROR reg_getversion(uint32_t *version);
164 WERROR reg_restorekey(struct registry_key *key, const char *fname);
165 WERROR reg_savekey(struct registry_key *key, const char *fname);
166 WERROR reg_deleteallvalues(struct registry_key *key);
167 WERROR reg_open_path(TALLOC_CTX *mem_ctx, const char *orig_path,
168 uint32 desired_access, const struct nt_user_token *token,
169 struct registry_key **pkey);
170 WERROR reg_deletekey_recursive(TALLOC_CTX *ctx,
171 struct registry_key *parent,
173 WERROR reg_deletesubkeys_recursive(TALLOC_CTX *ctx,
174 struct registry_key *parent,
176 WERROR reg_create_path(TALLOC_CTX *mem_ctx, const char *orig_path,
177 uint32 desired_access,
178 const struct nt_user_token *token,
179 enum winreg_CreateAction *paction,
180 struct registry_key **pkey);
181 WERROR reg_delete_path(const struct nt_user_token *token,
182 const char *orig_path);
184 /* The following definitions come from registry/reg_init_basic.c */
186 WERROR registry_init_common(void);
187 WERROR registry_init_basic(void);
189 /* The following definitions come from registry/reg_init_full.c */
191 WERROR registry_init_full(void);
193 /* The following definitions come from registry/reg_init_smbconf.c */
195 WERROR registry_init_smbconf(const char *keyname);
197 #endif /* _REGISTRY_H */