- Timestamp:
- 06/17/11 20:06:51 (14 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/regfi.h
r262 r263 1483 1483 _EXPORT() 1484 1484 REGFI_NK* regfi_load_key(REGFI_FILE* file, uint32_t offset, 1485 REGFI_ENCODING output_encoding,1486 1485 bool strict); 1487 1486 … … 1495 1494 _EXPORT() 1496 1495 REGFI_VK* regfi_load_value(REGFI_FILE* file, uint32_t offset, 1497 REGFI_ENCODING output_encoding,1498 1496 bool strict); 1499 1497 … … 1558 1556 _EXPORT() 1559 1557 bool regfi_interpret_data(REGFI_FILE* file, 1560 REGFI_ENCODING string_encoding,1561 1558 uint32_t type, REGFI_DATA* data); 1562 1559 … … 1766 1763 1767 1764 _EXPORT() 1768 void regfi_interpret_keyname(REGFI_FILE* file, REGFI_NK* nk, 1769 REGFI_ENCODING output_encoding, bool strict); 1770 _EXPORT() 1771 void regfi_interpret_valuename(REGFI_FILE* file, REGFI_VK* vk, 1772 REGFI_ENCODING output_encoding, bool strict); 1765 void regfi_interpret_keyname(REGFI_FILE* file, REGFI_NK* nk, bool strict); 1766 _EXPORT() 1767 void regfi_interpret_valuename(REGFI_FILE* file, REGFI_VK* vk, bool strict); 1773 1768 1774 1769 _EXPORT() -
trunk/lib/regfi.c
r262 r263 1175 1175 1176 1176 /* XXX: should give this boolean return type to indicate errors */ 1177 void regfi_interpret_valuename(REGFI_FILE* file, REGFI_VK* vk, 1178 REGFI_ENCODING output_encoding, bool strict) 1177 void regfi_interpret_valuename(REGFI_FILE* file, REGFI_VK* vk, bool strict) 1179 1178 { 1180 1179 /* XXX: Registry value names are supposedly limited to 16383 characters … … 1193 1192 return; 1194 1193 1195 if(from_encoding == output_encoding)1194 if(from_encoding == file->string_encoding) 1196 1195 { 1197 1196 vk->name_raw[vk->name_length] = '\0'; … … 1201 1200 { 1202 1201 tmp_buf = regfi_conv_charset(regfi_encoding_int2str(from_encoding), 1203 regfi_encoding_int2str( output_encoding),1202 regfi_encoding_int2str(file->string_encoding), 1204 1203 vk->name_raw, vk->name_length); 1205 1204 if(tmp_buf.buf == NULL) … … 1207 1206 regfi_log_add(REGFI_LOG_WARN, "Error occurred while converting" 1208 1207 " value name to encoding %s. Error message: %s", 1209 regfi_encoding_int2str( output_encoding),1208 regfi_encoding_int2str(file->string_encoding), 1210 1209 strerror(errno)); 1211 1210 vk->name = NULL; … … 1222 1221 /****************************************************************************** 1223 1222 ******************************************************************************/ 1224 REGFI_VK* regfi_load_value(REGFI_FILE* file, uint32_t offset, 1225 REGFI_ENCODING output_encoding, bool strict) 1223 REGFI_VK* regfi_load_value(REGFI_FILE* file, uint32_t offset, bool strict) 1226 1224 { 1227 1225 REGFI_VK* ret_val = NULL; … … 1236 1234 return NULL; 1237 1235 1238 regfi_interpret_valuename(file, ret_val, output_encoding,strict);1236 regfi_interpret_valuename(file, ret_val, strict); 1239 1237 1240 1238 return ret_val; … … 1269 1267 1270 1268 /* XXX: should give this boolean return type to indicate errors */ 1271 void regfi_interpret_keyname(REGFI_FILE* file, REGFI_NK* nk, 1272 REGFI_ENCODING output_encoding, bool strict) 1269 void regfi_interpret_keyname(REGFI_FILE* file, REGFI_NK* nk, bool strict) 1273 1270 { 1274 1271 /* XXX: Registry key names are supposedly limited to 255 characters according to: … … 1286 1283 return; 1287 1284 1288 if(from_encoding == output_encoding)1285 if(from_encoding == file->string_encoding) 1289 1286 { 1290 1287 nk->name_raw[nk->name_length] = '\0'; … … 1294 1291 { 1295 1292 tmp_buf = regfi_conv_charset(regfi_encoding_int2str(from_encoding), 1296 regfi_encoding_int2str( output_encoding),1293 regfi_encoding_int2str(file->string_encoding), 1297 1294 nk->name_raw, nk->name_length); 1298 1295 if(tmp_buf.buf == NULL) … … 1300 1297 regfi_log_add(REGFI_LOG_WARN, "Error occurred while converting" 1301 1298 " key name to encoding %s. Error message: %s", 1302 regfi_encoding_int2str( output_encoding),1299 regfi_encoding_int2str(file->string_encoding), 1303 1300 strerror(errno)); 1304 1301 nk->name = NULL; … … 1316 1313 * 1317 1314 ******************************************************************************/ 1318 REGFI_NK* regfi_load_key(REGFI_FILE* file, uint32_t offset, 1319 REGFI_ENCODING output_encoding, bool strict) 1315 REGFI_NK* regfi_load_key(REGFI_FILE* file, uint32_t offset, bool strict) 1320 1316 { 1321 1317 REGFI_NK* nk; … … 1353 1349 } 1354 1350 1355 regfi_interpret_keyname(file, nk, output_encoding,strict);1351 regfi_interpret_keyname(file, nk, strict); 1356 1352 1357 1353 /* get value list */ … … 1494 1490 /****************************************************************************** 1495 1491 ******************************************************************************/ 1496 REGFI_NK* regfi_find_root_nk(REGFI_FILE* file, const REGFI_HBIN* hbin, 1497 REGFI_ENCODING output_encoding) 1492 REGFI_NK* regfi_find_root_nk(REGFI_FILE* file, const REGFI_HBIN* hbin) 1498 1493 { 1499 1494 REGFI_NK* nk = NULL; … … 1521 1516 if(!unalloc) 1522 1517 { 1523 nk = regfi_load_key(file, cur_offset, output_encoding,true);1518 nk = regfi_load_key(file, cur_offset, true); 1524 1519 if(nk != NULL) 1525 1520 { … … 1738 1733 1739 1734 root_offset = file->root_cell+REGFI_REGF_SIZE; 1740 nk = regfi_load_key(file, root_offset, file->string_encoding,true);1735 nk = regfi_load_key(file, root_offset, true); 1741 1736 if(nk != NULL) 1742 1737 { … … 1760 1755 { 1761 1756 hbin = (REGFI_HBIN*)range_list_get(file->hbins, i)->data; 1762 nk = regfi_find_root_nk(file, hbin , file->string_encoding);1757 nk = regfi_find_root_nk(file, hbin); 1763 1758 } 1764 1759 … … 2042 2037 const REGFI_NK* ret_val = NULL; 2043 2038 2044 ret_val = regfi_load_key(i->f, i->cur->offset, i->f->string_encoding,true);2039 ret_val = regfi_load_key(i->f, i->cur->offset, true); 2045 2040 return ret_val; 2046 2041 } … … 2211 2206 cur != NULL; cur=void_stack_iterator_next(iter)) 2212 2207 { 2213 ret_val[k++] = regfi_load_key(i->f, cur->offset, i->f->string_encoding,true);2214 } 2215 ret_val[k] = regfi_load_key(i->f, i->cur->offset, i->f->string_encoding,true);2208 ret_val[k++] = regfi_load_key(i->f, cur->offset, true); 2209 } 2210 ret_val[k] = regfi_load_key(i->f, i->cur->offset, true); 2216 2211 void_stack_iterator_free(iter); 2217 2212 … … 2324 2319 } 2325 2320 2326 if(!regfi_interpret_data(file, file->string_encoding, 2327 value->type, ret_val)) 2321 if(!regfi_interpret_data(file, value->type, ret_val)) 2328 2322 { 2329 2323 regfi_log_add(REGFI_LOG_INFO, "Error occurred while" … … 2425 2419 { 2426 2420 return regfi_load_key(file, 2427 key->subkeys->elements[index].offset+REGFI_REGF_SIZE, 2428 file->string_encoding,true);2421 key->subkeys->elements[index].offset+REGFI_REGF_SIZE, 2422 true); 2429 2423 } 2430 2424 … … 2442 2436 return regfi_load_value(file, 2443 2437 key->values->elements[index]+REGFI_REGF_SIZE, 2444 file->string_encoding,true);2438 true); 2445 2439 } 2446 2440 … … 2456 2450 if(key != NULL && key->parent_off != REGFI_OFFSET_NONE) 2457 2451 return regfi_load_key(file, 2458 key->parent_off+REGFI_REGF_SIZE, 2459 file->string_encoding, true); 2452 key->parent_off+REGFI_REGF_SIZE, true); 2460 2453 2461 2454 return NULL; … … 2489 2482 /****************************************************************************** 2490 2483 *****************************************************************************/ 2491 bool regfi_interpret_data(REGFI_FILE* file, REGFI_ENCODING string_encoding, 2492 uint32_t type, REGFI_DATA* data) 2484 bool regfi_interpret_data(REGFI_FILE* file, uint32_t type, REGFI_DATA* data) 2493 2485 { 2494 2486 REGFI_BUFFER tmp_buf; … … 2506 2498 case REG_LINK: 2507 2499 tmp_buf = regfi_conv_charset(regfi_encoding_int2str(REGFI_ENCODING_UTF16LE), 2508 regfi_encoding_int2str( string_encoding),2500 regfi_encoding_int2str(file->string_encoding), 2509 2501 data->raw, data->size); 2510 2502 if(tmp_buf.buf == NULL) … … 2513 2505 " converting data of type %d to string encoding %d." 2514 2506 " Error message: %s", 2515 type, string_encoding, strerror(errno));2507 type, file->string_encoding, strerror(errno)); 2516 2508 data->interpreted.string = NULL; 2517 2509 data->interpreted_size = 0; … … 2563 2555 */ 2564 2556 tmp_buf = regfi_conv_charset(regfi_encoding_int2str(REGFI_ENCODING_UTF16LE), 2565 regfi_encoding_int2str( string_encoding),2557 regfi_encoding_int2str(file->string_encoding), 2566 2558 data->raw, data->size); 2567 2559 if(tmp_buf.buf == NULL) … … 2570 2562 " converting data of type %d to string encoding %d." 2571 2563 " Error message: %s", 2572 type, string_encoding, strerror(errno));2564 type, file->string_encoding, strerror(errno)); 2573 2565 data->interpreted.multiple_string = NULL; 2574 2566 data->interpreted_size = 0; -
trunk/src/reglookup-recover.c
r251 r263 76 76 77 77 /* XXX: Add command line option to choose output encoding */ 78 regfi_interpret_keyname(f, nk, REGFI_ENCODING_ASCII,true);78 regfi_interpret_keyname(f, nk, true); 79 79 80 80 quoted_name = get_quoted_keyname(nk); … … 112 112 113 113 /* XXX: Add command line option to choose output encoding */ 114 regfi_interpret_valuename(f, vk, REGFI_ENCODING_ASCII,true);114 regfi_interpret_valuename(f, vk, true); 115 115 116 116 quoted_name = get_quoted_valuename(vk); … … 129 129 /* XXX: Add command line option to choose output encoding */ 130 130 if(vk->data != NULL 131 && !regfi_interpret_data(f, REGFI_ENCODING_ASCII,vk->type, vk->data))131 && !regfi_interpret_data(f, vk->type, vk->data)) 132 132 { 133 133 fprintf(stderr, "WARN: Error occurred while interpreting data for VK record" … … 282 282 { 283 283 /* XXX: Add command line option to choose output encoding */ 284 regfi_interpret_keyname(f, cur_ancestor, REGFI_ENCODING_ASCII,true);284 regfi_interpret_keyname(f, cur_ancestor, true); 285 285 286 286 path_element->buf = (uint8_t*)get_quoted_keyname(cur_ancestor); … … 943 943 { 944 944 /* XXX: Add command line option to choose output encoding */ 945 regfi_interpret_keyname(f, tmp_key, REGFI_ENCODING_ASCII,true);945 regfi_interpret_keyname(f, tmp_key, true); 946 946 947 947 tmp_name = get_quoted_keyname(tmp_key);
Note: See TracChangeset
for help on using the changeset viewer.