summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2004-10-01 07:37:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:31 -0500
commit76a8fe491e568cb97d5ed54de6cb2882574421c1 (patch)
tree3f9c51e82f5bacfde4f662f98868d6919c2cfb14 /source4
parentb11be587e06705ef68da91e3ff766595d3c62c20 (diff)
downloadsamba-76a8fe491e568cb97d5ed54de6cb2882574421c1.tar.gz
samba-76a8fe491e568cb97d5ed54de6cb2882574421c1.tar.bz2
samba-76a8fe491e568cb97d5ed54de6cb2882574421c1.zip
r2766: Test OpenKey, QueryInfoKey, EnumKey, CloseKey functions.
The IDL for EnumValue is wrong - can't figure it out right now. (This used to be commit 37af942d08da9ba9dcf351853f9064b5d179d5e4)
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/scripting/swig/torture/winreg.py107
1 files changed, 102 insertions, 5 deletions
diff --git a/source4/scripting/swig/torture/winreg.py b/source4/scripting/swig/torture/winreg.py
index 4f3b592065..abc9fa2245 100755
--- a/source4/scripting/swig/torture/winreg.py
+++ b/source4/scripting/swig/torture/winreg.py
@@ -1,16 +1,110 @@
#!/usr/bin/python
-import dcerpc
+import sys, dcerpc
def test_OpenHKLM(pipe):
r = {}
r['unknown'] = {}
- r['unknown']['unknown0'] = 0x84e0
- r['unknown']['unknown1'] = 0
+ r['unknown']['unknown0'] = 0x9038
+ r['unknown']['unknown1'] = 0x0000
r['access_required'] = 0x02000000
- dcerpc.winreg_OpenHKLM(pipe, r)
+ result = dcerpc.winreg_OpenHKLM(pipe, r)
+
+ return result['handle']
+
+def test_QueryInfoKey(pipe, handle):
+
+ r = {}
+ r['handle'] = handle
+ r['class'] = {}
+ r['class']['name'] = None
+
+ return dcerpc.winreg_QueryInfoKey(pipe, r)
+
+def test_CloseKey(pipe, handle):
+
+ r = {}
+ r['handle'] = handle
+
+ dcerpc.winreg_CloseKey(pipe, r)
+
+def test_Enum(pipe, handle, depth = 0):
+
+ if depth > 2:
+ return
+
+ keyinfo = test_QueryInfoKey(pipe, handle)
+
+ # Enumerate keys
+
+ r = {}
+ r['handle'] = handle
+ r['key_name_len'] = 0
+ r['unknown'] = 0x0414
+ r['in_name'] = {}
+ r['in_name']['unknown'] = 0x20a
+ r['in_name']['key_name'] = {}
+ r['in_name']['key_name']['name'] = None
+ r['class'] = {}
+ r['class']['name'] = None
+ r['last_changed_time'] = {}
+ r['last_changed_time']['low'] = 0
+ r['last_changed_time']['high'] = 0
+
+ for i in range(0, keyinfo['num_subkeys']):
+
+ r['enum_index'] = i
+
+ subkey = dcerpc.winreg_EnumKey(pipe, r)
+
+ s = {}
+ s['handle'] = handle
+ s['keyname'] = {}
+ s['keyname']['name'] = subkey['out_name']['name']
+ s['unknown'] = 0
+ s['access_mask'] = 0x02000000
+
+ result = dcerpc.winreg_OpenKey(pipe, s)
+
+ test_Enum(pipe, result['handle'], depth + 1)
+
+ test_CloseKey(pipe, result['handle'])
+
+ # Enumerate values
+
+ return
+
+ r = {}
+ r['handle'] = handle
+ r['name'] = {}
+ r['name']['len'] = 0
+ r['name']['max_len'] = 0
+ r['name']['name'] = {}
+ r['name']['name']['max_len'] = 0
+ r['name']['name']['offset'] = 0
+ r['name']['name']['len'] = 0
+ r['name']['name']['buffer'] = None
+ r['type'] = 0
+ r['value'] = {}
+ r['value']['max_len'] = 0
+ r['value']['offset'] = 0
+ r['value']['len'] = 0
+ r['value']['buffer'] = []
+ r['returned_len'] = 0
+
+ for i in range(0, keyinfo['num_values']):
+
+ r['enum_index'] = i
+
+ print dcerpc.winreg_EnumValue(pipe, r)
+
+ sys.exit(1)
+
+def test_Key(pipe, handle):
+
+ test_Enum(pipe, handle)
def runtests(binding, domain, username, password):
@@ -20,4 +114,7 @@ def runtests(binding, domain, username, password):
dcerpc.DCERPC_WINREG_UUID, dcerpc.DCERPC_WINREG_VERSION,
domain, username, password)
- test_OpenHKLM(pipe)
+ handle = test_OpenHKLM(pipe)
+
+ test_Key(pipe, handle)
+