bug-binutils
[Top][All Lists]
Advanced

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

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


From: pali at kernel dot org
Subject: [Bug binutils/30376] New: windres cannot parse rc files which it itself generated
Date: Fri, 21 Apr 2023 16:09:44 +0000

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

            Bug ID: 30376
           Summary: windres cannot parse rc files which it itself
                    generated
           Product: binutils
           Version: 2.39
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: pali at kernel dot org
  Target Milestone: ---

I took shell32.dll library from Windows XP. I have passed it to windres to
generate RC file from it and then I passed this RC file back to windres to
generate COFF object file from it. First phase DLL to RC is OK but in second
phase windres throwed syntax error for the RC file which it itself generated.

$ i686-w64-mingw32-windres --input-format=coff --output-format=rc -i
shell32.dll -o shell32.rc

$ i686-w64-mingw32-windres --input-format=rc --output-format=coff -i shell32.rc
-o shell32.o
i686-w64-mingw32-windres: shell32.rc:6473: syntax error
i686-w64-mingw32-windres: preprocessing failed.

Around line 6473 of generated file shell32.rc is:

  6468 /* Type: "REGINST"
  6469
  6470    Name: "REGINST".  */
  6471
  6472 "REGINST" "REGINST"
  6473 BEGIN
  6474   "[Version]\r\n"
  6475   "Signature=""$CHICAGO$""\r\n"
  6476   "[RegDll]\r\n"

(note that in above output is one additional space after the line number added
by me)

It looks like a bug that windres cannot process in text RC files names with
strings. But can process it from binary COFF files and even can generate text
RC files with them.

wrestool shows about this DLL library following information:

$ wrestool -l shell32.dll 
--type='AVI' --name=150 --language=1033 [offset=0x3a9380 size=20796]
--type='AVI' --name=151 --language=1033 [offset=0x3ae4c0 size=6144]
--type='AVI' --name=152 --language=1033 [offset=0x3afcc0 size=6144]
--type='AVI' --name=160 --language=1033 [offset=0x3b82c0 size=22016]
--type='AVI' --name=161 --language=1033 [offset=0x3b14c0 size=14848]
--type='AVI' --name=162 --language=1033 [offset=0x3b4ec0 size=13312]
--type='AVI' --name=163 --language=1033 [offset=0x3bd8c0 size=13312]
--type='AVI' --name=164 --language=1033 [offset=0x3c0cc0 size=13824]
--type='AVI' --name=165 --language=1033 [offset=0x3c42c0 size=29184]
--type='AVI' --name=166 --language=1033 [offset=0x3cb4c0 size=9728]
--type='AVI' --name=167 --language=1033 [offset=0x3cdac0 size=19248]
--type='AVI' --name=168 --language=1033 [offset=0x3d25f0 size=11802]
--type='AVI' --name=169 --language=1033 [offset=0x3d5410 size=12722]
--type='AVI' --name=170 --language=1033 [offset=0x3d85c8 size=10886]
--type='REGINST' --name='REGINST' --language=1033 [offset=0x236c98 size=166660]
--type='TYPELIB' --name=1 --language=1033 [offset=0x7c4f10 size=33940]
--type='UIFILE' --name=3 --language=1033 [offset=0x7ae208 size=1785]
--type='UIFILE' --name=4 --language=1033 [offset=0x7ae908 size=2356]
--type=1 --name=1 --language=1033 [type=cursor offset=0x3db050 size=308]
--type=1 --name=2 --language=1033 [type=cursor offset=0x3db1a0 size=308]
--type=1 --name=3 --language=1033 [type=cursor offset=0x3db2f0 size=308]
--type=1 --name=4 --language=1033 [type=cursor offset=0x3db440 size=308]
--type=1 --name=5 --language=1033 [type=cursor offset=0x3db590 size=308]
...

When I replaced string name "REGINST" by integer name 7777 in (generated) text
file shell32.rc and tried to compile shell32.rc I got another error message:

$ i686-w64-mingw32-windres --input-format=rc --output-format=coff -i shell32.rc
-o shell32.o
i686-w64-mingw32-windres: shell32.rc:189276: syntax error

Content around line 189276 is:

189268 /* Name: 14352.  */
189269
189270 14352 DIALOGEX 20, 20, 275, 198
189271 STYLE 0x80c800cc
189272 CAPTION "About %s"
189273 FONT 8, "MS Shell Dlg"
189274 BEGIN
189275   CONTROL 12297, 130, 0x50000043, 21, 55, 21, 20
189276   CONTROL L"Microsoft \256 %s", 13568, 130, 0x5000008c, 70, 55, 165, 10
189277   CONTROL "", 13579, 130, 0x5000008c, 70, 65, 200, 10
189278   CONTROL L"Copyright \251 %s Microsoft Corporation", 13578, 130,
0x50000080, 70, 75, 175, 10
189279   CONTROL "", 13581, 130, 0x50000080, 70, 85, 145, 20
189280   CONTROL "This product is licensed under the terms of the <A>End-User
License Agreement</A> to:", 13586, "SysLink", 0x50000000, 70, 105, 145, 20
189281   CONTROL "user name", 13575, 130, 0x50000080, 80, 125, 145, 10
189282   CONTROL "org name", 13576, 130, 0x50000080, 80, 135, 145, 10
189283   CONTROL "", 13095, 130, 0x50000010, 70, 147, 200, 1
189284   CONTROL "Physical memory available to Windows:", 13570, 130,
0x50000080, 70, 152, 130, 10
189285   CONTROL "", 13571, 130, 0x50000080, 202, 152, 53, 10
189286   DEFPUSHBUTTON "OK", 1, 220, 178, 50, 14, 0x50010001
189287 END

(note that in above output is one additional space after the line number added
by me)

And here I do not understand what does "syntax error" message mean. What is
wrong on that line 189276. And neither if the issue in the windres text RC
format generator or in text RC format parser.

In any case, if windres generates text RC file then it must be able to parse
it.

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