summaryrefslogtreecommitdiff
path: root/source4/lib/registry
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/registry')
-rw-r--r--source4/lib/registry/common/reg_interface.c26
-rw-r--r--source4/lib/registry/registry.h9
-rw-r--r--source4/lib/registry/tools/regtree.c6
3 files changed, 23 insertions, 18 deletions
diff --git a/source4/lib/registry/common/reg_interface.c b/source4/lib/registry/common/reg_interface.c
index 42535d835d..7d65d31d0f 100644
--- a/source4/lib/registry/common/reg_interface.c
+++ b/source4/lib/registry/common/reg_interface.c
@@ -34,7 +34,7 @@ static struct reg_init_function_entry *backends = NULL;
static struct reg_init_function_entry *reg_find_backend_entry(const char *name);
/** Register a new backend. */
-_PUBLIC_ NTSTATUS registry_register(const void *_hive_ops)
+_PUBLIC_ NTSTATUS registry_register(const void *_hive_ops)
{
const struct hive_operations *hive_ops = _hive_ops;
struct reg_init_function_entry *entry = backends;
@@ -90,11 +90,7 @@ _PUBLIC_ BOOL reg_has_backend(const char *backend)
return reg_find_backend_entry(backend) != NULL?True:False;
}
-static const struct {
- uint32_t handle;
- const char *name;
-} predef_names[] =
-{
+const struct reg_predefined_key reg_predefined_keys[] = {
{HKEY_CLASSES_ROOT,"HKEY_CLASSES_ROOT" },
{HKEY_CURRENT_USER,"HKEY_CURRENT_USER" },
{HKEY_LOCAL_MACHINE, "HKEY_LOCAL_MACHINE" },
@@ -111,12 +107,12 @@ static const struct {
_PUBLIC_ int reg_list_predefs(TALLOC_CTX *mem_ctx, char ***predefs, uint32_t **hkeys)
{
int i;
- *predefs = talloc_array(mem_ctx, char *, ARRAY_SIZE(predef_names));
- *hkeys = talloc_array(mem_ctx, uint32_t, ARRAY_SIZE(predef_names));
+ *predefs = talloc_array(mem_ctx, char *, ARRAY_SIZE(reg_predefined_keys));
+ *hkeys = talloc_array(mem_ctx, uint32_t, ARRAY_SIZE(reg_predefined_keys));
- for (i = 0; predef_names[i].name; i++) {
- (*predefs)[i] = talloc_strdup(mem_ctx, predef_names[i].name);
- (*hkeys)[i] = predef_names[i].handle;
+ for (i = 0; reg_predefined_keys[i].name; i++) {
+ (*predefs)[i] = talloc_strdup(mem_ctx, reg_predefined_keys[i].name);
+ (*hkeys)[i] = reg_predefined_keys[i].handle;
}
return i;
@@ -126,8 +122,8 @@ _PUBLIC_ int reg_list_predefs(TALLOC_CTX *mem_ctx, char ***predefs, uint32_t **h
_PUBLIC_ const char *reg_get_predef_name(uint32_t hkey)
{
int i;
- for (i = 0; predef_names[i].name; i++) {
- if (predef_names[i].handle == hkey) return predef_names[i].name;
+ for (i = 0; reg_predefined_keys[i].name; i++) {
+ if (reg_predefined_keys[i].handle == hkey) return reg_predefined_keys[i].name;
}
return NULL;
@@ -138,8 +134,8 @@ _PUBLIC_ WERROR reg_get_predefined_key_by_name(struct registry_context *ctx, con
{
int i;
- for (i = 0; predef_names[i].name; i++) {
- if (!strcasecmp(predef_names[i].name, name)) return reg_get_predefined_key(ctx, predef_names[i].handle, key);
+ for (i = 0; reg_predefined_keys[i].name; i++) {
+ if (!strcasecmp(reg_predefined_keys[i].name, name)) return reg_get_predefined_key(ctx, reg_predefined_keys[i].handle, key);
}
DEBUG(1, ("No predefined key with name '%s'\n", name));
diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h
index 385b0e7d6f..80b412a314 100644
--- a/source4/lib/registry/registry.h
+++ b/source4/lib/registry/registry.h
@@ -36,6 +36,13 @@
#define HKEY_PERFORMANCE_TEXT 0x80000050
#define HKEY_PERFORMANCE_NLSTEXT 0x80000060
+struct reg_predefined_key {
+ uint32_t handle;
+ const char *name;
+};
+
+extern const struct reg_predefined_key reg_predefined_keys[];
+
#define REG_DELETE -1
/*
@@ -145,6 +152,8 @@ struct reg_init_function_entry {
struct reg_init_function_entry *prev, *next;
};
+/* Representing differences between registry files */
+
struct reg_diff_value
{
char *name;
diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c
index 106039361a..b0e1c46d9c 100644
--- a/source4/lib/registry/tools/regtree.c
+++ b/source4/lib/registry/tools/regtree.c
@@ -125,10 +125,10 @@ int main(int argc, char **argv)
if (!h) {
print_tree(0, root, fullpath, no_values);
} else {
- for(i = HKEY_CLASSES_ROOT; i < HKEY_PERFORMANCE_NLSTEXT; i++) {
- error = reg_get_predefined_key(h, i, &root);
+ for(i = 0; reg_predefined_keys[i].handle; i++) {
+ error = reg_get_predefined_key(h, reg_predefined_keys[i].handle, &root);
if (!W_ERROR_IS_OK(error)) {
- fprintf(stderr, "Skipping %s\n", reg_get_predef_name(i));
+ fprintf(stderr, "Skipping %s\n", reg_predefined_keys[i].name);
continue;
}
print_tree(0, root, fullpath, no_values);