mirror of
https://github.com/samba-team/samba.git
synced 2025-10-24 15:33:20 +03:00
a good idea to use grep -r to find places that need fixing when you change the syntax of a call :-)
74 lines
1.4 KiB
Plaintext
Executable File
74 lines
1.4 KiB
Plaintext
Executable File
#!/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 = GetOptions(ARGV,
|
|
"POPT_AUTOHELP",
|
|
"POPT_COMMON_SAMBA",
|
|
"POPT_COMMON_CREDENTIALS");
|
|
if (options == undefined) {
|
|
println("Failed to parse options");
|
|
return -1;
|
|
}
|
|
|
|
if (options.ARGV.length < 1) {
|
|
println("Usage: winreg.js <BINDING> [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<list.length;i++) {
|
|
printf("\ttype=%2d size=%4d '%s'\n", list[i].type, list[i].size, list[i].name);
|
|
}
|
|
}
|
|
|
|
function list_path(path) {
|
|
var list = winreg_enum_path(reg, path);
|
|
var i;
|
|
list_values(path);
|
|
for (i=0;i<list.length;i++) {
|
|
var npath;
|
|
if (path) {
|
|
npath = path + "\\" + list[i];
|
|
} else {
|
|
npath = list[i];
|
|
}
|
|
println(npath);
|
|
list_path(npath);
|
|
}
|
|
}
|
|
|
|
var root;
|
|
|
|
if (options.ARGV.length > 1) {
|
|
root = options.ARGV[1];
|
|
} else {
|
|
root = '';
|
|
}
|
|
|
|
printf("Listing registry tree '%s'\n", root);
|
|
list_path(root);
|
|
return 0;
|