- Timestamp:
- 03/07/10 22:04:34 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/regfi.c
r169 r172 978 978 979 979 980 981 /****************************************************************************** 982 ******************************************************************************/ 983 REGFI_VK_REC* regfi_load_value(REGFI_FILE* file, uint32_t offset, 980 void regfi_interpret_valuename(REGFI_FILE* file, REGFI_VK_REC* vk, 984 981 REGFI_ENCODING output_encoding, bool strict) 985 982 { 986 REGFI_VK_REC* ret_val = NULL;987 int32_t max_size, tmp_size;988 REGFI_ENCODING from_encoding;989 990 max_size = regfi_calc_maxsize(file, offset);991 if(max_size < 0)992 return NULL;993 994 ret_val = regfi_parse_vk(file, offset, max_size, strict);995 if(ret_val == NULL)996 return NULL;997 998 983 /* XXX: Registry value names are supposedly limited to 16383 characters 999 984 * according to: … … 1004 989 * when recovering deleted VK records. 1005 990 */ 1006 1007 from_encoding = (ret_val->flags & REGFI_VK_FLAG_ASCIINAME)991 int32_t tmp_size; 992 REGFI_ENCODING from_encoding = (vk->flags & REGFI_VK_FLAG_ASCIINAME) 1008 993 ? REGFI_ENCODING_ASCII : REGFI_ENCODING_UTF16LE; 1009 994 1010 995 if(from_encoding == output_encoding) 1011 996 { 1012 ret_val->valuename_raw = talloc_realloc(ret_val, ret_val->valuename_raw,1013 uint8_t, ret_val->name_length+1);1014 ret_val->valuename_raw[ret_val->name_length] = '\0';1015 ret_val->valuename = (char*)ret_val->valuename_raw;997 vk->valuename_raw = talloc_realloc(vk, vk->valuename_raw, 998 uint8_t, vk->name_length+1); 999 vk->valuename_raw[vk->name_length] = '\0'; 1000 vk->valuename = (char*)vk->valuename_raw; 1016 1001 } 1017 1002 else 1018 1003 { 1019 ret_val->valuename = talloc_array(ret_val, char, ret_val->name_length+1);1020 if( ret_val->valuename == NULL)1021 { 1022 regfi_free_value( ret_val);1023 return NULL;1004 vk->valuename = talloc_array(vk, char, vk->name_length+1); 1005 if(vk->valuename == NULL) 1006 { 1007 regfi_free_value(vk); 1008 return; 1024 1009 } 1025 1010 1026 1011 tmp_size = regfi_conv_charset(regfi_encoding_int2str(from_encoding), 1027 1012 regfi_encoding_int2str(output_encoding), 1028 ret_val->valuename_raw, ret_val->valuename,1029 ret_val->name_length, ret_val->name_length+1);1013 vk->valuename_raw, vk->valuename, 1014 vk->name_length, vk->name_length+1); 1030 1015 if(tmp_size < 0) 1031 1016 { … … 1034 1019 regfi_encoding_int2str(output_encoding), 1035 1020 strerror(-tmp_size)); 1036 talloc_free(ret_val->valuename); 1037 ret_val->valuename = NULL; 1038 } 1039 } 1021 talloc_free(vk->valuename); 1022 vk->valuename = NULL; 1023 } 1024 } 1025 } 1026 1027 1028 /****************************************************************************** 1029 ******************************************************************************/ 1030 REGFI_VK_REC* regfi_load_value(REGFI_FILE* file, uint32_t offset, 1031 REGFI_ENCODING output_encoding, bool strict) 1032 { 1033 REGFI_VK_REC* ret_val = NULL; 1034 int32_t max_size; 1035 1036 max_size = regfi_calc_maxsize(file, offset); 1037 if(max_size < 0) 1038 return NULL; 1039 1040 ret_val = regfi_parse_vk(file, offset, max_size, strict); 1041 if(ret_val == NULL) 1042 return NULL; 1043 1044 regfi_interpret_valuename(file, ret_val, output_encoding, strict); 1040 1045 1041 1046 return ret_val; … … 1069 1074 1070 1075 1071 1072 /****************************************************************************** 1073 * 1074 ******************************************************************************/ 1075 REGFI_NK_REC* regfi_load_key(REGFI_FILE* file, uint32_t offset, 1076 void regfi_interpret_keyname(REGFI_FILE* file, REGFI_NK_REC* nk, 1076 1077 REGFI_ENCODING output_encoding, bool strict) 1077 1078 { 1078 REGFI_NK_REC* nk;1079 uint32_t off;1080 int32_t max_size, tmp_size;1081 REGFI_ENCODING from_encoding;1082 1083 max_size = regfi_calc_maxsize(file, offset);1084 if (max_size < 0)1085 return NULL;1086 1087 /* get the initial nk record */1088 if((nk = regfi_parse_nk(file, offset, max_size, true)) == NULL)1089 {1090 regfi_add_message(file, REGFI_MSG_ERROR, "Could not load NK record at"1091 " offset 0x%.8X.", offset);1092 return NULL;1093 }1094 1095 1079 /* XXX: Registry key names are supposedly limited to 255 characters according to: 1096 1080 * http://msdn.microsoft.com/en-us/library/ms724872%28VS.85%29.aspx … … 1100 1084 * when recovering deleted NK records. 1101 1085 */ 1102 from_encoding = (nk->flags & REGFI_NK_FLAG_ASCIINAME) 1086 int32_t tmp_size; 1087 REGFI_ENCODING from_encoding = (nk->flags & REGFI_NK_FLAG_ASCIINAME) 1103 1088 ? REGFI_ENCODING_ASCII : REGFI_ENCODING_UTF16LE; 1104 1089 1105 1090 if(from_encoding == output_encoding) 1106 1091 { … … 1115 1100 { 1116 1101 regfi_free_key(nk); 1117 return NULL;1102 return; 1118 1103 } 1119 1104 … … 1132 1117 } 1133 1118 } 1134 1119 } 1120 1121 1122 /****************************************************************************** 1123 * 1124 ******************************************************************************/ 1125 REGFI_NK_REC* regfi_load_key(REGFI_FILE* file, uint32_t offset, 1126 REGFI_ENCODING output_encoding, bool strict) 1127 { 1128 REGFI_NK_REC* nk; 1129 uint32_t off; 1130 int32_t max_size; 1131 1132 max_size = regfi_calc_maxsize(file, offset); 1133 if (max_size < 0) 1134 return NULL; 1135 1136 /* get the initial nk record */ 1137 if((nk = regfi_parse_nk(file, offset, max_size, true)) == NULL) 1138 { 1139 regfi_add_message(file, REGFI_MSG_ERROR, "Could not load NK record at" 1140 " offset 0x%.8X.", offset); 1141 return NULL; 1142 } 1143 1144 regfi_interpret_keyname(file, nk, output_encoding, strict); 1135 1145 1136 1146 /* get value list */
Note: See TracChangeset
for help on using the changeset viewer.