| 1 | /*
|
|---|
| 2 | Unix SMB/CIFS implementation.
|
|---|
| 3 | Registry interface
|
|---|
| 4 | Copyright (C) Gerald Carter 2002.
|
|---|
| 5 | Copyright (C) Jelmer Vernooij 2003-2007.
|
|---|
| 6 |
|
|---|
| 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 3 of the License, or
|
|---|
| 10 | (at your option) any later version.
|
|---|
| 11 |
|
|---|
| 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.
|
|---|
| 16 |
|
|---|
| 17 | You should have received a copy of the GNU General Public License
|
|---|
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|---|
| 19 | */
|
|---|
| 20 |
|
|---|
| 21 | #ifndef _REGISTRY_H /* _REGISTRY_H */
|
|---|
| 22 | #define _REGISTRY_H
|
|---|
| 23 |
|
|---|
| 24 | struct registry_context;
|
|---|
| 25 | struct loadparm_context;
|
|---|
| 26 | struct smb_iconv_convenience;
|
|---|
| 27 |
|
|---|
| 28 | #include <talloc.h>
|
|---|
| 29 | #include "libcli/util/werror.h"
|
|---|
| 30 | #include "librpc/gen_ndr/security.h"
|
|---|
| 31 | #include "libcli/util/ntstatus.h"
|
|---|
| 32 | #include "../lib/util/time.h"
|
|---|
| 33 | #include "../lib/util/data_blob.h"
|
|---|
| 34 |
|
|---|
| 35 | /**
|
|---|
| 36 | * The hive API. This API is generally used for
|
|---|
| 37 | * reading a specific file that contains just one hive.
|
|---|
| 38 | *
|
|---|
| 39 | * Good examples are .DAT (NTUSER.DAT) files.
|
|---|
| 40 | *
|
|---|
| 41 | * This API does not have any notification support (that
|
|---|
| 42 | * should be provided by the registry implementation), nor
|
|---|
| 43 | * does it understand what predefined keys are.
|
|---|
| 44 | */
|
|---|
| 45 |
|
|---|
| 46 | struct hive_key {
|
|---|
| 47 | const struct hive_operations *ops;
|
|---|
| 48 | };
|
|---|
| 49 |
|
|---|
| 50 | struct hive_operations {
|
|---|
| 51 | const char *name;
|
|---|
| 52 |
|
|---|
| 53 | /**
|
|---|
| 54 | * Open a specific subkey
|
|---|
| 55 | */
|
|---|
| 56 | WERROR (*enum_key) (TALLOC_CTX *mem_ctx,
|
|---|
| 57 | const struct hive_key *key, uint32_t idx,
|
|---|
| 58 | const char **name,
|
|---|
| 59 | const char **classname,
|
|---|
| 60 | NTTIME *last_mod_time);
|
|---|
| 61 |
|
|---|
| 62 | /**
|
|---|
| 63 | * Open a subkey by name
|
|---|
| 64 | */
|
|---|
| 65 | WERROR (*get_key_by_name) (TALLOC_CTX *mem_ctx,
|
|---|
| 66 | const struct hive_key *key, const char *name,
|
|---|
| 67 | struct hive_key **subkey);
|
|---|
| 68 |
|
|---|
| 69 | /**
|
|---|
| 70 | * Add a new key.
|
|---|
| 71 | */
|
|---|
| 72 | WERROR (*add_key) (TALLOC_CTX *ctx,
|
|---|
| 73 | const struct hive_key *parent_key, const char *name,
|
|---|
| 74 | const char *classname,
|
|---|
| 75 | struct security_descriptor *desc,
|
|---|
| 76 | struct hive_key **key);
|
|---|
| 77 | /**
|
|---|
| 78 | * Remove an existing key.
|
|---|
| 79 | */
|
|---|
| 80 | WERROR (*del_key) (const struct hive_key *key, const char *name);
|
|---|
| 81 |
|
|---|
| 82 | /**
|
|---|
| 83 | * Force write of a key to disk.
|
|---|
| 84 | */
|
|---|
| 85 | WERROR (*flush_key) (struct hive_key *key);
|
|---|
| 86 |
|
|---|
| 87 | /**
|
|---|
| 88 | * Retrieve a registry value with a specific index.
|
|---|
| 89 | */
|
|---|
| 90 | WERROR (*enum_value) (TALLOC_CTX *mem_ctx,
|
|---|
| 91 | struct hive_key *key, int idx,
|
|---|
| 92 | const char **name, uint32_t *type,
|
|---|
| 93 | DATA_BLOB *data);
|
|---|
| 94 |
|
|---|
| 95 | /**
|
|---|
| 96 | * Retrieve a registry value with the specified name
|
|---|
| 97 | */
|
|---|
| 98 | WERROR (*get_value_by_name) (TALLOC_CTX *mem_ctx,
|
|---|
| 99 | struct hive_key *key, const char *name,
|
|---|
| 100 | uint32_t *type, DATA_BLOB *data);
|
|---|
| 101 |
|
|---|
| 102 | /**
|
|---|
| 103 | * Set a value on the specified registry key.
|
|---|
| 104 | */
|
|---|
| 105 | WERROR (*set_value) (struct hive_key *key, const char *name,
|
|---|
| 106 | uint32_t type, const DATA_BLOB data);
|
|---|
| 107 |
|
|---|
| 108 | /**
|
|---|
| 109 | * Remove a value.
|
|---|
| 110 | */
|
|---|
| 111 | WERROR (*delete_value) (struct hive_key *key, const char *name);
|
|---|
| 112 |
|
|---|
| 113 | /* Security Descriptors */
|
|---|
| 114 |
|
|---|
| 115 | /**
|
|---|
| 116 | * Change the security descriptor on a registry key.
|
|---|
| 117 | *
|
|---|
| 118 | * This should return WERR_NOT_SUPPORTED if the underlying
|
|---|
| 119 | * format does not have a mechanism for storing
|
|---|
| 120 | * security descriptors.
|
|---|
| 121 | */
|
|---|
| 122 | WERROR (*set_sec_desc) (struct hive_key *key,
|
|---|
| 123 | const struct security_descriptor *desc);
|
|---|
| 124 |
|
|---|
| 125 | /**
|
|---|
| 126 | * Retrieve the security descriptor on a registry key.
|
|---|
| 127 | *
|
|---|
| 128 | * This should return WERR_NOT_SUPPORTED if the underlying
|
|---|
| 129 | * format does not have a mechanism for storing
|
|---|
| 130 | * security descriptors.
|
|---|
| 131 | */
|
|---|
| 132 | WERROR (*get_sec_desc) (TALLOC_CTX *ctx,
|
|---|
| 133 | const struct hive_key *key,
|
|---|
| 134 | struct security_descriptor **desc);
|
|---|
| 135 |
|
|---|
| 136 | /**
|
|---|
| 137 | * Retrieve general information about a key.
|
|---|
| 138 | */
|
|---|
| 139 | WERROR (*get_key_info) (TALLOC_CTX *mem_ctx,
|
|---|
| 140 | const struct hive_key *key,
|
|---|
| 141 | const char **classname,
|
|---|
| 142 | uint32_t *num_subkeys,
|
|---|
| 143 | uint32_t *num_values,
|
|---|
| 144 | NTTIME *last_change_time,
|
|---|
| 145 | uint32_t *max_subkeynamelen,
|
|---|
| 146 | uint32_t *max_valnamelen,
|
|---|
| 147 | uint32_t *max_valbufsize);
|
|---|
| 148 | };
|
|---|
| 149 |
|
|---|
| 150 | struct cli_credentials;
|
|---|
| 151 | struct auth_session_info;
|
|---|
| 152 | struct tevent_context;
|
|---|
| 153 |
|
|---|
| 154 | WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
|
|---|
| 155 | struct auth_session_info *session_info,
|
|---|
| 156 | struct cli_credentials *credentials,
|
|---|
| 157 | struct tevent_context *ev_ctx,
|
|---|
| 158 | struct loadparm_context *lp_ctx,
|
|---|
| 159 | struct hive_key **root);
|
|---|
| 160 | WERROR hive_key_get_info(TALLOC_CTX *mem_ctx, const struct hive_key *key,
|
|---|
| 161 | const char **classname, uint32_t *num_subkeys,
|
|---|
| 162 | uint32_t *num_values, NTTIME *last_change_time,
|
|---|
| 163 | uint32_t *max_subkeynamelen,
|
|---|
| 164 | uint32_t *max_valnamelen, uint32_t *max_valbufsize);
|
|---|
| 165 | WERROR hive_key_add_name(TALLOC_CTX *ctx, const struct hive_key *parent_key,
|
|---|
| 166 | const char *name, const char *classname,
|
|---|
| 167 | struct security_descriptor *desc,
|
|---|
| 168 | struct hive_key **key);
|
|---|
| 169 | WERROR hive_key_del(const struct hive_key *key, const char *name);
|
|---|
| 170 | WERROR hive_get_key_by_name(TALLOC_CTX *mem_ctx,
|
|---|
| 171 | const struct hive_key *key, const char *name,
|
|---|
| 172 | struct hive_key **subkey);
|
|---|
| 173 | WERROR hive_enum_key(TALLOC_CTX *mem_ctx,
|
|---|
| 174 | const struct hive_key *key, uint32_t idx,
|
|---|
| 175 | const char **name,
|
|---|
| 176 | const char **classname,
|
|---|
| 177 | NTTIME *last_mod_time);
|
|---|
| 178 |
|
|---|
| 179 | WERROR hive_key_set_value(struct hive_key *key, const char *name,
|
|---|
| 180 | uint32_t type, const DATA_BLOB data);
|
|---|
| 181 |
|
|---|
| 182 | WERROR hive_get_value(TALLOC_CTX *mem_ctx,
|
|---|
| 183 | struct hive_key *key, const char *name,
|
|---|
| 184 | uint32_t *type, DATA_BLOB *data);
|
|---|
| 185 | WERROR hive_get_value_by_index(TALLOC_CTX *mem_ctx,
|
|---|
| 186 | struct hive_key *key, uint32_t idx,
|
|---|
| 187 | const char **name,
|
|---|
| 188 | uint32_t *type, DATA_BLOB *data);
|
|---|
| 189 | WERROR hive_get_sec_desc(TALLOC_CTX *mem_ctx,
|
|---|
| 190 | struct hive_key *key,
|
|---|
| 191 | struct security_descriptor **security);
|
|---|
| 192 |
|
|---|
| 193 | WERROR hive_set_sec_desc(struct hive_key *key,
|
|---|
| 194 | const struct security_descriptor *security);
|
|---|
| 195 |
|
|---|
| 196 | WERROR hive_key_del_value(struct hive_key *key, const char *name);
|
|---|
| 197 |
|
|---|
| 198 | WERROR hive_key_flush(struct hive_key *key);
|
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 | /* Individual backends */
|
|---|
| 202 | WERROR reg_open_directory(TALLOC_CTX *parent_ctx,
|
|---|
| 203 | const char *location, struct hive_key **key);
|
|---|
| 204 | WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx,
|
|---|
| 205 | const char *location, struct smb_iconv_convenience *iconv_convenience,
|
|---|
| 206 | struct hive_key **key);
|
|---|
| 207 | WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
|
|---|
| 208 | struct auth_session_info *session_info,
|
|---|
| 209 | struct cli_credentials *credentials,
|
|---|
| 210 | struct tevent_context *ev_ctx,
|
|---|
| 211 | struct loadparm_context *lp_ctx,
|
|---|
| 212 | struct hive_key **k);
|
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 | WERROR reg_create_directory(TALLOC_CTX *parent_ctx,
|
|---|
| 216 | const char *location, struct hive_key **key);
|
|---|
| 217 | WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx,
|
|---|
| 218 | struct smb_iconv_convenience *iconv_convenience,
|
|---|
| 219 | const char *location,
|
|---|
| 220 | int major_version,
|
|---|
| 221 | struct hive_key **key);
|
|---|
| 222 |
|
|---|
| 223 |
|
|---|
| 224 |
|
|---|
| 225 | /* Handles for the predefined keys */
|
|---|
| 226 | #define HKEY_CLASSES_ROOT 0x80000000
|
|---|
| 227 | #define HKEY_CURRENT_USER 0x80000001
|
|---|
| 228 | #define HKEY_LOCAL_MACHINE 0x80000002
|
|---|
| 229 | #define HKEY_USERS 0x80000003
|
|---|
| 230 | #define HKEY_PERFORMANCE_DATA 0x80000004
|
|---|
| 231 | #define HKEY_CURRENT_CONFIG 0x80000005
|
|---|
| 232 | #define HKEY_DYN_DATA 0x80000006
|
|---|
| 233 | #define HKEY_PERFORMANCE_TEXT 0x80000050
|
|---|
| 234 | #define HKEY_PERFORMANCE_NLSTEXT 0x80000060
|
|---|
| 235 |
|
|---|
| 236 | #define HKEY_FIRST HKEY_CLASSES_ROOT
|
|---|
| 237 | #define HKEY_LAST HKEY_PERFORMANCE_NLSTEXT
|
|---|
| 238 |
|
|---|
| 239 | struct reg_predefined_key {
|
|---|
| 240 | uint32_t handle;
|
|---|
| 241 | const char *name;
|
|---|
| 242 | };
|
|---|
| 243 |
|
|---|
| 244 | extern const struct reg_predefined_key reg_predefined_keys[];
|
|---|
| 245 |
|
|---|
| 246 | #define REG_DELETE -1
|
|---|
| 247 |
|
|---|
| 248 | /*
|
|---|
| 249 | * The general idea here is that every backend provides a 'hive'. Combining
|
|---|
| 250 | * various hives gives you a complete registry like windows has
|
|---|
| 251 | */
|
|---|
| 252 |
|
|---|
| 253 | #define REGISTRY_INTERFACE_VERSION 1
|
|---|
| 254 |
|
|---|
| 255 | struct reg_key_operations;
|
|---|
| 256 |
|
|---|
| 257 | /* structure to store the registry handles */
|
|---|
| 258 | struct registry_key
|
|---|
| 259 | {
|
|---|
| 260 | struct registry_context *context;
|
|---|
| 261 | };
|
|---|
| 262 |
|
|---|
| 263 | struct registry_value
|
|---|
| 264 | {
|
|---|
| 265 | const char *name;
|
|---|
| 266 | unsigned int data_type;
|
|---|
| 267 | DATA_BLOB data;
|
|---|
| 268 | };
|
|---|
| 269 |
|
|---|
| 270 | /* FIXME */
|
|---|
| 271 | typedef void (*reg_key_notification_function) (void);
|
|---|
| 272 | typedef void (*reg_value_notification_function) (void);
|
|---|
| 273 |
|
|---|
| 274 | struct cli_credentials;
|
|---|
| 275 |
|
|---|
| 276 | struct registry_operations {
|
|---|
| 277 | const char *name;
|
|---|
| 278 |
|
|---|
| 279 | WERROR (*get_key_info) (TALLOC_CTX *mem_ctx,
|
|---|
| 280 | const struct registry_key *key,
|
|---|
| 281 | const char **classname,
|
|---|
| 282 | uint32_t *numsubkeys,
|
|---|
| 283 | uint32_t *numvalues,
|
|---|
| 284 | NTTIME *last_change_time,
|
|---|
| 285 | uint32_t *max_subkeynamelen,
|
|---|
| 286 | uint32_t *max_valnamelen,
|
|---|
| 287 | uint32_t *max_valbufsize);
|
|---|
| 288 |
|
|---|
| 289 | WERROR (*flush_key) (struct registry_key *key);
|
|---|
| 290 |
|
|---|
| 291 | WERROR (*get_predefined_key) (struct registry_context *ctx,
|
|---|
| 292 | uint32_t key_id,
|
|---|
| 293 | struct registry_key **key);
|
|---|
| 294 |
|
|---|
| 295 | WERROR (*open_key) (TALLOC_CTX *mem_ctx,
|
|---|
| 296 | struct registry_key *parent,
|
|---|
| 297 | const char *path,
|
|---|
| 298 | struct registry_key **key);
|
|---|
| 299 |
|
|---|
| 300 | WERROR (*create_key) (TALLOC_CTX *mem_ctx,
|
|---|
| 301 | struct registry_key *parent,
|
|---|
| 302 | const char *name,
|
|---|
| 303 | const char *key_class,
|
|---|
| 304 | struct security_descriptor *security,
|
|---|
| 305 | struct registry_key **key);
|
|---|
| 306 |
|
|---|
| 307 | WERROR (*delete_key) (struct registry_key *key, const char *name);
|
|---|
| 308 |
|
|---|
| 309 | WERROR (*delete_value) (struct registry_key *key, const char *name);
|
|---|
| 310 |
|
|---|
| 311 | WERROR (*enum_key) (TALLOC_CTX *mem_ctx,
|
|---|
| 312 | const struct registry_key *key, uint32_t idx,
|
|---|
| 313 | const char **name,
|
|---|
| 314 | const char **keyclass,
|
|---|
| 315 | NTTIME *last_changed_time);
|
|---|
| 316 |
|
|---|
| 317 | WERROR (*enum_value) (TALLOC_CTX *mem_ctx,
|
|---|
| 318 | const struct registry_key *key, uint32_t idx,
|
|---|
| 319 | const char **name,
|
|---|
| 320 | uint32_t *type,
|
|---|
| 321 | DATA_BLOB *data);
|
|---|
| 322 |
|
|---|
| 323 | WERROR (*get_sec_desc) (TALLOC_CTX *mem_ctx,
|
|---|
| 324 | const struct registry_key *key,
|
|---|
| 325 | struct security_descriptor **security);
|
|---|
| 326 |
|
|---|
| 327 | WERROR (*set_sec_desc) (struct registry_key *key,
|
|---|
| 328 | const struct security_descriptor *security);
|
|---|
| 329 |
|
|---|
| 330 | WERROR (*load_key) (struct registry_key *key,
|
|---|
| 331 | const char *key_name,
|
|---|
| 332 | const char *path);
|
|---|
| 333 |
|
|---|
| 334 | WERROR (*unload_key) (struct registry_key *key, const char *name);
|
|---|
| 335 |
|
|---|
| 336 | WERROR (*notify_value_change) (struct registry_key *key,
|
|---|
| 337 | reg_value_notification_function fn);
|
|---|
| 338 |
|
|---|
| 339 | WERROR (*get_value) (TALLOC_CTX *mem_ctx,
|
|---|
| 340 | const struct registry_key *key,
|
|---|
| 341 | const char *name,
|
|---|
| 342 | uint32_t *type,
|
|---|
| 343 | DATA_BLOB *data);
|
|---|
| 344 |
|
|---|
| 345 | WERROR (*set_value) (struct registry_key *key,
|
|---|
| 346 | const char *name,
|
|---|
| 347 | uint32_t type,
|
|---|
| 348 | const DATA_BLOB data);
|
|---|
| 349 | };
|
|---|
| 350 |
|
|---|
| 351 | /**
|
|---|
| 352 | * Handle to a full registry
|
|---|
| 353 | * contains zero or more hives
|
|---|
| 354 | */
|
|---|
| 355 | struct registry_context {
|
|---|
| 356 | const struct registry_operations *ops;
|
|---|
| 357 | };
|
|---|
| 358 |
|
|---|
| 359 | struct auth_session_info;
|
|---|
| 360 | struct tevent_context;
|
|---|
| 361 | struct loadparm_context;
|
|---|
| 362 |
|
|---|
| 363 | /**
|
|---|
| 364 | * Open the locally defined registry.
|
|---|
| 365 | */
|
|---|
| 366 | WERROR reg_open_local(TALLOC_CTX *mem_ctx,
|
|---|
| 367 | struct registry_context **ctx);
|
|---|
| 368 |
|
|---|
| 369 | WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
|
|---|
| 370 | struct registry_context **ctx,
|
|---|
| 371 | struct tevent_context *ev_ctx,
|
|---|
| 372 | struct loadparm_context *lp_ctx,
|
|---|
| 373 | struct auth_session_info *session_info,
|
|---|
| 374 | struct cli_credentials *credentials);
|
|---|
| 375 |
|
|---|
| 376 | /**
|
|---|
| 377 | * Open the registry on a remote machine.
|
|---|
| 378 | */
|
|---|
| 379 | WERROR reg_open_remote(struct registry_context **ctx,
|
|---|
| 380 | struct auth_session_info *session_info,
|
|---|
| 381 | struct cli_credentials *credentials,
|
|---|
| 382 | struct loadparm_context *lp_ctx,
|
|---|
| 383 | const char *location, struct tevent_context *ev);
|
|---|
| 384 |
|
|---|
| 385 | WERROR reg_open_wine(struct registry_context **ctx, const char *path);
|
|---|
| 386 |
|
|---|
| 387 | const char *reg_get_predef_name(uint32_t hkey);
|
|---|
| 388 | WERROR reg_get_predefined_key_by_name(struct registry_context *ctx,
|
|---|
| 389 | const char *name,
|
|---|
| 390 | struct registry_key **key);
|
|---|
| 391 | WERROR reg_get_predefined_key(struct registry_context *ctx,
|
|---|
| 392 | uint32_t hkey,
|
|---|
| 393 | struct registry_key **key);
|
|---|
| 394 |
|
|---|
| 395 | WERROR reg_open_key(TALLOC_CTX *mem_ctx, struct registry_key *parent,
|
|---|
| 396 | const char *name, struct registry_key **result);
|
|---|
| 397 |
|
|---|
| 398 | WERROR reg_key_get_value_by_index(TALLOC_CTX *mem_ctx,
|
|---|
| 399 | const struct registry_key *key, uint32_t idx,
|
|---|
| 400 | const char **name,
|
|---|
| 401 | uint32_t *type,
|
|---|
| 402 | DATA_BLOB *data);
|
|---|
| 403 | WERROR reg_key_get_info(TALLOC_CTX *mem_ctx,
|
|---|
| 404 | const struct registry_key *key,
|
|---|
| 405 | const char **class_name,
|
|---|
| 406 | uint32_t *num_subkeys,
|
|---|
| 407 | uint32_t *num_values,
|
|---|
| 408 | NTTIME *last_change_time,
|
|---|
| 409 | uint32_t *max_subkeynamelen,
|
|---|
| 410 | uint32_t *max_valnamelen,
|
|---|
| 411 | uint32_t *max_valbufsize);
|
|---|
| 412 | WERROR reg_key_get_subkey_by_index(TALLOC_CTX *mem_ctx,
|
|---|
| 413 | const struct registry_key *key,
|
|---|
| 414 | int idx,
|
|---|
| 415 | const char **name,
|
|---|
| 416 | const char **classname,
|
|---|
| 417 | NTTIME *last_mod_time);
|
|---|
| 418 | WERROR reg_key_get_subkey_by_name(TALLOC_CTX *mem_ctx,
|
|---|
| 419 | const struct registry_key *key,
|
|---|
| 420 | const char *name,
|
|---|
| 421 | struct registry_key **subkey);
|
|---|
| 422 | WERROR reg_key_get_value_by_name(TALLOC_CTX *mem_ctx,
|
|---|
| 423 | const struct registry_key *key,
|
|---|
| 424 | const char *name,
|
|---|
| 425 | uint32_t *type,
|
|---|
| 426 | DATA_BLOB *data);
|
|---|
| 427 | WERROR reg_key_del(struct registry_key *parent, const char *name);
|
|---|
| 428 | WERROR reg_key_add_name(TALLOC_CTX *mem_ctx,
|
|---|
| 429 | struct registry_key *parent, const char *name,
|
|---|
| 430 | const char *classname,
|
|---|
| 431 | struct security_descriptor *desc,
|
|---|
| 432 | struct registry_key **newkey);
|
|---|
| 433 | WERROR reg_val_set(struct registry_key *key, const char *value,
|
|---|
| 434 | uint32_t type, DATA_BLOB data);
|
|---|
| 435 | WERROR reg_get_sec_desc(TALLOC_CTX *ctx, const struct registry_key *key,
|
|---|
| 436 | struct security_descriptor **secdesc);
|
|---|
| 437 | WERROR reg_del_value(struct registry_key *key, const char *valname);
|
|---|
| 438 | WERROR reg_key_flush(struct registry_key *key);
|
|---|
| 439 | WERROR reg_create_key(TALLOC_CTX *mem_ctx,
|
|---|
| 440 | struct registry_key *parent,
|
|---|
| 441 | const char *name,
|
|---|
| 442 | const char *key_class,
|
|---|
| 443 | struct security_descriptor *security,
|
|---|
| 444 | struct registry_key **key);
|
|---|
| 445 |
|
|---|
| 446 | /* Utility functions */
|
|---|
| 447 | const char *str_regtype(int type);
|
|---|
| 448 | char *reg_val_data_string(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t type, const DATA_BLOB data);
|
|---|
| 449 | char *reg_val_description(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, const char *name,
|
|---|
| 450 | uint32_t type, const DATA_BLOB data);
|
|---|
| 451 | bool reg_string_to_val(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, const char *type_str,
|
|---|
| 452 | const char *data_str, uint32_t *type, DATA_BLOB *data);
|
|---|
| 453 | WERROR reg_open_key_abs(TALLOC_CTX *mem_ctx, struct registry_context *handle,
|
|---|
| 454 | const char *name, struct registry_key **result);
|
|---|
| 455 | WERROR reg_key_del_abs(struct registry_context *ctx, const char *path);
|
|---|
| 456 | WERROR reg_key_add_abs(TALLOC_CTX *mem_ctx, struct registry_context *ctx,
|
|---|
| 457 | const char *path, uint32_t access_mask,
|
|---|
| 458 | struct security_descriptor *sec_desc,
|
|---|
| 459 | struct registry_key **result);
|
|---|
| 460 | WERROR reg_load_key(struct registry_context *ctx, struct registry_key *key,
|
|---|
| 461 | const char *name, const char *filename);
|
|---|
| 462 |
|
|---|
| 463 | WERROR reg_mount_hive(struct registry_context *rctx,
|
|---|
| 464 | struct hive_key *hive_key,
|
|---|
| 465 | uint32_t key_id,
|
|---|
| 466 | const char **elements);
|
|---|
| 467 |
|
|---|
| 468 | struct registry_key *reg_import_hive_key(struct registry_context *ctx,
|
|---|
| 469 | struct hive_key *hive,
|
|---|
| 470 | uint32_t predef_key,
|
|---|
| 471 | const char **elements);
|
|---|
| 472 | WERROR reg_set_sec_desc(struct registry_key *key,
|
|---|
| 473 | const struct security_descriptor *security);
|
|---|
| 474 |
|
|---|
| 475 | struct reg_diff_callbacks {
|
|---|
| 476 | WERROR (*add_key) (void *callback_data, const char *key_name);
|
|---|
| 477 | WERROR (*set_value) (void *callback_data, const char *key_name,
|
|---|
| 478 | const char *value_name, uint32_t value_type,
|
|---|
| 479 | DATA_BLOB value);
|
|---|
| 480 | WERROR (*del_value) (void *callback_data, const char *key_name,
|
|---|
| 481 | const char *value_name);
|
|---|
| 482 | WERROR (*del_key) (void *callback_data, const char *key_name);
|
|---|
| 483 | WERROR (*del_all_values) (void *callback_data, const char *key_name);
|
|---|
| 484 | WERROR (*done) (void *callback_data);
|
|---|
| 485 | };
|
|---|
| 486 |
|
|---|
| 487 | WERROR reg_diff_apply(struct registry_context *ctx,
|
|---|
| 488 | struct smb_iconv_convenience *ic, const char *filename);
|
|---|
| 489 |
|
|---|
| 490 | WERROR reg_generate_diff(struct registry_context *ctx1,
|
|---|
| 491 | struct registry_context *ctx2,
|
|---|
| 492 | const struct reg_diff_callbacks *callbacks,
|
|---|
| 493 | void *callback_data);
|
|---|
| 494 | WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
|
|---|
| 495 | struct smb_iconv_convenience *iconv_convenience,
|
|---|
| 496 | struct reg_diff_callbacks **callbacks,
|
|---|
| 497 | void **callback_data);
|
|---|
| 498 | WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename,
|
|---|
| 499 | struct smb_iconv_convenience *ic,
|
|---|
| 500 | struct reg_diff_callbacks **callbacks,
|
|---|
| 501 | void **callback_data);
|
|---|
| 502 | WERROR reg_generate_diff_key(struct registry_key *oldkey,
|
|---|
| 503 | struct registry_key *newkey,
|
|---|
| 504 | const char *path,
|
|---|
| 505 | const struct reg_diff_callbacks *callbacks,
|
|---|
| 506 | void *callback_data);
|
|---|
| 507 | WERROR reg_diff_load(const char *filename,
|
|---|
| 508 | struct smb_iconv_convenience *iconv_convenience,
|
|---|
| 509 | const struct reg_diff_callbacks *callbacks,
|
|---|
| 510 | void *callback_data);
|
|---|
| 511 |
|
|---|
| 512 | WERROR reg_dotreg_diff_load(int fd,
|
|---|
| 513 | struct smb_iconv_convenience *iconv_convenience,
|
|---|
| 514 | const struct reg_diff_callbacks *callbacks,
|
|---|
| 515 | void *callback_data);
|
|---|
| 516 |
|
|---|
| 517 | WERROR reg_preg_diff_load(int fd,
|
|---|
| 518 | struct smb_iconv_convenience *iconv_convenience,
|
|---|
| 519 | const struct reg_diff_callbacks *callbacks,
|
|---|
| 520 | void *callback_data);
|
|---|
| 521 |
|
|---|
| 522 | WERROR local_get_predefined_key(struct registry_context *ctx,
|
|---|
| 523 | uint32_t key_id, struct registry_key **key);
|
|---|
| 524 |
|
|---|
| 525 |
|
|---|
| 526 | #endif /* _REGISTRY_H */
|
|---|