From: Michael Adam Date: Thu, 15 May 2008 10:55:54 +0000 (+0200) Subject: net_registry: add raw output of value to print_registry_value(). X-Git-Tag: samba-3.3.0pre1~1231 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=340a706422cbca45cc63fa94d36c88f6751f4f31;p=thirdparty%2Fsamba.git net_registry: add raw output of value to print_registry_value(). Michael --- diff --git a/source/utils/net_registry.c b/source/utils/net_registry.c index 89eadb50f97..a06a067ee31 100644 --- a/source/utils/net_registry.c +++ b/source/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/source/utils/net_registry_util.c b/source/utils/net_registry_util.c index ca80e60ec33..278377867aa 100644 --- a/source/utils/net_registry_util.c +++ b/source/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/source/utils/net_registry_util.h b/source/utils/net_registry_util.h index 09aaa8394b4..61fd834a3c5 100644 --- a/source/utils/net_registry_util.h +++ b/source/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/source/utils/net_rpc_registry.c b/source/utils/net_rpc_registry.c index 5da19934dc9..8832ad96f37 100644 --- a/source/utils/net_rpc_registry.c +++ b/source/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);