From ccc8585567804d6a7e6f684a97d58871e2fd9f8a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 18 Nov 1999 00:26:11 +0000 Subject: added regqueryval command (experimental) to get reg_io_q_info() and reg_io_r_info() working properly. previously they weren't well understood (well, they were the first of the registry functions i did, back in december 97, ok??? :-) set ntversion to 0x1 in SAMQUERY, so that we reply same as NT4 srv. (This used to be commit 98ddeaf442cb30972cb281bf0489a6e5f7eb2883) --- source3/rpcclient/cmd_reg.c | 86 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) (limited to 'source3/rpcclient/cmd_reg.c') diff --git a/source3/rpcclient/cmd_reg.c b/source3/rpcclient/cmd_reg.c index 31ef8f082b..316b5f6bc1 100644 --- a/source3/rpcclient/cmd_reg.c +++ b/source3/rpcclient/cmd_reg.c @@ -305,6 +305,92 @@ void cmd_reg_enum(struct client_info *info) } } +/**************************************************************************** +nt registry query value info +****************************************************************************/ +void cmd_reg_query_info(struct client_info *info) +{ + uint16 fnum; + BOOL res = True; + BOOL res1 = True; + + POLICY_HND key_pol; + POLICY_HND pol_con; + fstring full_keyname; + fstring key_name; + fstring keyname; + fstring val_name; + + /* + * query value info + */ + + fstring type; + + type[0] = 0; + DEBUG(5, ("cmd_reg_enum: smb_cli->fd:%d\n", smb_cli->fd)); + + if (!next_token(NULL, full_keyname, NULL, sizeof(full_keyname))) + { + report(out_hnd, "regvalinfo value_name\n"); + return; + } + + reg_get_subkey(full_keyname, keyname, val_name); + + if (keyname[0] == 0 || val_name[0] == 0) + { + report(out_hnd, "invalid value name\n"); + return; + } + + /* open WINREG session. */ + res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False; + + /* open registry receive a policy handle */ + res = res ? do_reg_connect(smb_cli, fnum, keyname, key_name, + &pol_con) : False; + + if ((*key_name) != 0) + { + /* open an entry */ + res1 = res ? do_reg_open_entry(smb_cli, fnum, &pol_con, + key_name, 0x02000000, &key_pol) : False; + } + else + { + memcpy(&key_pol, &pol_con, sizeof(key_pol)); + } + + /* query it */ + res1 = res1 ? do_reg_query_info(smb_cli, fnum, &key_pol, + val_name, type) : False; + + if (res1) + { + report(out_hnd, "type:\t%s\n", type); + } + + /* close the handles */ + if ((*key_name) != 0) + { + res1 = res1 ? do_reg_close(smb_cli, fnum, &key_pol) : False; + } + res = res ? do_reg_close(smb_cli, fnum, &pol_con) : False; + + /* close the session */ + cli_nt_session_close(smb_cli, fnum); + + if (res && res1) + { + DEBUG(5,("cmd_reg_query: query succeeded\n")); + } + else + { + DEBUG(5,("cmd_reg_query: query failed\n")); + } +} + /**************************************************************************** nt registry query key ****************************************************************************/ -- cgit