- Timestamp:
- 02/08/09 14:53:48 (16 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/common.c
r137 r138 38 38 } 39 39 40 void printMsgs(REGFI_ ITERATOR* iter)41 { 42 char* msgs = regfi_get_messages( iter->f);40 void printMsgs(REGFI_FILE* f) 41 { 42 char* msgs = regfi_get_messages(f); 43 43 if(msgs != NULL) 44 44 { … … 46 46 free(msgs); 47 47 } 48 } 49 50 void clearMsgs(REGFI_FILE* f) 51 { 52 char* msgs = regfi_get_messages(f); 53 if(msgs != NULL) 54 free(msgs); 48 55 } 49 56 -
trunk/src/reglookup-recover.c
r136 r138 2 2 * This program attempts to recover deleted data structures in a registry hive. 3 3 * 4 * Copyright (C) 2008 Timothy D. Morgan4 * Copyright (C) 2008-2009 Timothy D. Morgan 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify … … 87 87 quoted_name[0] = '\0'; 88 88 89 fprintf(stderr, "WARN ING: NULL key name in NK record at offset %.8X.\n",89 fprintf(stderr, "WARN: NULL key name in NK record at offset %.8X.\n", 90 90 nk->offset); 91 91 } … … 125 125 if(size > REGFI_VK_MAX_DATA_LENGTH) 126 126 { 127 fprintf(stderr, "WARN ING: value data size %d larger than "127 fprintf(stderr, "WARN: value data size %d larger than " 128 128 "%d, truncating...\n", size, REGFI_VK_MAX_DATA_LENGTH); 129 129 size = REGFI_VK_MAX_DATA_LENGTH; … … 153 153 154 154 if(conv_error == NULL) 155 fprintf(stderr, "WARN ING: Could not quote value for '%s/%s'. "155 fprintf(stderr, "WARN: Could not quote value for '%s/%s'. " 156 156 "Memory allocation failure likely.\n", prefix, quoted_name); 157 157 else if(print_verbose) 158 fprintf(stderr, "WARN ING: Could not quote value for '%s/%s'. "158 fprintf(stderr, "WARN: Could not quote value for '%s/%s'. " 159 159 "Returned error: %s\n", prefix, quoted_name, conv_error); 160 160 } 161 161 /* XXX: should these always be printed? */ 162 162 else if(conv_error != NULL && print_verbose) 163 fprintf(stderr, " VERBOSE: While quoting value for '%s/%s', "163 fprintf(stderr, "INFO: While quoting value for '%s/%s', " 164 164 "warning returned: %s\n", prefix, quoted_name, conv_error); 165 165 … … 279 279 cur_ancestor = regfi_parse_nk(f, virt_offset+REGFI_REGF_SIZE, 280 280 max_length, true); 281 printMsgs(f); 282 281 283 if(cur_ancestor == NULL) 282 284 virt_offset = REGFI_OFFSET_NONE; … … 426 428 for(i=0; i < range_list_size(unalloc_cells); i++) 427 429 { 430 printMsgs(f); 428 431 cur_elem = range_list_get(unalloc_cells, i); 429 432 for(j=0; cur_elem->length > REGFI_NK_MIN_LENGTH … … 432 435 key = regfi_parse_nk(f, cur_elem->offset+j, 433 436 cur_elem->length-j, false); 437 printMsgs(f); 438 434 439 if(key != NULL) 435 440 { … … 587 592 for(i=0; i < range_list_size(unalloc_cells); i++) 588 593 { 594 printMsgs(f); 589 595 cur_elem = range_list_get(unalloc_cells, i); 590 596 for(j=0; j <= cur_elem->length; j+=8) … … 592 598 vk = regfi_parse_vk(f, cur_elem->offset+j, 593 599 cur_elem->length-j, false); 600 printMsgs(f); 601 594 602 if(vk != NULL) 595 603 { … … 654 662 for(i=0; i < range_list_size(unalloc_cells); i++) 655 663 { 664 printMsgs(f); 656 665 cur_elem = range_list_get(unalloc_cells, i); 657 666 for(j=0; j <= cur_elem->length; j+=8) … … 659 668 sk = regfi_parse_sk(f, cur_elem->offset+j, 660 669 cur_elem->length-j, false); 670 printMsgs(f); 671 661 672 if(sk != NULL) 662 673 { … … 741 752 bailOut(EX_NOINPUT, ""); 742 753 } 754 if(print_verbose) 755 regfi_set_message_mask(f, REGFI_MSG_ERROR|REGFI_MSG_WARN|REGFI_MSG_INFO); 756 else 757 regfi_set_message_mask(f, REGFI_MSG_ERROR); 743 758 744 759 if(print_header) -
trunk/src/reglookup.c
r137 r138 86 86 } 87 87 88 quoted_value = data_to_ascii(vk->data, size, vk->type, &conv_error); 89 if(quoted_value == NULL) 90 { 91 if(conv_error == NULL) 92 fprintf(stderr, "WARN: Could not quote value for '%s/%s'. " 93 "Memory allocation failure likely.\n", prefix, quoted_name); 94 else if(print_verbose) 95 fprintf(stderr, "WARN: Could not quote value for '%s/%s'. " 96 "Returned error: %s\n", prefix, quoted_name, conv_error); 97 } 98 else if(conv_error != NULL && print_verbose) 99 fprintf(stderr, "VERBOSE: While quoting value for '%s/%s', " 100 "warning returned: %s\n", prefix, quoted_name, conv_error); 88 if(vk->data == NULL) 89 { 90 if(print_verbose) 91 fprintf(stderr, "INFO: While quoting value for '%s/%s', " 92 "data pointer was NULL.\n", prefix, quoted_name); 93 } 94 else 95 { 96 quoted_value = data_to_ascii(vk->data, size, vk->type, &conv_error); 97 if(quoted_value == NULL) 98 { 99 if(conv_error == NULL) 100 fprintf(stderr, "WARN: Could not quote value for '%s/%s'. " 101 "Memory allocation failure likely.\n", prefix, quoted_name); 102 else 103 fprintf(stderr, "WARN: Could not quote value for '%s/%s'. " 104 "Returned error: %s\n", prefix, quoted_name, conv_error); 105 } 106 else if(conv_error != NULL && print_verbose) 107 fprintf(stderr, "INFO: While quoting value for '%s/%s', " 108 "warning returned: %s\n", prefix, quoted_name, conv_error); 109 } 101 110 102 111 str_type = regfi_type_val2str(vk->type); … … 275 284 printValue(value, prefix); 276 285 value = regfi_iterator_next_value(iter); 277 printMsgs(iter );286 printMsgs(iter->f); 278 287 } 279 288 } … … 333 342 { 334 343 if(print_verbose) 335 fprintf(stderr, " WARN: While converting classname"344 fprintf(stderr, "INFO: While converting classname" 336 345 " for key '%s': %s.\n", full_path, error_msg); 337 346 free(error_msg); … … 341 350 quoted_classname = empty_str; 342 351 343 printMsgs(iter );352 printMsgs(iter->f); 344 353 printf("%s,KEY,,%s,%s,%s,%s,%s,%s\n", full_path, mtime, 345 354 owner, group, sacl, dacl, quoted_classname); … … 372 381 root = cur = regfi_iterator_cur_key(iter); 373 382 sub = regfi_iterator_first_subkey(iter); 374 printMsgs(iter );383 printMsgs(iter->f); 375 384 376 385 if(root == NULL) … … 400 409 if(!regfi_iterator_up(iter)) 401 410 { 402 printMsgs(iter );411 printMsgs(iter->f); 403 412 bailOut(EX_DATAERR, "ERROR: could not traverse iterator upward.\n"); 404 413 } … … 407 416 if(cur == NULL) 408 417 { 409 printMsgs(iter );418 printMsgs(iter->f); 410 419 bailOut(EX_DATAERR, "ERROR: unexpected NULL for key.\n"); 411 420 } … … 421 430 if(!regfi_iterator_down(iter)) 422 431 { 423 printMsgs(iter );432 printMsgs(iter->f); 424 433 bailOut(EX_DATAERR, "ERROR: could not traverse iterator downward.\n"); 425 434 } … … 429 438 print_this = true; 430 439 } 431 printMsgs(iter );440 printMsgs(iter->f); 432 441 } while(!((cur == root) && (sub == NULL))); 433 442 434 443 if(print_verbose) 435 fprintf(stderr, " VERBOSE: Finished printing key tree.\n");444 fprintf(stderr, "INFO: Finished printing key tree.\n"); 436 445 } 437 446 … … 467 476 468 477 if(print_verbose) 469 fprintf(stderr, " VERBOSE: Attempting to retrieve specified path: %s\n",478 fprintf(stderr, "INFO: Attempting to retrieve specified path: %s\n", 470 479 path_filter); 471 480 … … 474 483 { 475 484 if(print_verbose) 476 fprintf(stderr, " VERBOSE: Found final path element as root key.\n");485 fprintf(stderr, "INFO: Found final path element as root key.\n"); 477 486 free(tmp_path); 478 487 return 2; … … 481 490 if(!regfi_iterator_walk_path(iter, tmp_path)) 482 491 { 483 printMsgs(iter );492 printMsgs(iter->f); 484 493 free(tmp_path); 485 494 return 0; … … 489 498 { 490 499 if(print_verbose) 491 fprintf(stderr, " VERBOSE: Found final path element as value.\n");500 fprintf(stderr, "INFO: Found final path element as value.\n"); 492 501 493 502 value = regfi_iterator_cur_value(iter); 494 printMsgs(iter );503 printMsgs(iter->f); 495 504 tmp_path_joined = iter2Path(iter); 496 505 … … 507 516 else if(regfi_iterator_find_subkey(iter, path[i])) 508 517 { 509 printMsgs(iter );518 printMsgs(iter->f); 510 519 if(print_verbose) 511 fprintf(stderr, " VERBOSE: Found final path element as key.\n");520 fprintf(stderr, "INFO: Found final path element as key.\n"); 512 521 513 522 if(!regfi_iterator_down(iter)) 514 523 { 515 printMsgs(iter );524 printMsgs(iter->f); 516 525 bailOut(EX_DATAERR, "ERROR: Unexpected error on traversing path filter key.\n"); 517 526 } … … 519 528 return 2; 520 529 } 521 printMsgs(iter );530 printMsgs(iter->f); 522 531 523 532 if(print_verbose) 524 fprintf(stderr, " VERBOSE: Could not find last element of path.\n");533 fprintf(stderr, "INFO: Could not find last element of path.\n"); 525 534 526 535 return 0; … … 616 625 } 617 626 627 if(print_verbose) 628 regfi_set_message_mask(f, REGFI_MSG_INFO|REGFI_MSG_WARN|REGFI_MSG_ERROR); 629 618 630 iter = regfi_iterator_new(f); 619 631 if(iter == NULL) … … 634 646 { 635 647 retr_path_ret = retrievePath(iter, path); 636 printMsgs(iter );648 printMsgs(iter->f); 637 649 freePath(path); 638 650
Note: See TracChangeset
for help on using the changeset viewer.