summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-11-21 21:19:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:00 -0500
commit45fcd0f0b7166d36da2453b0e3bf57d4b02228a7 (patch)
treef748c1c93696523ef57a70b7f10cfe431afa199b
parent334c868b83f84130907dd2c9ed58cfeb6b9bb41c (diff)
downloadsamba-45fcd0f0b7166d36da2453b0e3bf57d4b02228a7.tar.gz
samba-45fcd0f0b7166d36da2453b0e3bf57d4b02228a7.tar.bz2
samba-45fcd0f0b7166d36da2453b0e3bf57d4b02228a7.zip
r19828: Add a helper function to pull *and* unparse local registry values
(This used to be commit 969eb9cda6eba93068472e952e27138b9384c364)
-rw-r--r--source3/registry/reg_frontend.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/source3/registry/reg_frontend.c b/source3/registry/reg_frontend.c
index ed49cc998c..1c8859982d 100644
--- a/source3/registry/reg_frontend.c
+++ b/source3/registry/reg_frontend.c
@@ -263,6 +263,62 @@ int fetch_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val )
return result;
}
+NTSTATUS registry_fetch_values(TALLOC_CTX *mem_ctx, REGISTRY_KEY *key,
+ uint32 *pnum_values, char ***pnames,
+ struct registry_value ***pvalues)
+{
+ REGVAL_CTR *ctr;
+ char **names;
+ struct registry_value **values;
+ uint32 i;
+
+ if (!(ctr = TALLOC_ZERO_P(mem_ctx, REGVAL_CTR))) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ if (fetch_reg_values(key, ctr) == -1) {
+ TALLOC_FREE(ctr);
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ if (ctr->num_values == 0) {
+ *pnum_values = 0;
+ TALLOC_FREE(ctr);
+ return NT_STATUS_OK;
+ }
+
+ if ((!(names = TALLOC_ARRAY(ctr, char *, ctr->num_values))) ||
+ (!(values = TALLOC_ARRAY(ctr, struct registry_value *,
+ ctr->num_values)))) {
+ TALLOC_FREE(ctr);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ for (i=0; i<ctr->num_values; i++) {
+ REGISTRY_VALUE *val = ctr->values[i];
+ NTSTATUS status;
+
+ if (!(names[i] = talloc_strdup(names, val->valuename))) {
+ TALLOC_FREE(ctr);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ status = registry_pull_value(values, &values[i],
+ val->type, val->data_p,
+ val->size, val->size);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(ctr);
+ return status;
+ }
+ }
+
+ *pnum_values = ctr->num_values;
+ *pnames = talloc_move(mem_ctx, &names);
+ *pvalues = talloc_move(mem_ctx, &values);
+
+ TALLOC_FREE(ctr);
+ return NT_STATUS_OK;
+}
/***********************************************************************
retreive a specific subkey specified by index. Caller is