net_registry: add raw output of value to print_registry_value().
authorMichael Adam <obnox@samba.org>
Thu, 15 May 2008 10:55:54 +0000 (12:55 +0200)
committerMichael Adam <obnox@samba.org>
Thu, 15 May 2008 15:17:55 +0000 (17:17 +0200)
Michael
(This used to be commit 340a706422cbca45cc63fa94d36c88f6751f4f31)

source3/utils/net_registry.c
source3/utils/net_registry_util.c
source3/utils/net_registry_util.h
source3/utils/net_rpc_registry.c

index 89eadb50f97a3bf1e152a5b2dcabc923526105a8..a06a067ee31312ebdff9b9c6c90ba0adaaaba866 100644 (file)
@@ -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;
 
index ca80e60ec33a9e04ad952aee076c88077fc12d35..278377867aa8bd58df48ed0beeb0812ba325429f 100644 (file)
@@ -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      = <unprintable>\n");
+               if (!raw) {
+                       d_printf("Value      = ");
+               }
+               d_printf("<unprintable>\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");
 }
 
index 09aaa8394b4c4229496152489a20f37a72a94a82..61fd834a3c59e242749bebfe97d435782815edc6 100644 (file)
@@ -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);
index 5da19934dc9c9799c6ad4710add2bcbcbe0a1628..8832ad96f3737fccd370e54e5c501693b06805e8 100644 (file)
@@ -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);