Last change
on this file since 197 was
197,
checked in by tim, 14 years ago
|
basic script to test pyregfi functionality
|
-
Property svn:executable set to
*
|
File size:
554 bytes
|
Rev | Line | |
---|
[197] | 1 | #!/usr/bin/env python |
---|
| 2 | |
---|
| 3 | import sys |
---|
| 4 | import pyregfi |
---|
| 5 | |
---|
| 6 | files = sys.argv |
---|
| 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) |
---|
| 30 | iter = r.get_key() |
---|
| 31 | print walk_tree(iter) |
---|
| 32 | |
---|
Note: See
TracBrowser
for help on using the repository browser.