https://bugs.winehq.org/show_bug.cgi?id=45696
Bug ID: 45696 Summary: iconcache ImageList goes out of sync when an icon partially fails to load Product: Wine Version: 3.14 Hardware: x86 URL: http://web.archive.org/web/20061024195250/http://www.g orlani.com:80/downloads/turniton.zip OS: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: shell32 Assignee: wine-bugs@winehq.org Reporter: gabrielopcode@gmail.com Distribution: ---
This is mostly for reference and reproducibility: I plan to fix this bug.
I've stumbled upon it when browsing through a Windows drive full of random programs with Total Commander under Wine, that contained the application "TurnItOn.exe" which is packed with some sort of executable packer (not UPX).
There were other applications with icons in the same directory, but when the icon failed to load for TurnItOn.exe, it would receive the icon of the *next* application in the list and so on, until the last one which had a blank icon (out of bounds) -- totally messing the icons up until Total Commander was restarted.
I was able to locate this exact version of TurnItOn.exe that I found via the web archive. It's a freeware, and it doesn't even have to be run! To reproduce this bug, it's enough that it exists so that its icon gets loaded by Total Commander.
To reproduce:
* Download Total Commander if you don't have it from: http://www.ghisler.com/amazons3.php * Download and place TurnItOn.exe in C:\windows on a new prefix for winhlp32.exe * Enter the directory via Total Commander, notice how both lack icons now * Exit it and enter it again to redraw the icons
Note how at this point, TurnItOn.exe has the icon of winhlp32.exe, while the latter has a blank icon. If there were more executables, all the icons were "shifted" back but not in index.
This happens because, due to the packer in TurnItOn.exe, only some of the icons fail to load. The icon cache loads multiple versions of the icon at different sizes in its cached ImageList array.
When at least one icon succeeds the extraction, the index gets incremented. However, in this case the 16x16 icon fails to load, but the 32x32 icon does not. So the cache ImageLists will get out of sync (a warning is even displayed), resulting in this problem: index pointing one icon ahead in the 16x16 list.
The simplest solution would be to fail the entire thing if at least one icon fails to load. However, that would make TurnItOn.exe have no icon, despite the fact its 32x32 icon extracted fine, but at least it would solve the bug.
But I plan to do something better: create missing icons that failed to extract by resizing the ones that succeeded. In this case, the 32x32 icon would get resized to 16x16 and an icon would be created. Then, TurnItOn.exe would also have an icon (as well as other times an icon fails to extract).
https://bugs.winehq.org/show_bug.cgi?id=45696
--- Comment #1 from Gabriel Ivăncescu gabrielopcode@gmail.com --- Created attachment 62900 --> https://bugs.winehq.org/attachment.cgi?id=62900 Generate icons from available icons if some icon sizes failed to load
Commit 4e633f92442a7e45add37e82a07d848a5c13164b fixes the out of sync problem, but the icon won't be loaded in this case (it's still far better, though). This patch implements the workaround of generating the icon from another one that succeeded to load. It's done empirically only and a semi-hack, to make it less pixelated, but it should be alright for a workaround, for now.
https://bugs.winehq.org/show_bug.cgi?id=45696
Alistair Leslie-Hughes leslie_alistair@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Staged patchset| |https://github.com/wine-sta | |ging/wine-staging/tree/mast | |er/patches/shell32-IconCach | |e Ever confirmed|0 |1 Status|UNCONFIRMED |STAGED CC| |leslie_alistair@hotmail.com