From 80f75d4138029f9d3548c02513aa2484cd400574 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 18 Aug 2005 05:09:26 +0000 Subject: r9377: made winreg a user tool (I find it quite useful). I expect it to get the ability to add/remove keys and values in the future. add it to the standard tests, ensuring that we know if winreg breaks. This is particularly important as winreg uses such unusual IDL constructs (This used to be commit e4ca36bda34cf5e6fecaef5fe60e5dd397ebee3c) --- source4/scripting/bin/winreg | 75 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 source4/scripting/bin/winreg (limited to 'source4/scripting') diff --git a/source4/scripting/bin/winreg b/source4/scripting/bin/winreg new file mode 100755 index 0000000000..d869d356fd --- /dev/null +++ b/source4/scripting/bin/winreg @@ -0,0 +1,75 @@ +#!/bin/sh +exec smbscript "$0" ${1+"$@"} +/* + tool to manipulate a remote registry + Copyright Andrew Tridgell 2005 + Released under the GNU GPL v2 or later +*/ + +libinclude("base.js"); +libinclude("winreg.js"); + +var options = new Object(); + +ok = GetOptions(ARGV, options, + "POPT_AUTOHELP", + "POPT_COMMON_SAMBA", + "POPT_COMMON_CREDENTIALS"); +if (ok == false) { + println("Failed to parse options: " + options.ERROR); + return -1; +} + +if (options.ARGV.length < 1) { + println("Usage: winreg.js [path]"); + return -1; +} +var binding = options.ARGV[0]; +reg = winreg_init(); +security_init(reg); + +print("Connecting to " + binding + "\n"); +status = reg.connect(binding); +if (status.is_ok != true) { + print("Failed to connect to " + binding + " - " + status.errstr + "\n"); + return -1; +} + +function list_values(path) { + var list = winreg_enum_values(reg, path); + var i; + if (list == undefined) { + return; + } + for (i=0;i 1) { + root = options.ARGV[1]; +} else { + root = ''; +} + +printf("Listing registry tree '%s'\n", root); +list_path(root); +return 0; -- cgit