diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2004-04-11 23:16:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:51:13 -0500 |
commit | 639afabf404d469638bc521b8a7f37e541ccf834 (patch) | |
tree | 1523a34bd54bb1d7ed48fbcb20554c572eb64433 /source4/lib/registry/common | |
parent | c60c5ebb910a77f6f3f345093794637714eb66e2 (diff) | |
download | samba-639afabf404d469638bc521b8a7f37e541ccf834.tar.gz samba-639afabf404d469638bc521b8a7f37e541ccf834.tar.bz2 samba-639afabf404d469638bc521b8a7f37e541ccf834.zip |
r168: - Cleanups in rpc backend
- Small fixess in nt4 and dir backends
- Start on w95 file backend
(This used to be commit aa739e8d3c7108f6f2089af2d8d522feacc7f698)
Diffstat (limited to 'source4/lib/registry/common')
-rw-r--r-- | source4/lib/registry/common/reg_interface.c | 49 | ||||
-rw-r--r-- | source4/lib/registry/common/registry.h | 4 |
2 files changed, 46 insertions, 7 deletions
diff --git a/source4/lib/registry/common/reg_interface.c b/source4/lib/registry/common/reg_interface.c index 5e6b4fbac8..917b03cf32 100644 --- a/source4/lib/registry/common/reg_interface.c +++ b/source4/lib/registry/common/reg_interface.c @@ -214,7 +214,11 @@ WERROR reg_key_num_subkeys(REG_KEY *key, int *count) { if(!key) return WERR_INVALID_PARAM; - if(!key->handle->functions->num_subkeys) { + if(key->handle->functions->num_subkeys) { + return key->handle->functions->num_subkeys(key, count); + } + + if(key->handle->functions->fetch_subkeys) { if(!key->cache_subkeys) key->handle->functions->fetch_subkeys(key, &key->cache_subkeys_count, &key->cache_subkeys); @@ -222,7 +226,20 @@ WERROR reg_key_num_subkeys(REG_KEY *key, int *count) return WERR_OK; } - return key->handle->functions->num_subkeys(key, count); + if(key->handle->functions->get_subkey_by_index) { + int i; + WERROR error; + REG_KEY *dest; + for(i = 0; W_ERROR_IS_OK(error = key->handle->functions->get_subkey_by_index(key, i, &dest)); i++) { + reg_key_free(dest); + } + + *count = i; + if(W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) return WERR_OK; + return error; + } + + return WERR_NOT_SUPPORTED; } WERROR reg_key_num_values(REG_KEY *key, int *count) @@ -306,8 +323,7 @@ WERROR reg_key_get_subkey_by_name(REG_KEY *key, const char *name, REG_KEY **subk WERROR reg_key_get_value_by_name(REG_KEY *key, const char *name, REG_VAL **val) { - int i, max; - REG_VAL *ret = NULL; + int i; WERROR error = WERR_OK; if(!key) return WERR_INVALID_PARAM; @@ -361,7 +377,6 @@ WERROR reg_sync(REG_KEY *h, const char *location) WERROR reg_key_del_recursive(REG_KEY *key) { - BOOL succeed = True; WERROR error = WERR_OK; int i; @@ -543,3 +558,27 @@ WERROR reg_save(REG_HANDLE *h, const char *location) /* FIXME */ return WERR_NOT_SUPPORTED; } + +WERROR reg_key_get_parent(REG_KEY *key, REG_KEY **parent) +{ + char *parent_name; + char *last; + REG_KEY *root; + WERROR error; + + error = reg_get_root(key->handle, &root); + if(!W_ERROR_IS_OK(error)) return error; + + parent_name = strdup(reg_key_get_path(key)); + last = strrchr(parent_name, '\\'); + + if(!last) { + SAFE_FREE(parent_name); + return WERR_FOOBAR; + } + *last = '\0'; + + error = reg_open_key(root, parent_name, parent); + SAFE_FREE(parent_name); + return error; +} diff --git a/source4/lib/registry/common/registry.h b/source4/lib/registry/common/registry.h index 9d7e17cf56..208bcae1e1 100644 --- a/source4/lib/registry/common/registry.h +++ b/source4/lib/registry/common/registry.h @@ -58,8 +58,8 @@ struct reg_val_s { }; /* FIXME */ -typedef void (*key_notification_function) (); -typedef void (*value_notification_function) (); +typedef void (*key_notification_function) (void); +typedef void (*value_notification_function) (void); /* |