Changeset 178 for trunk/src/reglookup-recover.c
- Timestamp:
- 03/13/10 12:56:36 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/reglookup-recover.c
r173 r178 40 40 41 41 42 char* getQuotedData( int fd, uint32_t offset, uint32_t length)42 char* getQuotedData(REGFI_RAW_FILE* file_cb, uint32_t offset, uint32_t length) 43 43 { 44 44 uint8_t* buf; … … 46 46 uint32_t len; 47 47 48 if(( lseek(fd, offset, SEEK_SET)) == -1)48 if((regfi_seek(file_cb, offset, SEEK_SET)) == -1) 49 49 return NULL; 50 50 … … 54 54 55 55 len = length; 56 if((regfi_read(f d, buf, &length) != 0) || length != len)56 if((regfi_read(file_cb, buf, &length) != 0) || length != len) 57 57 { 58 58 free(buf); … … 69 69 void printKey(REGFI_FILE* f, REGFI_NK_REC* nk, const char* prefix) 70 70 { 71 char mtime[20]; 72 time_t tmp_time[1]; 73 struct tm* tmp_time_s = NULL; 71 char mtime[24]; 74 72 char* quoted_name = NULL; 75 73 char* quoted_raw = ""; 76 74 77 *tmp_time = regfi_nt2unix_time(&nk->mtime); 78 tmp_time_s = gmtime(tmp_time); 79 strftime(mtime, sizeof(mtime), "%Y-%m-%d %H:%M:%S", tmp_time_s); 80 75 formatTime(&nk->mtime, mtime); 76 81 77 /* XXX: Add command line option to choose output encoding */ 82 78 regfi_interpret_keyname(f, nk, REGFI_ENCODING_ASCII, true); … … 96 92 97 93 if(print_parsedraw) 98 quoted_raw = getQuotedData(f-> fd, nk->offset, nk->cell_size);94 quoted_raw = getQuotedData(f->cb, nk->offset, nk->cell_size); 99 95 100 96 printf("%.8X,%.8X,KEY,%s,%s,%s,%d,,,,,,,,%s\n", nk->offset, nk->cell_size, … … 162 158 163 159 if(print_parsedraw) 164 quoted_raw = getQuotedData(f-> fd, vk->offset, vk->cell_size);160 quoted_raw = getQuotedData(f->cb, vk->offset, vk->cell_size); 165 161 166 162 str_type = regfi_type_val2str(vk->type); … … 195 191 196 192 if(print_parsedraw) 197 quoted_raw = getQuotedData(f-> fd, sk->offset, sk->cell_size);193 quoted_raw = getQuotedData(f->cb, sk->offset, sk->cell_size); 198 194 199 195 if(owner == NULL) … … 229 225 bool unalloc; 230 226 231 if(!regfi_parse_cell(f-> fd, offset, NULL, 0, &cell_length, &unalloc))227 if(!regfi_parse_cell(f->cb, offset, NULL, 0, &cell_length, &unalloc)) 232 228 return 1; 233 229 234 quoted_buf = getQuotedData(f-> fd, offset, cell_length);230 quoted_buf = getQuotedData(f->cb, offset, cell_length); 235 231 if(quoted_buf == NULL) 236 232 return 2; … … 490 486 max_size = regfi_calc_maxsize(file, offset); 491 487 if(max_size >= 0 492 && regfi_parse_cell(file-> fd, offset, NULL, 0,488 && regfi_parse_cell(file->cb, offset, NULL, 0, 493 489 &cell_length, &unalloc) 494 490 && (cell_length & 0x00000007) == 0 … … 789 785 REGFI_VK_REC* tmp_value; 790 786 uint32_t argi, arge, i, j, ret, num_unalloc_keys; 791 787 int fd; 788 792 789 /* Process command line arguments */ 793 790 if(argc < 2) … … 826 823 bailOut(REGLOOKUP_EXIT_OSERR, "ERROR: Memory allocation problem.\n"); 827 824 828 f = regfi_open(registry_file);829 if(f == NULL)825 fd = openHive(registry_file); 826 if(fd < 0) 830 827 { 831 828 fprintf(stderr, "ERROR: Couldn't open registry file: %s\n", registry_file); 832 829 bailOut(REGLOOKUP_EXIT_NOINPUT, ""); 833 830 } 831 832 f = regfi_alloc(fd); 833 if(f == NULL) 834 { 835 close(fd); 836 bailOut(REGLOOKUP_EXIT_NOINPUT, "ERROR: Failed to create REGFI_FILE structure.\n"); 837 } 838 834 839 if(print_verbose) 835 840 regfi_set_message_mask(f, REGFI_MSG_ERROR|REGFI_MSG_WARN|REGFI_MSG_INFO); … … 991 996 range_list_free(unalloc_sks); 992 997 998 regfi_free(f); 999 close(fd); 1000 993 1001 return 0; 994 1002 }
Note: See TracChangeset
for help on using the changeset viewer.