(EXE): imporved RT_VERSION parser.

This commit is contained in:
morkt 2023-10-20 18:14:14 +04:00
parent 5f9340c32b
commit 67811651d4

View File

@ -175,17 +175,23 @@ namespace GameRes.Formats.Microsoft
input.Position = pos; input.Position = pos;
if (input.ReadUInt32() != 0xFEEF04BDu) if (input.ReadUInt32() != 0xFEEF04BDu)
break; break;
input.Position = pos + value_length; int info_length = value_length;
int str_info_length = input.ReadUInt16(); bool found_string_info = false;
do
{
pos += info_length;
input.Position = pos;
info_length = input.ReadUInt16();
value_length = input.ReadUInt16(); value_length = input.ReadUInt16();
type = input.ReadUInt16(); type = input.ReadUInt16();
if (value_length != 0) found_string_info = input.ReadCString (Encoding.Unicode) == "StringFileInfo";
break; }
if (input.ReadCString (Encoding.Unicode) != "StringFileInfo") while (!found_string_info && input.PeekByte() != -1);
if (!found_string_info)
break; break;
pos = (input.Position + 3) & -4L; pos = (input.Position + 3) & -4L;
input.Position = pos; input.Position = pos;
int info_length = input.ReadUInt16(); info_length = input.ReadUInt16();
long end_pos = pos + info_length; long end_pos = pos + info_length;
value_length = input.ReadUInt16(); value_length = input.ReadUInt16();
type = input.ReadUInt16(); type = input.ReadUInt16();