From 0e95fca747826209edfde79d18b106c69e51cd6b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 15 Dec 2009 20:17:01 +0100 Subject: s3: Add "net registry getvaluesraw" Autobuild-User: Volker Lendecke Autobuild-Date: Tue Nov 2 15:42:22 UTC 2010 on sn-devel-104 --- source3/utils/net_registry.c | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'source3/utils') diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c index 7ea68f1126..163d059ae0 100644 --- a/source3/utils/net_registry.c +++ b/source3/utils/net_registry.c @@ -352,6 +352,49 @@ static int net_registry_getvalueraw(struct net_context *c, int argc, return net_registry_getvalue_internal(c, argc, argv, true); } +static int net_registry_getvaluesraw(struct net_context *c, int argc, + const char **argv) +{ + WERROR werr; + int ret = -1; + struct registry_key *key = NULL; + TALLOC_CTX *ctx = talloc_stackframe(); + uint32_t idx; + + if (argc != 1 || c->display_usage) { + d_fprintf(stderr, "usage: net rpc registry getvaluesraw " + "\n"); + goto done; + } + + werr = open_key(ctx, argv[0], REG_KEY_READ, &key); + if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr)); + goto done; + } + + idx = 0; + while (true) { + struct registry_value *val; + + werr = reg_enumvalue(talloc_tos(), key, idx, NULL, &val); + + if (W_ERROR_EQUAL(werr, WERR_NO_MORE_ITEMS)) { + ret = 0; + break; + } + if (!W_ERROR_IS_OK(werr)) { + break; + } + print_registry_value(val, true); + TALLOC_FREE(val); + idx += 1; + } +done: + TALLOC_FREE(ctx); + return ret; +} + static int net_registry_setvalue(struct net_context *c, int argc, const char **argv) { @@ -1164,6 +1207,14 @@ int net_registry(struct net_context *c, int argc, const char **argv) N_("net registry getvalueraw\n" " Print a registry value (raw format)") }, + { + "getvaluesraw", + net_registry_getvaluesraw, + NET_TRANSPORT_LOCAL, + "Print all values of a key in raw format", + "net registry getvaluesraw \n" + " Print a registry value (raw format)" + }, { "setvalue", net_registry_setvalue, -- cgit