summaryrefslogtreecommitdiff
path: root/source4/scripting/bin/winreg
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-08-23 02:00:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:22 -0500
commit60eb9f87a0a0c96cf67a33516b34ea8cd14dd5e9 (patch)
treed4d5dc2597c3ace70e0b92908dda95fa82675a57 /source4/scripting/bin/winreg
parent2dd966a465a96917ea0986de3fcd50a1e8f4c556 (diff)
downloadsamba-60eb9f87a0a0c96cf67a33516b34ea8cd14dd5e9.tar.gz
samba-60eb9f87a0a0c96cf67a33516b34ea8cd14dd5e9.tar.bz2
samba-60eb9f87a0a0c96cf67a33516b34ea8cd14dd5e9.zip
r9497: - converted the winreg library to a more OO style of interface
- added a reg.typestring() method that returns a string representation of a type (This used to be commit 47cf409cdf501fc3e2b0c65688a9ef1d702278a5)
Diffstat (limited to 'source4/scripting/bin/winreg')
-rwxr-xr-xsource4/scripting/bin/winreg25
1 files changed, 20 insertions, 5 deletions
diff --git a/source4/scripting/bin/winreg b/source4/scripting/bin/winreg
index 7656c8a441..7845f1034c 100755
--- a/source4/scripting/bin/winreg
+++ b/source4/scripting/bin/winreg
@@ -23,8 +23,7 @@ if (options.ARGV.length < 1) {
return -1;
}
var binding = options.ARGV[0];
-reg = winreg_init();
-security_init(reg);
+reg = winregObj();
print("Connecting to " + binding + "\n");
status = reg.connect(binding);
@@ -34,18 +33,34 @@ if (status.is_ok != true) {
}
function list_values(path) {
- var list = winreg_enum_values(reg, path);
+ var list = reg.enum_values(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);
+ var v = list[i];
+ printf("\ttype=%-30s size=%4d '%s'\n", reg.typestring(v.type), v.size, v.name);
+ if (v.type == reg.REG_SZ || v.type == reg.REG_EXPAND_SZ) {
+ printf("\t\t'%s'\n", v.value);
+ }
+ if (v.type == reg.REG_MULTI_SZ) {
+ var j;
+ for (j in v.value) {
+ printf("\t\t'%s'\n", v.value[j]);
+ }
+ }
+ if (v.type == reg.REG_DWORD || v.type == reg.REG_DWORD_BIG_ENDIAN) {
+ printf("\t\t0x%08x (%d)\n", v.value, v.value);
+ }
+ if (v.type == reg.REG_QWORD) {
+ printf("\t\t0x%llx (%lld)\n", v.value, v.value);
+ }
}
}
function list_path(path) {
- var list = winreg_enum_path(reg, path);
+ var list = reg.enum_path(path);
var i;
list_values(path);
for (i=0;i<list.length;i++) {