From faa4ac2a52cee89be66a11604dd65871b3b70a6b Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Fri, 12 Sep 2008 16:41:49 +0200 Subject: Registry tool "regtree": Handle the default attribute in the right way This commit introduces the default attribute in "regtree" --- source4/lib/registry/tools/regtree.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'source4/lib/registry/tools/regtree.c') diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c index 19e4a010b4..fef9c7ee49 100644 --- a/source4/lib/registry/tools/regtree.c +++ b/source4/lib/registry/tools/regtree.c @@ -40,8 +40,8 @@ static void print_tree(int level, struct registry_key *p, struct registry_key *subkey; const char *valuename; const char *keyname; - uint32_t value_type; - DATA_BLOB value_data; + uint32_t valuetype; + DATA_BLOB valuedata; struct security_descriptor *sec_desc; WERROR error; int i; @@ -73,18 +73,24 @@ static void print_tree(int level, struct registry_key *p, if (!novals) { mem_ctx = talloc_init("print_tree"); - for(i = 0; W_ERROR_IS_OK(error = reg_key_get_value_by_index(mem_ctx, - p, - i, - &valuename, - &value_type, - &value_data)); i++) { + /* default value */ + if (W_ERROR_IS_OK(reg_key_get_value_by_index(mem_ctx, p, 0, + &valuename, &valuetype, &valuedata))) { int j; - char *desc; for(j = 0; j < level+1; j++) putchar(' '); - desc = reg_val_description(mem_ctx, lp_iconv_convenience(cmdline_lp_ctx), valuename, - value_type, value_data); - printf("%s\n", desc); + printf("%s\n", reg_val_description(mem_ctx, + lp_iconv_convenience(cmdline_lp_ctx), + "(Default)", valuetype, valuedata)); + } + /* other values */ + for(i = 1; W_ERROR_IS_OK(error = reg_key_get_value_by_index( + mem_ctx, p, i, &valuename, &valuetype, &valuedata)); + i++) { + int j; + for(j = 0; j < level+1; j++) putchar(' '); + printf("%s\n", reg_val_description(mem_ctx, + lp_iconv_convenience(cmdline_lp_ctx), valuename, + valuetype, valuedata)); } talloc_free(mem_ctx); -- cgit From 965a12f5b8bb862bab9eb46fba6e95f3906bae7d Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Fri, 12 Sep 2008 16:57:22 +0200 Subject: Registry tool "regtree": Removing an error message The error message "Error occurred while fetching values" doesn't seem very useful, so remove it. --- source4/lib/registry/tools/regtree.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'source4/lib/registry/tools/regtree.c') diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c index fef9c7ee49..17a9163adc 100644 --- a/source4/lib/registry/tools/regtree.c +++ b/source4/lib/registry/tools/regtree.c @@ -93,11 +93,6 @@ static void print_tree(int level, struct registry_key *p, valuetype, valuedata)); } talloc_free(mem_ctx); - - if(!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) { - DEBUG(0, ("Error occured while fetching values for '%s': %s\n", - name, win_errstr(error))); - } } mem_ctx = talloc_init("sec_desc"); -- cgit From 92e1574d3ddb0edf3173e18c6e0dfc4974bedcf5 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Sat, 13 Sep 2008 12:26:03 +0200 Subject: Registry tools "regshell" and "regtree": Small fixup's I fixed up my fault regarding the handling of the default value (if it doesn't exist it hasn't the index number zero and you get immediately the subvalues). Then I corrected an error in regshell to find the right registry context. --- source4/lib/registry/tools/regtree.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'source4/lib/registry/tools/regtree.c') diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c index 17a9163adc..2175f9c9d3 100644 --- a/source4/lib/registry/tools/regtree.c +++ b/source4/lib/registry/tools/regtree.c @@ -38,8 +38,7 @@ static void print_tree(int level, struct registry_key *p, bool fullpath, bool novals) { struct registry_key *subkey; - const char *valuename; - const char *keyname; + const char *valuename, *keyname; uint32_t valuetype; DATA_BLOB valuedata; struct security_descriptor *sec_desc; @@ -73,17 +72,7 @@ static void print_tree(int level, struct registry_key *p, if (!novals) { mem_ctx = talloc_init("print_tree"); - /* default value */ - if (W_ERROR_IS_OK(reg_key_get_value_by_index(mem_ctx, p, 0, - &valuename, &valuetype, &valuedata))) { - int j; - for(j = 0; j < level+1; j++) putchar(' '); - printf("%s\n", reg_val_description(mem_ctx, - lp_iconv_convenience(cmdline_lp_ctx), - "(Default)", valuetype, valuedata)); - } - /* other values */ - for(i = 1; W_ERROR_IS_OK(error = reg_key_get_value_by_index( + for(i = 0; W_ERROR_IS_OK(error = reg_key_get_value_by_index( mem_ctx, p, i, &valuename, &valuetype, &valuedata)); i++) { int j; -- cgit From 5c3e76eddd89d9af18bf2a00e7ee6021ab90b234 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Fri, 19 Sep 2008 12:57:26 +0200 Subject: Revert "Registry tool "regtree": Removing an error message" This reverts commit f37a57fa366e2b0d77f9c1bd232d42a0f2cceb52. --- source4/lib/registry/tools/regtree.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source4/lib/registry/tools/regtree.c') diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c index 2175f9c9d3..6d55a3eb84 100644 --- a/source4/lib/registry/tools/regtree.c +++ b/source4/lib/registry/tools/regtree.c @@ -82,6 +82,11 @@ static void print_tree(int level, struct registry_key *p, valuetype, valuedata)); } talloc_free(mem_ctx); + + if(!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) { + DEBUG(0, ("Error occured while fetching values for '%s': %s\n", + name, win_errstr(error))); + } } mem_ctx = talloc_init("sec_desc"); -- cgit