Changeset 216
- Timestamp:
- 03/28/11 23:54:37 (14 years ago)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
test/pyregfi-smoketest.py
r215 r216 31 31 # Gathers various (meaningless) statistics to exercise simple attribute access 32 32 # and to hopefully smoke out any bugs that can be identified by changing stats 33 def iterTally (hive):33 def iterTallyNames(hive): 34 34 key_count = 0 35 35 key_lens = 0 … … 77 77 78 78 79 # Uses the HiveIterator to walk all keys 80 # Gathers various (meaningless) statistics about data/data_raw attributes 81 def iterTallyData(hive): 82 data_stat = 0.0 83 dataraw_stat = 0.0 84 85 for k in hive: 86 for v in k.values: 87 d = v.data 88 if d == None: 89 data_stat += 0.1 90 elif hasattr(d, "__len__"): 91 data_stat += len(d) 92 else: 93 data_stat += d/2.0**64 94 95 d = v.data_raw 96 if d == None: 97 dataraw_stat += 0.1 98 else: 99 dataraw_stat += len(d) 100 101 print(" Data stat: %f" % data_stat) 102 print(" Raw data stat: %f" % dataraw_stat) 103 104 105 79 106 if len(sys.argv) < 2: 80 107 usage() … … 82 109 83 110 84 tests = [("iterTally",iterTally),("iterParentWalk",iterParentWalk),] 111 #tests = [("iterTallyNames",iterTallyNames),("iterParentWalk",iterParentWalk),] 112 tests = [("iterTallyData",iterTallyData),] 85 113 86 114 files = [] -
trunk/python/pyregfi/__init__.py
r215 r216 249 249 name = create_string_buffer(bytes(name)) 250 250 251 if self._find_element(self._hive.file, self._key. base, name, byref(index)):251 if self._find_element(self._hive.file, self._key._base, name, byref(index)): 252 252 return self._constructor(self._hive, 253 253 self._get_element(self._hive.file, 254 self._key. base,254 self._key._base, 255 255 index)) 256 256 raise KeyError('') … … 343 343 ret_val = None 344 344 if name == "data": 345 data_p = regfi.regfi_fetch_data(self._hive.file, self. base)345 data_p = regfi.regfi_fetch_data(self._hive.file, self._base) 346 346 try: 347 347 data_struct = data_p.contents … … 373 373 elif name == "data_raw": 374 374 # XXX: should we load the data without interpretation instead? 375 data_p = regfi.regfi_fetch_data(self._hive.file, self. base)375 data_p = regfi.regfi_fetch_data(self._hive.file, self._base) 376 376 try: 377 377 data_struct = data_p.contents … … 381 381 ret_val = _buffer2bytearray(data_struct.raw, 382 382 data_struct.size) 383 regfi.regfi_free_record(data_p) 383 regfi.regfi_free_record(data_p) 384 384 385 385 else:
Note: See TracChangeset
for help on using the changeset viewer.