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:09:36 +0000

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

--- Comment #6 from Pali Rohár <pali at kernel dot org> ---
Hello Nick! Now I tried your patch. Now it is better because windres can
compile its own generated rc file. But there are still issues.

I did more repeated conversions between binary and text file via these steps:

$ i686-w64-mingw32-windres shell32.dll shell32.dll.rc
$ i686-w64-mingw32-windres shell32.dll.rc shell32.dll.rc.res
i686-w64-mingw32-windres: warning: 14: 1001: 1033: duplicate value
i686-w64-mingw32-windres: warning: 14: 1002: 1033: duplicate value
i686-w64-mingw32-windres: warning: 14: 1003: 1033: duplicate value
i686-w64-mingw32-windres: warning: 14: 1004: 1033: duplicate value
i686-w64-mingw32-windres: warning: 14: 1005: 1033: duplicate value
$ i686-w64-mingw32-windres shell32.dll.rc.res shell32.dll.rc.res.rc
$ i686-w64-mingw32-windres shell32.dll.rc.res.rc shell32.dll.rc.res.rc.res
$ i686-w64-mingw32-windres shell32.dll.rc.res.rc.res
shell32.dll.rc.res.rc.res.rc

And I see more issues.

First issue is that every one *.rc file is different individual resources have
different content. So it means that either compiler or decompiler is doing
something wrong if it changes content.

Second issue is that second windres call drops RT_GROUP_CURSOR and
RT_GROUP_ICON during compilation. It throws that duplicate value warning, but
there are no duplicates. Seems that checking for duplicates is improper. See
following output:

$ grep '^1001 ' shell32.dll.rc shell32.dll.rc.res.rc
shell32.dll.rc:1001 3 /* RT_ICON */
shell32.dll.rc:1001 12 /* RT_GROUP_CURSOR */
shell32.dll.rc:1001 14 /* RT_GROUP_ICON */
shell32.dll.rc.res.rc:1001 3 /* RT_ICON */ MOVEABLE PURE DISCARDABLE
shell32.dll.rc.res.rc:1001 14 /* RT_GROUP_ICON */ MOVEABLE PURE DISCARDABLE

It looks like that windres during duplication checks only for name, not for
tuple (name, type).

Third issue is that windres starts adding MOVEABLE PURE DISCARDABLE attributes
even they were not in previous iteration of compilation / decompilation. I'm
not sure if they should be there or not. But I was expecting that res --> rc
--> res --> rc actions would convergate to one stable rc file.

Fourth issue: Resource "2 1" (cursor) has completely different content in
shell32.dll.rc and shell32.dll.rc.res.rc files. diff is:

 /* Name: 2.  */

-2 1 /* RT_CURSOR */
+2 1 /* RT_CURSOR */ MOVEABLE PURE DISCARDABLE
 BEGIN
    0x1, 0x3,   /* Hotspot x: 1, y: 3.  */
-  0x28L      , 0x20L      , 0x40L      , 0x10001L   , 0x0L       , 0x100L    
, 0x0L       , 0x0L       ,
-  0x0L       , 0x0L       , 0x0L       , 0xffffffL  , 0x0L       , 0x0L      
, 0x0L       , 0x0L       ,
-  0x0L       , 0x0L       , 0x0L       , 0x0L       , 0x0L       , 0xc0000L  
, 0x1e0000L  , 0x1f0000L  ,
-  0x80ff0700L, 0xc0ff1f00L, 0xe0cf3700L, 0xc0ff6f00L, 0x80cfdf00L, 0xcfbf00L 
, 0xe77f00L  , 0xe37f00L  ,
-  0x33ff00L  , 0x3ef01L   , 0x86df03L  , 0xfcbd07L  , 0xf83b0fL  , 0x70371eL 
, 0xe00e3cL  , 0xc00d38L  ,
-  0x300L     , 0x0L       , 0x0L       , 0x0L       , 0xffffffffL,
0xffffffffL, 0xffffffffL, 0xffffffffL,
-  0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xfff7ffffL,
0xffe3ffffL, 0xffc1ffffL, 0xff00f8ffL,
-  0x7f00e0ffL, 0x3f00c0ffL, 0x1f0080ffL, 0x1f0000ffL, 0x3f0000feL,
0x7f0000feL, 0x7f0000feL, 0x7f0000ffL,
-  0x7f0000feL, 0x7f0000fcL, 0xff0000f8L, 0xff0100f0L, 0xff0300e0L,
0xff0780c0L, 0xff0fc081L, 0xff1fe083L,
-  0xff3ff087L, 0xfffffcffL, 0xffffffffL, 0xffffffffL
+  0xed005e70L, 0x55d5L    , 0x1L       , 0x0L       , 0x40L      , 0x0L      
, 0x0L       , 0x0L       ,
+  0xed005e90L, 0x55d5L    , 0x1L       , 0x0L       , 0x10001L   , 0x0L      
, 0x0L       , 0x0L       ,
+  0xed005eb0L, 0x55d5L    , 0x1L       , 0x0L       , 0x0L       , 0x0L      
, 0x0L       , 0x0L       ,
+  0xed005ed0L, 0x55d5L    , 0x1L       , 0x0L       , 0x100L     , 0x0L      
, 0x0L       , 0x0L       ,
+  0xed005ef0L, 0x55d5L    , 0x1L       , 0x0L       , 0x0L       , 0x0L      
, 0x0L       , 0x0L       ,
+  0xed005f10L, 0x55d5L    , 0x1L       , 0x0L       , 0x0L       , 0x0L      
, 0x0L       , 0x0L       ,
+  0xed005f30L, 0x55d5L    , 0x1L       , 0x0L       , 0x0L       , 0x0L      
, 0x0L       , 0x0L       ,
+  0xed005f50L, 0x55d5L    , 0x1L       , 0x0L       , 0x0L       , 0x0L      
, 0x0L       , 0x0L       ,
+  0xed005f70L, 0x55d5L    , 0x1L       , 0x0L       , 0x0L       , 0x0L      
, 0x0L       , 0x0L       ,
+  0xed005f90L, 0x55d5L    , 0x1L       , 0x0L
 END

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