From 49835c6d9e5b838484e6e806b80d8acb7ef2ef5a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 15 May 2008 12:55:54 +0200 Subject: net_registry: add raw output of value to print_registry_value(). Michael (This used to be commit 340a706422cbca45cc63fa94d36c88f6751f4f31) --- source3/utils/net_registry.c | 2 +- source3/utils/net_registry_util.c | 45 +++++++++++++++++++++++++++++---------- source3/utils/net_registry_util.h | 2 +- source3/utils/net_rpc_registry.c | 2 +- 4 files changed, 37 insertions(+), 14 deletions(-) diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c index 89eadb50f9..a06a067ee3 100644 --- a/source3/utils/net_registry.c +++ b/source3/utils/net_registry.c @@ -291,7 +291,7 @@ static int net_registry_getvalue(struct net_context *c, int argc, goto done; } - print_registry_value(value); + print_registry_value(value, false); ret = 0; diff --git a/source3/utils/net_registry_util.c b/source3/utils/net_registry_util.c index ca80e60ec3..278377867a 100644 --- a/source3/utils/net_registry_util.c +++ b/source3/utils/net_registry_util.c @@ -32,32 +32,55 @@ void print_registry_key(const char *keyname, NTTIME *modtime) d_printf("\n"); } -void print_registry_value(const struct registry_value *valvalue) +void print_registry_value(const struct registry_value *valvalue, bool raw) { - d_printf("Type = %s\n", - reg_type_lookup(valvalue->type)); + if (!raw) { + d_printf("Type = %s\n", + reg_type_lookup(valvalue->type)); + } switch(valvalue->type) { case REG_DWORD: - d_printf("Value = %d\n", valvalue->v.dword); + if (!raw) { + d_printf("Value = "); + } + d_printf("%d\n", valvalue->v.dword); break; case REG_SZ: case REG_EXPAND_SZ: - d_printf("Value = \"%s\"\n", valvalue->v.sz.str); + if (!raw) { + d_printf("Value = \""); + } + d_printf("%s", valvalue->v.sz.str); + if (!raw) { + d_printf("\""); + } + d_printf("\n"); break; case REG_MULTI_SZ: { uint32 j; for (j = 0; j < valvalue->v.multi_sz.num_strings; j++) { - d_printf("Value[%3.3d] = \"%s\"\n", j, - valvalue->v.multi_sz.strings[j]); + if (!raw) { + d_printf("Value[%3.3d] = \"", j); + } + d_printf("%s", valvalue->v.multi_sz.strings[j]); + if (!raw) { + d_printf("\""); + } + d_printf("\n"); } break; } case REG_BINARY: - d_printf("Value = %d bytes\n", - (int)valvalue->v.binary.length); + if (!raw) { + d_printf("Value = "); + } + d_printf("%d bytes\n", (int)valvalue->v.binary.length); break; default: - d_printf("Value = \n"); + if (!raw) { + d_printf("Value = "); + } + d_printf("\n"); break; } } @@ -66,7 +89,7 @@ void print_registry_value_with_name(const char *valname, const struct registry_value *valvalue) { d_printf("Valuename = %s\n", valname); - print_registry_value(valvalue); + print_registry_value(valvalue, false); d_printf("\n"); } diff --git a/source3/utils/net_registry_util.h b/source3/utils/net_registry_util.h index 09aaa8394b..61fd834a3c 100644 --- a/source3/utils/net_registry_util.h +++ b/source3/utils/net_registry_util.h @@ -24,7 +24,7 @@ void print_registry_key(const char *keyname, NTTIME *modtime); -void print_registry_value(const struct registry_value *valvalue); +void print_registry_value(const struct registry_value *valvalue, bool raw); void print_registry_value_with_name(const char *valname, const struct registry_value *valvalue); diff --git a/source3/utils/net_rpc_registry.c b/source3/utils/net_rpc_registry.c index 5da19934dc..8832ad96f3 100644 --- a/source3/utils/net_rpc_registry.c +++ b/source3/utils/net_rpc_registry.c @@ -568,7 +568,7 @@ static NTSTATUS rpc_registry_getvalue_internal(struct net_context *c, goto done; } - print_registry_value(value); + print_registry_value(value, false); done: rpccli_winreg_CloseKey(pipe_hnd, tmp_ctx, &key_hnd, NULL); -- cgit