Changeset 217
- Timestamp:
- 03/30/11 00:13:38 (14 years ago)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
test/pyregfi-smoketest.py
r216 r217 103 103 104 104 105 recurseKey_stat = 0.0 106 recurseValue_stat = 0.0 107 def checkValues(key): 108 global recurseKey_stat 109 global recurseValue_stat 110 recurseKey_stat += (key.mtime.low^key.mtime.high - key.max_bytes_subkeyname) * key.flags 111 for v in key.values: 112 recurseValue_stat += (v.data_off - v.data_size) / (1.0 + v.flags) + v.data_in_offset 113 value = key.values[v.name] 114 if v != value: 115 print("WARNING: iterator value '%s' does not match dictionary value '%s'." 116 % (v.name, value.name)) 117 118 def recurseTree(cur, operation): 119 for k in cur.subkeys: 120 key = cur.subkeys[k.name] 121 if k != key: 122 print("WARNING: iterator subkey '%s' does not match dictionary subkey '%s'." 123 % (k.name, key.name)) 124 del key 125 operation(k) 126 recurseTree(k, operation) 127 128 # Retrieves all keys by recursion, rather than the iterator, and validates 129 # list dictionary access. Also builds nonsensical statistics as an excuse 130 # to access various base structure attributes. 131 def recurseKeyTally(hive): 132 root = hive.get_root() 133 checkValues(root) 134 recurseTree(root, checkValues) 135 print(" Key stat: %f" % recurseKey_stat) 136 print(" Value stat: %f" % recurseValue_stat) 137 105 138 106 139 if len(sys.argv) < 2: … … 109 142 110 143 111 #tests = [("iterTallyNames",iterTallyNames),("iterParentWalk",iterParentWalk), ]112 tests = [(" iterTallyData",iterTallyData),]144 #tests = [("iterTallyNames",iterTallyNames),("iterParentWalk",iterParentWalk),("iterTallyData",iterTallyData),] 145 tests = [("recurseKeyTally",recurseKeyTally),] 113 146 114 147 files = [] -
trunk/python/pyregfi/__init__.py
r216 r217 329 329 330 330 def is_root(self): 331 # This is quicker than retrieving the root key for comparison and 332 # is more trustworthy than trusting the key's flags. 333 return ((self._hive.root_cell+REGFI_REGF_SIZE) == self.offset) 331 return (self._hive.get_root() == self) 334 332 335 333
Note: See TracChangeset
for help on using the changeset viewer.