summaryrefslogtreecommitdiff
path: root/testprogs/ejs
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-08-08 22:29:44 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:31:32 -0500
commit924b3cc953182c4f72d6356b7209c4ccb5647fb1 (patch)
treed7b1987da6abe5f75e9973ef342c5a3c4489499a /testprogs/ejs
parenteda59a6ca0e9eae395fef339ca809d133f92902c (diff)
downloadsamba-924b3cc953182c4f72d6356b7209c4ccb5647fb1.tar.gz
samba-924b3cc953182c4f72d6356b7209c4ccb5647fb1.tar.bz2
samba-924b3cc953182c4f72d6356b7209c4ccb5647fb1.zip
r9218: make the winreg library code handle arbitrary paths more efficiently
and more conveniently (caller doesn't need to know the hive names now) (This used to be commit dadd7e22fb439f7b18c429a95c75902e4741ba8d)
Diffstat (limited to 'testprogs/ejs')
-rwxr-xr-xtestprogs/ejs/winreg.js33
1 files changed, 20 insertions, 13 deletions
diff --git a/testprogs/ejs/winreg.js b/testprogs/ejs/winreg.js
index 831528b05c..22b20739f2 100755
--- a/testprogs/ejs/winreg.js
+++ b/testprogs/ejs/winreg.js
@@ -13,15 +13,15 @@ ok = GetOptions(ARGV, options,
"POPT_COMMON_SAMBA",
"POPT_COMMON_CREDENTIALS");
if (ok == false) {
- println("Failed to parse options: " + options.ERROR);
- return -1;
+ println("Failed to parse options: " + options.ERROR);
+ return -1;
}
libinclude("base.js");
-if (options.ARGV.length != 1) {
- println("Usage: winreg.js <BINDING>");
- return -1;
+if (options.ARGV.length < 1) {
+ println("Usage: winreg.js <BINDING>");
+ return -1;
}
var binding = options.ARGV[0];
reg = winreg_init();
@@ -30,8 +30,8 @@ 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;
+ print("Failed to connect to " + binding + " - " + status.errstr + "\n");
+ return -1;
}
function list_path(path) {
@@ -41,18 +41,25 @@ function list_path(path) {
return;
}
for (i=0;i<list.length;i++) {
- var npath = path + "\\" + list[i];
+ var npath;
+ if (path) {
+ npath = path + "\\" + list[i];
+ } else {
+ npath = list[i];
+ }
println(npath);
list_path(npath);
}
}
-var trees = new Array("HKCR", "HKLM", "HKPD", "HKU");
+var root;
-for (i=0;i<trees.length;i++) {
- printf("Listing tree '%s'\n", trees[i]);
- list_path(trees[i]);
+if (options.ARGV.length > 1) {
+ root = options.ARGV[1];
+} else {
+ root = '';
}
-print("All OK\n");
+printf("Listing registry tree '%s'\n", root);
+list_path(root);
return 0;