diff options
author | Luke Leighton <lkcl@samba.org> | 1998-11-11 00:57:13 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1998-11-11 00:57:13 +0000 |
commit | 58cbefdaafcf8dc9389235928eadd17863130bd4 (patch) | |
tree | 49afa8f35e39cb2500e69141527e7ada479f30dc /source3/rpcclient/cmd_reg.c | |
parent | edf630c85ea6a1d4bfa74427190e27c3a97085ea (diff) | |
download | samba-58cbefdaafcf8dc9389235928eadd17863130bd4.tar.gz samba-58cbefdaafcf8dc9389235928eadd17863130bd4.tar.bz2 samba-58cbefdaafcf8dc9389235928eadd17863130bd4.zip |
registry delete value command: "regdeleteval".
this is just so unbelievably simple to do...
(This used to be commit c05254a15076711d382a58b85b5f08bf81cb1560)
Diffstat (limited to 'source3/rpcclient/cmd_reg.c')
-rw-r--r-- | source3/rpcclient/cmd_reg.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/source3/rpcclient/cmd_reg.c b/source3/rpcclient/cmd_reg.c index 28e511fa03..f36a42699d 100644 --- a/source3/rpcclient/cmd_reg.c +++ b/source3/rpcclient/cmd_reg.c @@ -513,6 +513,71 @@ void cmd_reg_create_val(struct client_info *info) } /**************************************************************************** +nt registry delete value +****************************************************************************/ +void cmd_reg_delete_val(struct client_info *info) +{ + BOOL res = True; + BOOL res3 = True; + BOOL res4 = True; + + POLICY_HND parent_pol; + fstring parent_name; + fstring val_name; + + DEBUG(5, ("cmd_reg_delete_val: smb_cli->fd:%d\n", smb_cli->fd)); + + if (!next_token(NULL, parent_name, NULL, sizeof(parent_name))) + { + fprintf(out_hnd, "regcreate <parent key name> <val_name>\n"); + return; + } + + if (!next_token(NULL, val_name , NULL, sizeof(val_name ))) + { + fprintf(out_hnd, "regcreate <parent key name> <val_name>\n"); + return; + } + + /* open WINREG session. */ + res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False; + + /* open registry receive a policy handle */ + res = res ? do_reg_open_hklm(smb_cli, + 0x84E0, 0x02000000, + &info->dom.reg_pol_connect) : False; + + /* open an entry */ + res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect, + parent_name, 0x02000000, &parent_pol) : False; + + /* create an entry */ + res4 = res3 ? do_reg_delete_val(smb_cli, &parent_pol, val_name) : False; + + /* flush the modified key */ + res4 = res4 ? do_reg_flush_key(smb_cli, &parent_pol) : False; + + /* close the key handle */ + res3 = res3 ? do_reg_close(smb_cli, &parent_pol) : False; + + /* close the registry handles */ + res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False; + + /* close the session */ + cli_nt_session_close(smb_cli); + + if (res && res3 && res4) + { + DEBUG(5,("cmd_reg_delete_val: query succeeded\n")); + fprintf(out_hnd,"OK\n"); + } + else + { + DEBUG(5,("cmd_reg_delete_val: query failed\n")); + } +} + +/**************************************************************************** nt registry delete key ****************************************************************************/ void cmd_reg_delete_key(struct client_info *info) |