win-shim
win-shim copied to clipboard
Generated shim has an ugly icon
- Make a shim pointing to any app with icon, say Notepad:
shmake.exe -i notepad.exe -o sample.exe
- Open Explorer and check the mirrored icon of the generated shim. It looks much worse compared to the original one.
I suspect this happens because shmake doesn't copy icon groups from the input executable. According to docs, Windows chooses the most appropriate icon to display based on icon groups but not plain icon resources.
Let's inspect the resources of Notepad app:
As we see, Notepad has an icon group with ID 2 containing thirteen icons of various resolutions, including high quality ones.
Now the generated shim:
There is an icon group with ID 101 containing only three low-res icons. That's why the generated shim appears ugly in Explorer.
Where did the icon group 101 come from? It is actually a leftover from the win-shim's default "umbrella" icon. Initially it contained three umbrella icons of resolutions 32x32, 64x64 and 256x256. During the shim creation umbrella icons were overwritten by Notepad icons. Now the icon group 101 points to the first three Notepad icons of much lower resolution. It is what causes the ugly appearance.
In summary, I believe shmake should copy icon groups from the input executable (numbered 2, 300, 301 and 302 in our particular case) and also remove umbrella icon group 101 to avoid unwanted leftovers and glitches.