- Timestamp:
- 03/25/11 11:48:27 (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/regfi.c
r209 r213 1780 1780 } 1781 1781 ret_val->cur_key = root; 1782 talloc_re ference(ret_val, root);1782 talloc_reparent(NULL, ret_val, root); 1783 1783 1784 1784 ret_val->key_positions = void_stack_new(REGFI_MAX_DEPTH); … … 1834 1834 return false; 1835 1835 } 1836 talloc_re ference(i, subkey);1836 talloc_reparent(NULL, i, subkey); 1837 1837 1838 1838 i->cur_key = subkey; … … 1920 1920 const REGFI_NK* regfi_iterator_cur_key(REGFI_ITERATOR* i) 1921 1921 { 1922 /* XXX: do we need to add a NULL talloc reference here? */1922 talloc_reference(NULL, i->cur_key); 1923 1923 return i->cur_key; 1924 1924 } -
trunk/python/pyregfi/__init__.py
r212 r213 15 15 16 16 17 regfi.regfi_alloc.argtypes = [c_int ]17 regfi.regfi_alloc.argtypes = [c_int, REGFI_ENCODING] 18 18 regfi.regfi_alloc.restype = POINTER(REGFI_FILE) 19 19 20 regfi.regfi_alloc_cb.argtypes = [POINTER(REGFI_RAW_FILE) ]20 regfi.regfi_alloc_cb.argtypes = [POINTER(REGFI_RAW_FILE), REGFI_ENCODING] 21 21 regfi.regfi_alloc_cb.restype = POINTER(REGFI_FILE) 22 22 … … 140 140 s = chars_pointer[i] 141 141 while s != None: 142 ret_val.append(s.decode('utf-8' ))142 ret_val.append(s.decode('utf-8', 'replace')) 143 143 i += 1 144 144 s = chars_pointer[i] … … 150 150 # access to base structures 151 151 class _StructureWrapper(object): 152 153 152 hive = None 154 153 base = None … … 161 160 def __del__(self): 162 161 regfi.regfi_free_record(self.base) 162 hive = None 163 163 164 164 def __getattr__(self, name): … … 205 205 self.length = self.fetch_num(key.base) 206 206 207 def __del__(self): 208 self.key = None 209 207 210 def __len__(self): 208 211 return self.length … … 274 277 ret_val = self.name_raw 275 278 else: 276 ret_val = ret_val.decode('utf-8' )279 ret_val = ret_val.decode('utf-8', 'replace') 277 280 278 281 elif name == "name_raw": … … 307 310 elif data_struct.type in (REG_SZ, REG_EXPAND_SZ, REG_LINK): 308 311 # Unicode strings 309 ret_val = data_struct.interpreted.string.decode('utf-8' )312 ret_val = data_struct.interpreted.string.decode('utf-8', 'replace') 310 313 elif data_struct.type in (REG_DWORD, REG_DWORD_BE): 311 314 # 32 bit integers … … 343 346 ret_val = self.name_raw 344 347 else: 345 ret_val = ret_val.decode('utf-8' )348 ret_val = ret_val.decode('utf-8', 'replace') 346 349 347 350 elif name == "name_raw": … … 370 373 try: 371 374 if hasattr(fh, 'fileno'): 372 self.file = regfi.regfi_alloc(fh.fileno() )375 self.file = regfi.regfi_alloc(fh.fileno(), REGFI_ENCODING_UTF8) 373 376 return 374 377 except: … … 379 382 self.raw_file.seek = seek_cb_type(self.raw_file.cb_seek) 380 383 self.raw_file.read = read_cb_type(self.raw_file.cb_read) 381 self.file = regfi.regfi_alloc_cb(self.raw_file )384 self.file = regfi.regfi_alloc_cb(self.raw_file, REGFI_ENCODING_UTF8) 382 385 383 386 def __getattr__(self, name): … … 387 390 regfi.regfi_free(self.file) 388 391 if self.raw_file != None: 389 regfi.regfi_free(self.file) 390 392 self.raw_file = None 391 393 392 394 def __iter__(self): … … 421 423 422 424 def __init__(self, hive): 423 # REGFI_ENCODING_UTF8==1 424 self.iter = regfi.regfi_iterator_new(hive.file, 1) 425 self.iter = regfi.regfi_iterator_new(hive.file, REGFI_ENCODING_UTF8) 425 426 if self.iter == None: 426 427 raise Exception("Could not create iterator. Current log:\n" … … 432 433 433 434 def __del__(self): 434 regfi.regfi_iterator_free(self.iter) 435 regfi.regfi_iterator_free(self.iter) 435 436 436 437 def __iter__(self): … … 440 441 def __next__(self): 441 442 if self.iteration_root == None: 442 self.iteration_root = self.current_key() 443 self.iteration_root = self.current_key() 443 444 elif not regfi.regfi_iterator_down(self.iter): 444 445 up_ret = regfi.regfi_iterator_up(self.iter) -
trunk/python/pyregfi/structures.py
r209 r213 10 10 # XXX: can we always be sure enums are this size? 11 11 REGFI_ENCODING = c_uint32 12 REGFI_ENCODING_UTF8 = 1 13 12 14 REGFI_DATA_TYPE = c_uint32 13 15 -
trunk/src/reglookup.c
r206 r213 406 406 if(cur != root) 407 407 { 408 regfi_free_record(cur); 408 409 /* We're done with this sub-tree, going up and hitting other branches. */ 409 410 if(!regfi_iterator_up(iter)) … … 429 430 * Let's move down and print this first sub-tree out. 430 431 */ 432 regfi_free_record(cur); 431 433 if(!regfi_iterator_down(iter)) 432 434 { … … 443 445 printMsgs(iter->f); 444 446 } while(!((cur == root) && (sub == NULL))); 447 regfi_free_record(root); 445 448 446 449 if(print_verbose)
Note: See TracChangeset
for help on using the changeset viewer.