summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2008-09-15 18:59:17 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-09-21 23:18:00 +0200
commitf25f0dd74489bfea39170a9277afbf96deb8f389 (patch)
tree38a1ed8ad586613ca93ed5b3ddcf5b1cf8fa9b49
parent9b70485207735a8d4c1395963944e5a19a791f53 (diff)
downloadsamba-f25f0dd74489bfea39170a9277afbf96deb8f389.tar.gz
samba-f25f0dd74489bfea39170a9277afbf96deb8f389.tar.bz2
samba-f25f0dd74489bfea39170a9277afbf96deb8f389.zip
Registry client: Implement the "winreg_QueryValue" call
This is needed for the registry patchfile library
-rw-r--r--source4/lib/registry/rpc.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/source4/lib/registry/rpc.c b/source4/lib/registry/rpc.c
index 83c6dc762c..b5918dc4db 100644
--- a/source4/lib/registry/rpc.c
+++ b/source4/lib/registry/rpc.c
@@ -287,6 +287,53 @@ static WERROR rpc_get_value_by_index(TALLOC_CTX *mem_ctx,
return r.out.result;
}
+static WERROR rpc_get_value_by_name(TALLOC_CTX *mem_ctx,
+ const struct registry_key *parent,
+ const char *value_name,
+ uint32_t *type,
+ DATA_BLOB *data)
+{
+ struct rpc_key *mykeydata = talloc_get_type(parent, struct rpc_key);
+ struct winreg_QueryValue r;
+ struct winreg_String name;
+ uint8_t value;
+ uint32_t val_size = MAX_VALSIZE;
+ uint32_t zero = 0;
+ WERROR error;
+ NTSTATUS status;
+
+ if (mykeydata->num_values == -1) {
+ error = rpc_query_key(mem_ctx, parent);
+ if(!W_ERROR_IS_OK(error)) return error;
+ }
+
+ chars_to_winreg_String(mem_ctx, &name, value_name);
+
+ ZERO_STRUCT(r);
+ r.in.handle = &mykeydata->pol;
+ r.in.value_name = name;
+ r.in.type = type;
+ r.in.data = &value;
+ r.in.size = &val_size;
+ r.in.length = &zero;
+ r.out.type = type;
+ r.out.data = &value;
+ r.out.size = &val_size;
+ r.out.length = &zero;
+
+ status = dcerpc_winreg_QueryValue(mykeydata->pipe, mem_ctx, &r);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("QueryValue failed - %s\n", nt_errstr(status)));
+ return ntstatus_to_werror(status);
+ }
+
+ *type = *(r.out.type);
+ *data = data_blob_talloc(mem_ctx, r.out.data, *r.out.length);
+
+ return r.out.result;
+}
+
static WERROR rpc_get_subkey_by_index(TALLOC_CTX *mem_ctx,
const struct registry_key *parent,
uint32_t n,
@@ -471,6 +518,7 @@ static struct registry_operations reg_backend_rpc = {
.get_predefined_key = rpc_get_predefined_key,
.enum_key = rpc_get_subkey_by_index,
.enum_value = rpc_get_value_by_index,
+ .get_value = rpc_get_value_by_name,
.create_key = rpc_add_key,
.delete_key = rpc_del_key,
.get_key_info = rpc_get_info,