Changeset 159 for trunk/src/reglookup.c
- Timestamp:
- 12/06/09 15:09:01 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/reglookup.c
r158 r159 50 50 51 51 52 void printValue(const REGFI_VK_REC* vk, char* prefix) 53 { 52 void printValue(REGFI_ITERATOR* iter, const REGFI_VK_REC* vk, char* prefix) 53 { 54 REGFI_DATA* data; 54 55 char* quoted_value = NULL; 55 56 char* quoted_name = NULL; 56 57 char* conv_error = NULL; 57 58 const char* str_type = NULL; 58 uint32 size = vk->data_size; 59 60 /* Microsoft's documentation indicates that "available memory" is 61 * the limit on value sizes. Annoying. We limit it to 1M which 62 * should rarely be exceeded, unless the file is corrupt or 63 * malicious. For more info, see: 64 * http://msdn2.microsoft.com/en-us/library/ms724872.aspx 65 */ 66 if(size > REGFI_VK_MAX_DATA_LENGTH) 67 { 68 fprintf(stderr, "WARN: value data size %d larger than " 69 "%d, truncating...\n", size, REGFI_VK_MAX_DATA_LENGTH); 70 size = REGFI_VK_MAX_DATA_LENGTH; 71 } 72 59 73 60 quoted_name = quote_string(vk->valuename, key_special_chars); 74 61 if (quoted_name == NULL) … … 84 71 quoted_name[0] = '\0'; 85 72 } 86 87 if(vk->data == NULL) 88 { 89 if(print_verbose) 90 fprintf(stderr, "INFO: While quoting value for '%s/%s', " 91 "data pointer was NULL.\n", prefix, quoted_name); 92 } 93 else 94 { 95 quoted_value = data_to_ascii(vk->data, size, vk->type, &conv_error); 73 74 data = regfi_iterator_fetch_data(iter, vk); 75 76 printMsgs(iter->f); 77 if(data != NULL) 78 { 79 quoted_value = data_to_ascii(data, &conv_error); 96 80 if(quoted_value == NULL) 97 81 { … … 103 87 "Returned error: %s\n", prefix, quoted_name, conv_error); 104 88 } 105 else if(conv_error != NULL && print_verbose)106 fprintf(stderr, " INFO: While quoting value for '%s/%s', "89 else if(conv_error != NULL) 90 fprintf(stderr, "WARN: While quoting value for '%s/%s', " 107 91 "warning returned: %s\n", prefix, quoted_name, conv_error); 92 regfi_free_data(data); 108 93 } 109 94 … … 281 266 { 282 267 if(!type_filter_enabled || (value->type == type_filter)) 283 printValue( value, prefix);268 printValue(iter, value, prefix); 284 269 regfi_free_value(value); 285 270 value = regfi_iterator_next_value(iter); … … 511 496 512 497 if(!type_filter_enabled || (value->type == type_filter)) 513 printValue( value, tmp_path_joined);498 printValue(iter, value, tmp_path_joined); 514 499 515 500 regfi_free_value(value); … … 632 617 regfi_set_message_mask(f, REGFI_MSG_INFO|REGFI_MSG_WARN|REGFI_MSG_ERROR); 633 618 634 iter = regfi_iterator_new(f); 619 /* XXX: add command line option to choose output encoding */ 620 iter = regfi_iterator_new(f, 0); 635 621 if(iter == NULL) 636 622 {
Note: See TracChangeset
for help on using the changeset viewer.