53 if (!resource_dir_paddr) {
58 if (!
bin->resources) {
61 if (!(
bin->resource_directory =
malloc(
sizeof(*
bin->resource_directory)))) {
70 bin->resource_directory_offset = resource_dir_paddr;
109 for (; childrenST < stringTable->
numOfChildren; childrenST++) {
119 if (stringFileInfo) {
122 ut32 childrenSFI = 0;
123 for (; childrenSFI < stringFileInfo->
numOfChildren; childrenSFI++) {
128 free(stringFileInfo);
132 #define align32(x) x = (((x)&0x3) == 0) ? (x) : ((x) & ~0x3) + 0x4;
135 if (vs_VersionInfo) {
140 free(vs_VersionInfo);
159 *curAddr +=
sizeof(var->
wLength);
171 *curAddr +=
sizeof(var->
wType);
229 *curAddr +=
sizeof(varFileInfo->
wLength);
249 *curAddr +=
sizeof(varFileInfo->
wType);
250 if (varFileInfo->
wType && varFileInfo->
wType != 1) {
257 if (!varFileInfo->
szKey) {
276 while (startAddr + varFileInfo->
wLength > *curAddr) {
304 if (begAddr >
bin->size || begAddr +
sizeof(string->
wLength) >
bin->size) {
312 *curAddr +=
sizeof(
string->wLength);
320 *curAddr +=
sizeof(
string->wValueLength);
322 if (*curAddr >
bin->size || *curAddr +
sizeof(string->
wType) >
bin->size) {
329 *curAddr +=
sizeof(
string->wType);
330 if (string->
wType != 0 && string->
wType != 1) {
335 for (
i = 0; *curAddr < begAddr +
string->wLength;
i++, *curAddr +=
sizeof(
ut16)) {
338 if (*curAddr >
bin->size || *curAddr +
sizeof(
ut16) >
bin->size) {
350 string->szKey = tmpKey;
351 string->szKey[
i] = utf16_char;
352 string->wKeyLen +=
sizeof(
ut16);
354 *curAddr +=
sizeof(
ut16);
360 string->wValueLength = len_value;
364 string->Value = (
ut16 *)
calloc(len_value + 1, 1);
365 if (!string->
Value) {
369 if (*curAddr >
bin->size || *curAddr + len_value >
bin->size) {
376 *curAddr += len_value;
396 *curAddr +=
sizeof(stringTable->
wLength);
416 *curAddr +=
sizeof(stringTable->
wType);
417 if (stringTable->
wType && stringTable->
wType != 1) {
423 if (!stringTable->
szKey) {
436 while (startAddr + stringTable->
wLength > *curAddr) {
454 RZ_LOG_INFO(
"check (StringTable numOfChildren)\n");
464 if (!stringFileInfo) {
476 *curAddr +=
sizeof(stringFileInfo->
wLength);
479 RZ_LOG_INFO(
"read (StringFileInfo wValueLength)\n");
486 RZ_LOG_INFO(
"check (StringFileInfo wValueLength)\n");
496 *curAddr +=
sizeof(stringFileInfo->
wType);
498 if (stringFileInfo->
wType && stringFileInfo->
wType != 1) {
505 if (!stringFileInfo->
szKey) {
526 while (startAddr + stringFileInfo->
wLength > *curAddr) {
529 RZ_LOG_INFO(
"realloc (StringFileInfo Children)\n");
544 RZ_LOG_INFO(
"check (StringFileInfo numOfChildren)\n");
549 return stringFileInfo;
552 #define EXIT_ON_OVERFLOW(S) \
553 if (curAddr > bin->size || curAddr + (S) > bin->size) { \
559 if (!vs_VersionInfo) {
562 PE_DWord startAddr = version_info_paddr;
563 PE_DWord curAddr = version_info_paddr;
578 RZ_LOG_INFO(
"read (VS_VERSIONINFO wValueLength)\n");
588 if (vs_VersionInfo->
wType && vs_VersionInfo->
wType != 1) {
594 if (!vs_VersionInfo->
szKey) {
611 RZ_LOG_INFO(
"check (VS_VERSIONINFO wValueLength != sizeof PE_VS_FIXEDFILEINFO)\n");
646 if (startAddr + vs_VersionInfo->
wLength > curAddr) {
648 if (curAddr + 3 *
sizeof(
ut16) >
bin->size || curAddr + 3 +
sizeof(
ut64) + 1 >
bin->size) {
652 RZ_LOG_INFO(
"read (VS_VERSIONINFO Children V or S)\n");
655 if (!(t ==
'S' || t ==
'V')) {
656 RZ_LOG_INFO(
"bad type (VS_VERSIONINFO Children)\n");
661 RZ_LOG_INFO(
"bad parsing (VS_VERSIONINFO StringFileInfo)\n");
667 RZ_LOG_INFO(
"bad parsing (VS_VERSIONINFO VarFileInfo)\n");
674 if (startAddr + vs_VersionInfo->
wLength > curAddr) {
677 RZ_LOG_INFO(
"bad parsing (VS_VERSIONINFO StringFileInfo)\n");
680 }
else if (t ==
'S') {
682 RZ_LOG_INFO(
"bad parsing (VS_VERSIONINFO VarFileInfo)\n");
686 if (startAddr + vs_VersionInfo->
wLength > curAddr) {
687 RZ_LOG_INFO(
"bad parsing (VS_VERSIONINFO wLength left)\n");
692 return vs_VersionInfo;
733 char *encodedVal =
NULL, *encodedKey =
NULL;
752 sdb_set(sdb,
"key", encodedKey, 0);
753 sdb_set(sdb,
"value", encodedVal, 0);
761 char *encodedKey =
NULL;
776 sdb_set(sdb,
"key", encodedKey, 0);
789 if (!stringFileInfo) {
805 if (!vs_fixedFileInfo) {
830 if (!vs_VersionInfo) {
837 if (vs_VersionInfo->
Value) {
851 case 0:
return "Unknown";
852 case 1:
return "Import0";
853 case 2:
return "Linker510";
854 case 3:
return "Cvtomf510";
855 case 4:
return "Linker600";
856 case 5:
return "Cvtomf600";
857 case 6:
return "Cvtres500";
858 case 7:
return "Utc11_Basic";
859 case 8:
return "Utc11_C";
860 case 9:
return "Utc12_Basic";
861 case 10:
return "Utc12_C";
862 case 11:
return "Utc12_CPP";
863 case 12:
return "AliasObj60";
864 case 13:
return "VisualBasic60";
865 case 14:
return "Masm613";
866 case 15:
return "Masm710";
867 case 16:
return "Linker511";
868 case 17:
return "Cvtomf511";
869 case 18:
return "Masm614";
870 case 19:
return "Linker512";
871 case 20:
return "Cvtomf512";
872 case 21:
return "Utc12_C_Std";
873 case 22:
return "Utc12_CPP_Std";
874 case 23:
return "Utc12_C_Book";
875 case 24:
return "Utc12_CPP_Book";
876 case 25:
return "Implib700";
877 case 26:
return "Cvtomf700";
878 case 27:
return "Utc13_Basic";
879 case 28:
return "Utc13_C";
880 case 29:
return "Utc13_CPP";
881 case 30:
return "Linker610";
882 case 31:
return "Cvtomf610";
883 case 32:
return "Linker601";
884 case 33:
return "Cvtomf601";
885 case 34:
return "Utc12_1_Basic";
886 case 35:
return "Utc12_1_C";
887 case 36:
return "Utc12_1_CPP";
888 case 37:
return "Linker620";
889 case 38:
return "Cvtomf620";
890 case 39:
return "AliasObj70";
891 case 40:
return "Linker621";
892 case 41:
return "Cvtomf621";
893 case 42:
return "Masm615";
894 case 43:
return "Utc13_LTCG_C";
895 case 44:
return "Utc13_LTCG_CPP";
896 case 45:
return "Masm620";
897 case 46:
return "ILAsm100";
898 case 47:
return "Utc12_2_Basic";
899 case 48:
return "Utc12_2_C";
900 case 49:
return "Utc12_2_CPP";
901 case 50:
return "Utc12_2_C_Std";
902 case 51:
return "Utc12_2_CPP_Std";
903 case 52:
return "Utc12_2_C_Book";
904 case 53:
return "Utc12_2_CPP_Book";
905 case 54:
return "Implib622";
906 case 55:
return "Cvtomf622";
907 case 56:
return "Cvtres501";
908 case 57:
return "Utc13_C_Std";
909 case 58:
return "Utc13_CPP_Std";
910 case 59:
return "Cvtpgd1300";
911 case 60:
return "Linker622";
912 case 61:
return "Linker700";
913 case 62:
return "Export622";
914 case 63:
return "Export700";
915 case 64:
return "Masm700";
916 case 65:
return "Utc13_POGO_I_C";
917 case 66:
return "Utc13_POGO_I_CPP";
918 case 67:
return "Utc13_POGO_O_C";
919 case 68:
return "Utc13_POGO_O_CPP";
920 case 69:
return "Cvtres700";
921 case 70:
return "Cvtres710p";
922 case 71:
return "Linker710p";
923 case 72:
return "Cvtomf710p";
924 case 73:
return "Export710p";
925 case 74:
return "Implib710p";
926 case 75:
return "Masm710p";
927 case 76:
return "Utc1310p_C";
928 case 77:
return "Utc1310p_CPP";
929 case 78:
return "Utc1310p_C_Std";
930 case 79:
return "Utc1310p_CPP_Std";
931 case 80:
return "Utc1310p_LTCG_C";
932 case 81:
return "Utc1310p_LTCG_CPP";
933 case 82:
return "Utc1310p_POGO_I_C";
934 case 83:
return "Utc1310p_POGO_I_CPP";
935 case 84:
return "Utc1310p_POGO_O_C";
936 case 85:
return "Utc1310p_POGO_O_CPP";
937 case 86:
return "Linker624";
938 case 87:
return "Cvtomf624";
939 case 88:
return "Export624";
940 case 89:
return "Implib624";
941 case 90:
return "Linker710";
942 case 91:
return "Cvtomf710";
943 case 92:
return "Export710";
944 case 93:
return "Implib710";
945 case 94:
return "Cvtres710";
946 case 95:
return "Utc1310_C";
947 case 96:
return "Utc1310_CPP";
948 case 97:
return "Utc1310_C_Std";
949 case 98:
return "Utc1310_CPP_Std";
950 case 99:
return "Utc1310_LTCG_C";
951 case 100:
return "Utc1310_LTCG_CPP";
952 case 101:
return "Utc1310_POGO_I_C";
953 case 102:
return "Utc1310_POGO_I_CPP";
954 case 103:
return "Utc1310_POGO_O_C";
955 case 104:
return "Utc1310_POGO_O_CPP";
956 case 105:
return "AliasObj710";
957 case 106:
return "AliasObj710p";
958 case 107:
return "Cvtpgd1310";
959 case 108:
return "Cvtpgd1310p";
960 case 109:
return "Utc1400_C";
961 case 110:
return "Utc1400_CPP";
962 case 111:
return "Utc1400_C_Std";
963 case 112:
return "Utc1400_CPP_Std";
964 case 113:
return "Utc1400_LTCG_C";
965 case 114:
return "Utc1400_LTCG_CPP";
966 case 115:
return "Utc1400_POGO_I_C";
967 case 116:
return "Utc1400_POGO_I_CPP";
968 case 117:
return "Utc1400_POGO_O_C";
969 case 118:
return "Utc1400_POGO_O_CPP";
970 case 119:
return "Cvtpgd1400";
971 case 120:
return "Linker800";
972 case 121:
return "Cvtomf800";
973 case 122:
return "Export800";
974 case 123:
return "Implib800";
975 case 124:
return "Cvtres800";
976 case 125:
return "Masm800";
977 case 126:
return "AliasObj800";
978 case 127:
return "PhoenixPrerelease";
979 case 128:
return "Utc1400_CVTCIL_C";
980 case 129:
return "Utc1400_CVTCIL_CPP";
981 case 130:
return "Utc1400_LTCG_MSIL";
982 case 131:
return "Utc1500_C";
983 case 132:
return "Utc1500_CPP";
984 case 133:
return "Utc1500_C_Std";
985 case 134:
return "Utc1500_CPP_Std";
986 case 135:
return "Utc1500_CVTCIL_C";
987 case 136:
return "Utc1500_CVTCIL_CPP";
988 case 137:
return "Utc1500_LTCG_C";
989 case 138:
return "Utc1500_LTCG_CPP";
990 case 139:
return "Utc1500_LTCG_MSIL";
991 case 140:
return "Utc1500_POGO_I_C";
992 case 141:
return "Utc1500_POGO_I_CPP";
993 case 142:
return "Utc1500_POGO_O_C";
994 case 143:
return "Utc1500_POGO_O_CPP";
996 case 144:
return "Cvtpgd1500";
997 case 145:
return "Linker900";
998 case 146:
return "Export900";
999 case 147:
return "Implib900";
1000 case 148:
return "Cvtres900";
1001 case 149:
return "Masm900";
1002 case 150:
return "AliasObj900";
1003 case 151:
return "Resource900";
1005 case 152:
return "AliasObj1000";
1006 case 154:
return "Cvtres1000";
1007 case 155:
return "Export1000";
1008 case 156:
return "Implib1000";
1009 case 157:
return "Linker1000";
1010 case 158:
return "Masm1000";
1012 case 170:
return "Utc1600_C";
1013 case 171:
return "Utc1600_CPP";
1014 case 172:
return "Utc1600_CVTCIL_C";
1015 case 173:
return "Utc1600_CVTCIL_CPP";
1016 case 174:
return "Utc1600_LTCG_C ";
1017 case 175:
return "Utc1600_LTCG_CPP";
1018 case 176:
return "Utc1600_LTCG_MSIL";
1019 case 177:
return "Utc1600_POGO_I_C";
1020 case 178:
return "Utc1600_POGO_I_CPP";
1021 case 179:
return "Utc1600_POGO_O_C";
1022 case 180:
return "Utc1600_POGO_O_CPP";
1024 case 183:
return "Linker1010";
1025 case 184:
return "Export1010";
1026 case 185:
return "Implib1010";
1027 case 186:
return "Cvtres1010";
1028 case 187:
return "Masm1010";
1029 case 188:
return "AliasObj1010";
1031 case 199:
return "AliasObj1100";
1032 case 201:
return "Cvtres1100";
1033 case 202:
return "Export1100";
1034 case 203:
return "Implib1100";
1035 case 204:
return "Linker1100";
1036 case 205:
return "Masm1100";
1038 case 206:
return "Utc1700_C";
1039 case 207:
return "Utc1700_CPP";
1040 case 208:
return "Utc1700_CVTCIL_C";
1041 case 209:
return "Utc1700_CVTCIL_CPP";
1042 case 210:
return "Utc1700_LTCG_C ";
1043 case 211:
return "Utc1700_LTCG_CPP";
1044 case 212:
return "Utc1700_LTCG_MSIL";
1045 case 213:
return "Utc1700_POGO_I_C";
1046 case 214:
return "Utc1700_POGO_I_CPP";
1047 case 215:
return "Utc1700_POGO_O_C";
1048 case 216:
return "Utc1700_POGO_O_CPP";
1050 case 219:
return "Cvtres1200";
1051 case 220:
return "Export1200";
1052 case 221:
return "Implib1200";
1053 case 222:
return "Linker1200";
1057 case 224:
return "AliasObj1200";
1059 case 237:
return "Cvtres1210";
1060 case 238:
return "Export1210";
1061 case 239:
return "Implib1210";
1062 case 240:
return "Linker1210";
1066 case 242:
return "Utc1810_C";
1067 case 243:
return "Utc1810_CPP";
1068 case 244:
return "Utc1810_CVTCIL_C";
1069 case 245:
return "Utc1810_CVTCIL_CPP";
1070 case 246:
return "Utc1810_LTCG_C ";
1071 case 247:
return "Utc1810_LTCG_CPP";
1072 case 248:
return "Utc1810_LTCG_MSIL";
1073 case 249:
return "Utc1810_POGO_I_C";
1074 case 250:
return "Utc1810_POGO_I_CPP";
1075 case 251:
return "Utc1810_POGO_O_C";
1076 case 252:
return "Utc1810_POGO_O_CPP";
1078 case 255:
return "Cvtres1400";
1079 case 256:
return "Export1400";
1080 case 257:
return "Implib1400";
1081 case 258:
return "Linker1400";
1082 case 259:
return "Masm1400";
1084 case 260:
return "Utc1900_C";
1086 return "Utc1900_CPP";
1088 case 262:
return "Utc1900_CVTCIL_C";
1089 case 263:
return "Utc1900_CVTCIL_CPP";
1090 case 264:
return "Utc1900_LTCG_C ";
1091 case 265:
return "Utc1900_LTCG_CPP";
1092 case 266:
return "Utc1900_LTCG_MSIL";
1093 case 267:
return "Utc1900_POGO_I_C";
1094 case 268:
return "Utc1900_POGO_I_CPP";
1095 case 269:
return "Utc1900_POGO_O_C";
1096 case 270:
return "Utc1900_POGO_O_CPP";
1097 default:
return "Unknown";
1102 if (!
bin->rich_entries) {
1105 bin->rich_header_offset =
bin->nt_header_offset;
1107 ut32 magic = 0x68636952;
1142 entry->productId = data >> 16;
1143 entry->minVersion = data & 0xFFFF;
1148 bin->rich_header_offset =
off +
sizeof(
ut32);
1153 case 0x00:
return "LANG_NEUTRAL";
1154 case 0x7f:
return "LANG_INVARIANT";
1155 case 0x36:
return "LANG_AFRIKAANS";
1156 case 0x1c:
return "LANG_ALBANIAN ";
1157 case 0x01:
return "LANG_ARABIC";
1158 case 0x2b:
return "LANG_ARMENIAN";
1159 case 0x4d:
return "LANG_ASSAMESE";
1160 case 0x2c:
return "LANG_AZERI";
1161 case 0x2d:
return "LANG_BASQUE";
1162 case 0x23:
return "LANG_BELARUSIAN";
1163 case 0x45:
return "LANG_BENGALI";
1164 case 0x02:
return "LANG_BULGARIAN";
1165 case 0x03:
return "LANG_CATALAN";
1166 case 0x04:
return "LANG_CHINESE";
1167 case 0x1a:
return "LANG_CROATIAN";
1168 case 0x05:
return "LANG_CZECH";
1169 case 0x06:
return "LANG_DANISH";
1170 case 0x65:
return "LANG_DIVEHI";
1171 case 0x13:
return "LANG_DUTCH";
1172 case 0x09:
return "LANG_ENGLISH";
1173 case 0x25:
return "LANG_ESTONIAN";
1174 case 0x38:
return "LANG_FAEROESE";
1175 case 0x29:
return "LANG_FARSI";
1176 case 0x0b:
return "LANG_FINNISH";
1177 case 0x0c:
return "LANG_FRENCH";
1178 case 0x56:
return "LANG_GALICIAN";
1179 case 0x37:
return "LANG_GEORGIAN";
1180 case 0x07:
return "LANG_GERMAN";
1181 case 0x08:
return "LANG_GREEK";
1182 case 0x47:
return "LANG_GUJARATI";
1183 case 0x0d:
return "LANG_HEBREW";
1184 case 0x39:
return "LANG_HINDI";
1185 case 0x0e:
return "LANG_HUNGARIAN";
1186 case 0x0f:
return "LANG_ICELANDIC";
1187 case 0x21:
return "LANG_INDONESIAN";
1188 case 0x10:
return "LANG_ITALIAN";
1189 case 0x11:
return "LANG_JAPANESE";
1190 case 0x4b:
return "LANG_KANNADA";
1191 case 0x60:
return "LANG_KASHMIRI";
1192 case 0x3f:
return "LANG_KAZAK";
1193 case 0x57:
return "LANG_KONKANI";
1194 case 0x12:
return "LANG_KOREAN";
1195 case 0x40:
return "LANG_KYRGYZ";
1196 case 0x26:
return "LANG_LATVIAN";
1197 case 0x27:
return "LANG_LITHUANIAN";
1198 case 0x2f:
return "LANG_MACEDONIAN";
1199 case 0x3e:
return "LANG_MALAY";
1200 case 0x4c:
return "LANG_MALAYALAM";
1201 case 0x58:
return "LANG_MANIPURI";
1202 case 0x4e:
return "LANG_MARATHI";
1203 case 0x50:
return "LANG_MONGOLIAN";
1204 case 0x61:
return "LANG_NEPALI";
1205 case 0x14:
return "LANG_NORWEGIAN";
1206 case 0x48:
return "LANG_ORIYA";
1207 case 0x15:
return "LANG_POLISH";
1208 case 0x16:
return "LANG_PORTUGUESE";
1209 case 0x46:
return "LANG_PUNJABI";
1210 case 0x18:
return "LANG_ROMANIAN";
1211 case 0x19:
return "LANG_RUSSIAN";
1212 case 0x4f:
return "LANG_SANSKRIT";
1213 case 0x59:
return "LANG_SINDHI";
1214 case 0x1b:
return "LANG_SLOVAK";
1215 case 0x24:
return "LANG_SLOVENIAN";
1216 case 0x0a:
return "LANG_SPANISH ";
1217 case 0x41:
return "LANG_SWAHILI";
1218 case 0x1d:
return "LANG_SWEDISH";
1219 case 0x5a:
return "LANG_SYRIAC";
1220 case 0x49:
return "LANG_TAMIL";
1221 case 0x44:
return "LANG_TATAR";
1222 case 0x4a:
return "LANG_TELUGU";
1223 case 0x1e:
return "LANG_THAI";
1224 case 0x1f:
return "LANG_TURKISH";
1225 case 0x22:
return "LANG_UKRAINIAN";
1226 case 0x20:
return "LANG_URDU";
1227 case 0x43:
return "LANG_UZBEK";
1228 case 0x2a:
return "LANG_VIETNAMESE";
1229 case 0x3c:
return "LANG_GAELIC";
1230 case 0x3a:
return "LANG_MALTESE";
1231 case 0x28:
return "LANG_MAORI";
1232 case 0x17:
return "LANG_RHAETO_ROMANCE";
1233 case 0x3b:
return "LANG_SAAMI";
1234 case 0x2e:
return "LANG_SORBIAN";
1235 case 0x30:
return "LANG_SUTU";
1236 case 0x31:
return "LANG_TSONGA";
1237 case 0x32:
return "LANG_TSWANA";
1238 case 0x33:
return "LANG_VENDA";
1239 case 0x34:
return "LANG_XHOSA";
1240 case 0x35:
return "LANG_ZULU";
1241 case 0x8f:
return "LANG_ESPERANTO";
1242 case 0x90:
return "LANG_WALON";
1243 case 0x91:
return "LANG_CORNISH";
1244 case 0x92:
return "LANG_WELSH";
1245 case 0x93:
return "LANG_BRETON";
1246 default:
return "UNKNOWN";
1251 const char *typeName;
1254 typeName =
"CURSOR";
1257 typeName =
"BITMAP";
1266 typeName =
"DIALOG";
1269 typeName =
"STRING";
1272 typeName =
"FONTDIR";
1278 typeName =
"ACCELERATOR";
1281 typeName =
"RCDATA";
1284 typeName =
"MESSAGETABLE";
1287 typeName =
"GROUP_CURSOR";
1290 typeName =
"GROUP_ICON";
1293 typeName =
"VERSION";
1296 typeName =
"DLGINCLUDE";
1299 typeName =
"PLUGPLAY";
1305 typeName =
"ANICURSOR";
1308 typeName =
"ANIICON";
1314 typeName =
"MANIFEST";
1358 char *resourceEntryName =
NULL;
1361 ut64 rsrc_base =
bin->resource_directory_offset;
1366 for (index = 0; index < totalRes; index++) {
1368 off = rsrc_base + offDir +
sizeof(*dir) + index *
sizeof(
entry);
1369 if (ht_uu_find(dirs,
off,
NULL)) {
1372 ht_uu_insert(dirs,
off, 1);
1380 if (
entry.u1.Name >> 31) {
1383 ut32 NameOffset =
entry.u1.Name & 0x7fffffff;
1388 resourceEntryName =
calloc(resourceEntryNameLength + 1, 1);
1389 if (resourceEntryName) {
1390 for (
i = 0;
i < resourceEntryNameLength;
i++) {
1393 if (
r !=
sizeof(
ut8) || !
byte) {
1397 resourceEntryName[
i] = byte;
1401 if (
entry.u2.OffsetToData >> 31) {
1404 ut32 OffsetToDirectory =
entry.u2.OffsetToData & 0x7fffffff;
1405 off = rsrc_base + OffsetToDirectory;
1420 off = rsrc_base +
entry.u2.OffsetToData;
1421 if (
off >
bin->size ||
off +
sizeof(*data) >
bin->size) {
1447 if ((cur_paddr & 0x3) != 0) {
1448 RZ_LOG_INFO(
"not aligned version info address\n");
1453 while (cur_paddr < (data_paddr + data->
Size) && cur_paddr < bin->
size) {
1455 if (vs_VersionInfo) {
1461 if (vs_VersionInfo->
wLength < 1) {
1465 cur_paddr += vs_VersionInfo->
wLength;
1485 if (resource_name) {
1504 rz_list_foreach (
bin->resources,
iter,
rs) {
1516 key =
sdb_fmt(
"resource.%d.language", index);
1525 ut64 off = 0, rsrc_base =
bin->resource_directory_offset;
1529 HtUUOptions opt = { 0 };
1530 HtUU *dirs = ht_uu_new_opt(&opt);
1534 if (!rs_directory) {
1545 for (index = 0; index < totalRes; index++) {
1547 off = rsrc_base +
sizeof(*rs_directory) + index *
sizeof(typeEntry);
1548 ht_uu_insert(dirs,
off, 1);
1549 if (
off >
bin->size ||
off +
sizeof(typeEntry) >
bin->size) {
1559 off = rsrc_base + OffsetToDirectory;
1561 if (
len !=
sizeof(identEntry)) {
RZ_API char * sdb_encode(const ut8 *bin, int len)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len key
RZ_API char * sdb_fmt(const char *fmt,...)
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
void * realloc(void *ptr, size_t size)
void * malloc(size_t size)
void * calloc(size_t number, size_t size)
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
RZ_API int sdb_ns_set(Sdb *s, const char *name, Sdb *r)
RZ_API int sdb_num_set(Sdb *s, const char *key, ut64 v, ut32 cas)
RZ_API ut64 sdb_num_get(Sdb *s, const char *key, ut32 *cas)
PE_DWord PE_() bin_pe_rva_to_paddr(RzBinPEObj *bin, PE_DWord rva)
PE_DWord PE_() bin_pe_rva_to_va(RzBinPEObj *bin, PE_DWord rva)
#define PE_READ_STRUCT_FIELD(var, struct_type, field, size)
static String * Pe_r_bin_pe_parse_string(RzBinPEObj *bin, PE_DWord *curAddr)
static VarFileInfo * Pe_r_bin_pe_parse_var_file_info(RzBinPEObj *bin, PE_DWord *curAddr)
static Sdb * Pe_r_bin_store_var(Var *var)
static void free_Var(Var *var)
static StringTable * Pe_r_bin_pe_parse_string_table(RzBinPEObj *bin, PE_DWord *curAddr)
static void free_VS_VERSIONINFO(PE_VS_VERSIONINFO *vs_VersionInfo)
static Var * Pe_r_bin_pe_parse_var(RzBinPEObj *bin, PE_DWord *curAddr)
static Sdb * Pe_r_bin_store_fixed_file_info(PE_VS_FIXEDFILEINFO *vs_fixedFileInfo)
static void _store_resource_sdb(RzBinPEObj *bin)
static int read_image_resource_directory(RzBuffer *b, ut64 addr, Pe_image_resource_directory *dir)
static StringFileInfo * Pe_r_bin_pe_parse_string_file_info(RzBinPEObj *bin, PE_DWord *curAddr)
static int read_image_resource_directory_entry(RzBuffer *b, ut64 addr, Pe_image_resource_directory_entry *entry)
static Sdb * Pe_r_bin_store_string_file_info(StringFileInfo *stringFileInfo)
void PE_() bin_pe_init_rich_info(RzBinPEObj *bin)
RZ_API void PE_() bin_pe_parse_resource(RzBinPEObj *bin)
static Sdb * Pe_r_bin_store_resource_version_info(PE_VS_VERSIONINFO *vs_VersionInfo)
static char * _resource_type_str(int type)
static void free_StringTable(StringTable *stringTable)
static void _free_resource(rz_pe_resource *rs)
static bool read_image_resource_directory_aux(RzBuffer *b, Pe_image_resource_directory *dir)
static Sdb * Pe_r_bin_store_var_file_info(VarFileInfo *varFileInfo)
static void free_VarFileInfo(VarFileInfo *varFileInfo)
static Sdb * Pe_r_bin_store_string_table(StringTable *stringTable)
static Sdb * Pe_r_bin_store_string(String *string)
static PE_VS_VERSIONINFO * Pe_r_bin_pe_parse_version_info(RzBinPEObj *bin, PE_DWord version_info_paddr)
static void _parse_resource_directory(RzBinPEObj *bin, Pe_image_resource_directory *dir, ut64 offDir, int type, int id, HtUU *dirs, const char *resource_name)
#define EXIT_ON_OVERFLOW(S)
static char * _resource_lang_str(int id)
static char * _known_product_ids(int id)
int PE_() bin_pe_init_resource(RzBinPEObj *bin)
static void free_StringFileInfo(StringFileInfo *stringFileInfo)
static int read_image_resource_data_entry(RzBuffer *b, ut64 addr, Pe_image_resource_data_entry *entry)
static void free_String(String *string)
#define VS_VERSION_INFO_UTF_16_LEN
#define EIGHT_HEX_DIG_UTF_16_LEN
#define VS_VERSION_INFO_UTF_16
#define PE_IMAGE_DIRECTORY_ENTRY_RESOURCE
#define STRINGFILEINFO_UTF_16
#define TRANSLATION_UTF_16
#define RZ_PE_MAX_RESOURCES
#define VARFILEINFO_UTF_16
#define STRINGFILEINFO_UTF_16_LEN
#define TRANSLATION_UTF_16_LEN
#define PE_RESOURCE_ENTRY_VERSION
#define VARFILEINFO_UTF_16_LEN
#define rz_buf_read_le16_at(b, addr, result)
RZ_API st64 rz_buf_seek(RZ_NONNULL RzBuffer *b, st64 addr, int whence)
Modify the current cursor position in the buffer.
RZ_API st64 rz_buf_read_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL RZ_OUT ut8 *buf, ut64 len)
Read len bytes of the buffer at the specified address.
#define rz_buf_read_le16(b, result)
Read a big endian or little endian (ut16, ut32, ut64) at the specified offset in the buffer and shift...
#define rz_buf_read_le32_at(b, addr, result)
#define rz_buf_read_le32(b, result)
RZ_API st64 rz_buf_read(RZ_NONNULL RzBuffer *b, RZ_NONNULL RZ_OUT ut8 *buf, ut64 len)
static ut16 rz_read_le16(const void *src)
void(* RzListFree)(void *ptr)
#define RZ_LOG_INFO(fmtstr,...)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API bool rz_time_stamp_is_dos_format(const ut32 certainPosixTimeStamp, const ut32 possiblePosixOrDosTimeStamp)
Verifies that the timestamp is in dos format.
RZ_API RZ_OWN char * rz_time_stamp_to_str(ut32 timestamp)
Converts an unix epoch timestamp to string.
RZ_API ut32 rz_time_dos_time_stamp_to_posix(ut32 timestamp)
Converts dos timestamp to posix timestamp.
RZ_API int sdb_set(Sdb *s, const char *key, const char *val, ut32 cas)
RZ_API Sdb * sdb_new0(void)
RZ_API bool sdb_free(Sdb *s)
VarFileInfo * varFileInfo
StringFileInfo * stringFileInfo
PE_VS_FIXEDFILEINFO * Value
union Pe_image_resource_directory_entry::@191 u1
union Pe_image_resource_directory_entry::@192 u2
ut16 NumberOfNamedEntries
ut64(WINAPI *w32_GetEnabledXStateFeatures)()