Last change
on this file since 198 was
198,
checked in by tim, 14 years ago
|
misc tweaks to run under python2.5-dbg
|
-
Property svn:executable set to
*
|
File size:
559 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 |
---|
| 13 | |
---|
| 14 | def walk_tree(iter): |
---|
| 15 | total_keys = 0 |
---|
| 16 | total_values = 0 |
---|
| 17 | |
---|
| 18 | for sub_key in iter: |
---|
| 19 | num_keys,num_values = walk_tree(sub_key) |
---|
| 20 | total_keys += num_keys + 1 |
---|
| 21 | total_values += num_values |
---|
| 22 | |
---|
| 23 | num_values += iter_values(iter) |
---|
| 24 | |
---|
| 25 | return (total_keys, total_values) |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | for f in files: |
---|
| 29 | rf = pyregfi.RegistryFile(f) |
---|
[198] | 30 | iter = rf.get_key() |
---|
[197] | 31 | print walk_tree(iter) |
---|
| 32 | |
---|
Note: See
TracBrowser
for help on using the repository browser.