Changeset 118
- Timestamp:
- 08/03/08 19:26:16 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/reglookup-recover.c
-
Property
svn:keywords
set to
Id
r117 r118 15 15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 16 * 17 * $Id :$17 * $Id$ 18 18 */ 19 19 … … 296 296 uint32 max_length; 297 297 298 /* The path_stack size limit should guarantee that we don't recurse forever. */ 298 299 virt_offset = nk->parent_off; 299 300 while(virt_offset != REGF_OFFSET_NONE) 300 301 { 301 /* TODO: Need to add checks for infinite loops and/or add depth limit */302 302 hbin = regfi_lookup_hbin(f, virt_offset); 303 303 if(hbin == NULL) … … 372 372 373 373 374 /*375 void dump_cell(int fd, uint32 offset)376 {377 uint8* buf;378 uint32 length, j;379 int32 cell_length;380 381 if((lseek(fd, offset, SEEK_SET)) == -1)382 exit(8);383 384 length = 4;385 regfi_read(fd, (void*)&cell_length, &length);386 if(cell_length < 0)387 cell_length *= -1;388 389 buf = (uint8*)malloc(cell_length);390 if(buf == NULL)391 exit(9);392 if((lseek(fd, offset, SEEK_SET)) == -1)393 exit(8);394 395 length = cell_length;396 regfi_read(fd, buf, &length);397 for(j=0; j < length; j++)398 {399 printf("%.2X", buf[j]);400 if(j%4 == 3)401 printf(" ");402 }403 printf("\n");404 free(buf);405 }406 */407 408 374 static void usage(void) 409 375 { … … 544 510 off = nk->values_off + REGF_BLOCKSIZE; 545 511 max_length = hbin->block_size + hbin->file_off - off; 546 /* TODO: This is kind of a hack. We parse all value-lists, VK records,547 * 548 * 549 * 550 * 551 * up front somehow.512 /* XXX: This is a hack. We parse all value-lists, VK records, 513 * and data records without regard for current allocation status. 514 * On the off chance that such a record correctly parsed but is 515 * actually a reallocated structure used by something else, we 516 * simply prune it after the fact. Would be faster to check this 517 * up front somehow. 552 518 */ 553 519 nk->values = regfi_load_valuelist(f, off, nk->num_values, max_length, … … 706 672 707 673 674 /* NOTE: unalloc_sks should be an empty range_list. */ 708 675 int extractSKs(REGF_FILE* f, 709 676 range_list* unalloc_cells, … … 729 696 return 20; 730 697 } 731 732 if(removeRange(unalloc_cells, sk->offset, sk->cell_size)) 733 { 734 /* TODO: This ugly hack is needed because unalloc_cells is changing 735 * underneath us when we find things. Need a better approach 736 * so we can parse things single-pass. 737 */ 738 i = 0; 739 break; 740 } 741 else 742 return 30; 698 j+=sk->cell_size-8; 743 699 } 744 700 } 701 } 702 703 for(i=0; i<range_list_size(unalloc_sks); i++) 704 { 705 cur_elem = range_list_get(unalloc_sks, i); 706 if(!removeRange(unalloc_cells, cur_elem->offset, cur_elem->length)) 707 return 30; 745 708 } 746 709 -
Property
svn:keywords
set to
Note: See TracChangeset
for help on using the changeset viewer.