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).