diff options
author | Tim Potter <tpot@samba.org> | 2004-10-03 11:07:04 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:59:36 -0500 |
commit | 263212aba5d05367cc9ff92daf6b1047ea699ac3 (patch) | |
tree | f3b03d482c5ea644b3ba3cea33540e72dc0c5c07 | |
parent | 9880410f1ffb4c7d58f4c4059fb132b98d3520b5 (diff) | |
download | samba-263212aba5d05367cc9ff92daf6b1047ea699ac3.tar.gz samba-263212aba5d05367cc9ff92daf6b1047ea699ac3.tar.bz2 samba-263212aba5d05367cc9ff92daf6b1047ea699ac3.zip |
r2807: OK I think winreg_EnumValue() finally works. The previous version
didn't work with non-NULL registry value names.
Update testsuite to enumerate all keys and values two levels deep.
(This used to be commit c09f0f355ba6a589121588492aa2db5deb7121e0)
-rw-r--r-- | source4/librpc/idl/winreg.idl | 24 | ||||
-rwxr-xr-x | source4/scripting/swig/torture/winreg.py | 60 |
2 files changed, 44 insertions, 40 deletions
diff --git a/source4/librpc/idl/winreg.idl b/source4/librpc/idl/winreg.idl index adc8f7aee1..c06e94b34c 100644 --- a/source4/librpc/idl/winreg.idl +++ b/source4/librpc/idl/winreg.idl @@ -127,23 +127,37 @@ typedef struct { uint32 max_len; uint32 offset; + uint32 len; + } EnumValueIn; + + typedef struct { + uint16 len; + uint16 max_len; + EnumValueIn *buffer; + } EnumValueNameIn; + + typedef struct { + uint32 max_len; + uint32 offset; DATA_BLOB buffer; - } EnumValue; + } EnumValueOut; typedef struct { uint16 len; uint16 max_len; - EnumValue *buffer; - } EnumValueName; + unistr *name; + } EnumValueNameOut; /******************/ /* Function: 0x0a */ WERROR winreg_EnumValue( [in,ref] policy_handle *handle, [in] uint32 enum_index, - [in,out] EnumValueName name, + [in] EnumValueNameIn name_in, + [out] EnumValueNameOut name_out, [in,out] uint32 *type, - [in,out] EnumValue *value, + [in] EnumValueIn *value_in, + [out] EnumValueOut *value_out, [in,out] uint32 *value_len1, [in,out] uint32 *value_len2 ); diff --git a/source4/scripting/swig/torture/winreg.py b/source4/scripting/swig/torture/winreg.py index acf319d6f9..b7a42042a8 100755 --- a/source4/scripting/swig/torture/winreg.py +++ b/source4/scripting/swig/torture/winreg.py @@ -30,12 +30,16 @@ def test_CloseKey(pipe, handle): dcerpc.winreg_CloseKey(pipe, r) -def test_Enum(pipe, handle, depth = 0): +def test_Enum(pipe, handle, name, depth = 0): if depth > 2: return - keyinfo = test_QueryInfoKey(pipe, handle) + try: + keyinfo = test_QueryInfoKey(pipe, handle) + except dcerpc.WERROR, arg: + if arg[0] == dcerpc.WERR_ACCESS_DENIED: + return # Enumerate keys @@ -68,7 +72,8 @@ def test_Enum(pipe, handle, depth = 0): result = dcerpc.winreg_OpenKey(pipe, s) - test_Enum(pipe, result['handle'], depth + 1) + test_Enum(pipe, result['handle'], name + '/' + s['keyname']['name'], + depth + 1) test_CloseKey(pipe, result['handle']) @@ -77,44 +82,30 @@ def test_Enum(pipe, handle, depth = 0): r = {} r['handle'] = handle - keyinfo['max_valnamelen'] = 18 - keyinfo['max_valbufsize'] = 0x31f5 - - r['foo'] = {} - r['foo']['len'] = 0 - r['foo']['max_len'] = keyinfo['max_valnamelen'] * 2 - r['foo']['buffer'] = {} - r['foo']['buffer']['max_len'] = keyinfo['max_valnamelen'] - r['foo']['buffer']['offset'] = 0 - r['foo']['buffer']['len'] = 0 - r['foo']['buffer']['buffer'] = '' + r['name_in'] = {} + r['name_in']['len'] = 0 + r['name_in']['max_len'] = (keyinfo['max_valnamelen'] + 1) * 2 + r['name_in']['buffer'] = {} + r['name_in']['buffer']['max_len'] = keyinfo['max_valnamelen'] + 1 + r['name_in']['buffer']['offset'] = 0 + r['name_in']['buffer']['len'] = 0 r['type'] = 0 - r['value'] = {} - r['value']['max_len'] = keyinfo['max_valbufsize'] - r['value']['offset'] = 0 - r['value']['len'] = 0 - r['value']['buffer'] = [] - r['returned_len'] = 0 - r['foo2'] = {} - r['foo2']['max_len'] = keyinfo['max_valbufsize'] - r['foo2']['offset'] = 0 - r['foo2']['len'] = 0 - r['foo2']['buffer'] = '' - r['value1'] = keyinfo['max_valbufsize'] - r['value2'] = 0 + r['value_in'] = {} + r['value_in']['max_len'] = keyinfo['max_valbufsize'] + r['value_in']['offset'] = 0 + r['value_in']['len'] = 0 + r['value_len1'] = keyinfo['max_valbufsize'] + r['value_len2'] = 0 for i in range(0, keyinfo['num_values']): r['enum_index'] = i - print keyinfo - print dcerpc.winreg_EnumValue(pipe, r) + dcerpc.winreg_EnumValue(pipe, r) - sys.exit(1) +def test_Key(pipe, handle, name): -def test_Key(pipe, handle): - - test_Enum(pipe, handle) + test_Enum(pipe, handle, name) def runtests(binding, domain, username, password): @@ -126,5 +117,4 @@ def runtests(binding, domain, username, password): handle = test_OpenHKLM(pipe) - test_Key(pipe, handle) - + test_Key(pipe, handle, 'HKLM') |