Last change
on this file since 199 was
199,
checked in by tim, 14 years ago
|
reworked part of regfi C API to make python wrappers simpler
continued work on python wrappers
fixed some issues in pyregfi-smoketest. WIP
|
-
Property svn:executable set to
*
|
File size:
664 bytes
|
Rev | Line | |
---|
[197] | 1 | #!/usr/bin/env python |
---|
| 2 | |
---|
| 3 | import sys |
---|
| 4 | import pyregfi |
---|
| 5 | |
---|
[198] | 6 | files = sys.argv[1:] |
---|
[197] | 7 | |
---|
| 8 | |
---|
| 9 | def iter_values(iter): |
---|
| 10 | i = 0 |
---|
| 11 | for value in iter.list_values(): |
---|
| 12 | i += 1 |
---|
[199] | 13 | |
---|
| 14 | return i |
---|
[197] | 15 | |
---|
[199] | 16 | |
---|
[197] | 17 | def walk_tree(iter): |
---|
[199] | 18 | total_keys = 1 |
---|
| 19 | total_values = iter_values(iter) |
---|
| 20 | print "total_values:", total_values |
---|
| 21 | |
---|
| 22 | for sub_key in iter: |
---|
| 23 | print sub_key.keyname |
---|
| 24 | |
---|
| 25 | print iter.down() |
---|
| 26 | num_keys,num_values = walk_tree(iter) |
---|
| 27 | total_keys += num_keys |
---|
[197] | 28 | total_values += num_values |
---|
[199] | 29 | iter.up() |
---|
[197] | 30 | |
---|
| 31 | return (total_keys, total_values) |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | for f in files: |
---|
| 35 | rf = pyregfi.RegistryFile(f) |
---|
[198] | 36 | iter = rf.get_key() |
---|
[197] | 37 | print walk_tree(iter) |
---|
Note: See
TracBrowser
for help on using the repository browser.