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: Thu, 11 May 2023 19:22:53 +0000

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

--- Comment #5 from Pali Rohár <pali at kernel dot org> ---
Finally I found documentation about named resources which caused this issue:
https://learn.microsoft.com/en-us/windows/win32/menurc/user-defined-resource

And here there is no information that name or type should be quoted. Also in
example is both name and type unquoted.

So I did an experiment with simple RC file:

$ cat RESOURCE.RC
resource_name resource_type { "resource_string_data" }

I compiled it with MS resource compiler RC.EXE to RESOURCE.RES file:

$ RC.EXE RESOURCE.RC

It accepted it and did not print any warning / error.

Then I created resource-only DLL with the linker script which you provided:

$ i686-w64-mingw32-windres RESOURCE.RES RESOURCE.OBJ
$ i686-w64-mingw32-ld -dll --subsystem windows -e 0 -s RESOURCE.OBJ -o
RESOURCE.DLL -T resource-only.ld

And then printed resources via wrestool:

$ wrestool -l RESOURCE.DLL
--type='RESOURCE_TYPE' --name='RESOURCE_TYPE' --language=1033 [offset=0x1090
size=20]

(I'm not sure why it prints wrong name, but whatever).

Next I did another experiment with following resource file, when I quoted name
and type:

$ cat RESOURCE.RC
"resource_name" "resource_type" { "resource_string_data" }

And again compiled it with MS RC.EXE compiler and created resource-only DLL
with GNU tools. MS compiler accepted this input file without any warning or
error. And wrestool showed:

$ wrestool -l RESOURCE.DLL
--type='"RESOURCE_TYPE"' --name='"RESOURCE_TYPE"' --language=1033
[offset=0x1098 size=20]

Look at the type, it is quited. So it looks like that name in RC file should be
taken as-is, if it contains quotes then quotes are part of the name. And it
means that GNU windres does not generate correct RC file and also does not
parse  RC file correctly.

I will try your windres patch later and let you know the results.

-- 
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]