bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/30376] windres cannot parse rc files which it itself gener


From: pali at kernel dot org
Subject: [Bug binutils/30376] windres cannot parse rc files which it itself generated
Date: Sun, 14 May 2023 09:20:20 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=30376

--- Comment #7 from Pali Rohár <pali at kernel dot org> ---
I did also another test. I took very simple resource file:

$ cat test-resource.rc
resource_name1 resource_type1 { "resource_string_data1" }
resource_name2 "resource_type2" { "resource_string_data2" }
"resource_name3" resource_type3 { "resource_string_data3" }
"resource_name4" "resource_type4" { "resource_string_data4" }

With MS RC.EXE compiler I can compile it, it does not throw any warning /
error:

$ RC.EXE /fo test-resource.ms.res test-resource.rc

If I try to compile it with GNU windres, it throws syntax error:

$ i686-w64-mingw32-windres test-resource.rc test-resource.gnu.res
i686-w64-mingw32-windres: test-resource.rc:4: syntax error

Binary resource test-resource.ms.res compiled by MS compiler I can put into
resource-only DLL via MS linker and then list its content via wrestool:

$ LINK.EXE /NOLOGO /DLL /NOENTRY /MACHINE:IX86 /OUT:test-resource.ms.dll
test-resource.ms.res
$ $ wrestool -l test-resource.ms.dll
--type='"RESOURCE_TYPE2"' --name='"RESOURCE_TYPE2"' --language=1033
[offset=0x1248 size=21]
--type='"RESOURCE_TYPE4"' --name='"RESOURCE_TYPE4"' --language=1033
[offset=0x1278 size=21]
--type='RESOURCE_TYPE1' --name='RESOURCE_TYPE1' --language=1033 [offset=0x1230
size=21]
--type='RESOURCE_TYPE3' --name='RESOURCE_TYPE3' --language=1033 [offset=0x1260
size=21]


And now if I decompile resource.ms.res via GNU windres I get following output:

$ i686-w64-mingw32-windres test-resource.ms.res

/* Type: """RESOURCE_TYPE2"""

   Name: "RESOURCE_NAME2".  */
LANGUAGE 9, 1

"RESOURCE_NAME2" """RESOURCE_TYPE2""" MOVEABLE PURE
BEGIN
  0x6f736572L, 0x65637275L, 0x7274735fL, 0x5f676e69L, 0x61746164L,
  "2"
END

/* Type: """RESOURCE_TYPE4"""

   Name: """RESOURCE_NAME4""".  */

"""RESOURCE_NAME4""" """RESOURCE_TYPE4""" MOVEABLE PURE
BEGIN
  0x6f736572L, 0x65637275L, 0x7274735fL, 0x5f676e69L, 0x61746164L,
  "4"
END

/* Type: "RESOURCE_TYPE1"

   Name: "RESOURCE_NAME1".  */

"RESOURCE_NAME1" "RESOURCE_TYPE1" MOVEABLE PURE
BEGIN
  0x6f736572L, 0x65637275L, 0x7274735fL, 0x5f676e69L, 0x61746164L,
  "1"
END

/* Type: "RESOURCE_TYPE3"

   Name: """RESOURCE_NAME3""".  */

"""RESOURCE_NAME3""" "RESOURCE_TYPE3" MOVEABLE PURE
BEGIN
  0x6f736572L, 0x65637275L, 0x7274735fL, 0x5f676e69L, 0x61746164L,
  "3"
END


It is clear that it is not what was on the input as resource name and types
have messed quote character. Content seems to be correct, it is just encoded in
less readable DWORDs form instead of ASCII string.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]