summaryrefslogtreecommitdiffstats
path: root/source4/lib/registry/tools
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2008-09-12 17:02:30 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-09-21 23:17:58 +0200
commita2d8ccad734b850a8e368408328c32b4f15e2525 (patch)
tree176a0ff4bb213063458c9d01188b503aa5da0b81 /source4/lib/registry/tools
parent965a12f5b8bb862bab9eb46fba6e95f3906bae7d (diff)
downloadsamba-a2d8ccad734b850a8e368408328c32b4f15e2525.tar.gz
samba-a2d8ccad734b850a8e368408328c32b4f15e2525.tar.xz
samba-a2d8ccad734b850a8e368408328c32b4f15e2525.zip
Registry tool "regshell": Handle the default attribute in the right way
This commit introduces the default attribute in "regshell"
Diffstat (limited to 'source4/lib/registry/tools')
-rw-r--r--source4/lib/registry/tools/regshell.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c
index 98f7f02c38..fb7a08e38f 100644
--- a/source4/lib/registry/tools/regshell.c
+++ b/source4/lib/registry/tools/regshell.c
@@ -207,8 +207,8 @@ static WERROR cmd_ls(struct regshell_context *ctx, int argc, char **argv)
{
int i;
WERROR error;
- uint32_t data_type;
- DATA_BLOB data;
+ uint32_t valuetype;
+ DATA_BLOB valuedata;
const char *name = NULL;
for (i = 0; W_ERROR_IS_OK(error = reg_key_get_subkey_by_index(ctx,
@@ -221,19 +221,21 @@ static WERROR cmd_ls(struct regshell_context *ctx, int argc, char **argv)
}
if (!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) {
- DEBUG(0, ("Error occured while browsing thru keys: %s\n",
- win_errstr(error)));
+ fprintf(stderr, "Error occured while browsing thru keys: %s\n",
+ win_errstr(error));
+ return error;
}
- for (i = 0; W_ERROR_IS_OK(error = reg_key_get_value_by_index(ctx,
- ctx->current,
- i,
- &name,
- &data_type,
- &data)); i++) {
- printf("V \"%s\" %s %s\n", name, str_regtype(data_type),
- reg_val_data_string(ctx, lp_iconv_convenience(cmdline_lp_ctx), data_type, data));
- }
+ /* default value */
+ if (W_ERROR_IS_OK(reg_key_get_value_by_index(ctx, ctx->current, 0,
+ &name, &valuetype, &valuedata)))
+ printf("V \"(Default)\" %s %s\n", str_regtype(valuetype),
+ reg_val_data_string(ctx, lp_iconv_convenience(cmdline_lp_ctx), valuetype, valuedata));
+ /* other values */
+ for (i = 1; W_ERROR_IS_OK(error = reg_key_get_value_by_index(ctx,
+ ctx->current, i, &name, &valuetype, &valuedata)); i++)
+ printf("V \"%s\" %s %s\n", name, str_regtype(valuetype),
+ reg_val_data_string(ctx, lp_iconv_convenience(cmdline_lp_ctx), valuetype, valuedata));
return WERR_OK;
}