Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ugly icon of the generated shim #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kodemeister
Copy link

@kodemeister kodemeister commented Aug 30, 2023

This PR fixes #12. Basically it makes two small changes:

  1. Copy icon groups from the input executable in addition to ordinary icons:
raw_copy(other, RT_GROUP_ICON);
  1. Remove the default umbrella icon from the shim project. This avoids weird leftovers or mixups of umbrella icon group with those copied from the input executable.

@mnivet
Copy link
Contributor

mnivet commented Oct 11, 2023

I’ve tried to merge this PR into my personal branch, but it fails on some executables.

At least on "notepad++", I got the following error message:

configuring startup sequence... Failed to Committing resource. Code: 13, message: "invalid data.

I supposed it’s because "notepad++" has a lot of icons and that cause troubles like discussed here : https://archives.miloush.net/michkap/archive/2008/08/21/8883552.html

I’ve no more time to invest right now on that issue, but at least my findings are now shared and written here.

@kodemeister
Copy link
Author

@mnivet Oops, I've also managed to reproduce this issue on notepad++.exe. The link you posted seems to be correct. EndUpdateResource indeed fails if the size of .rsrc section of the shim executable is not enough to hold all mirrored icons. Only the total number of mirrored icons counts towards this limit, not their actual size.

In this branch I removed the default "umbrella" icon. As a result, the size of a resource section became only 4 Kb. This works well for many applications with several dozens of icons. However, it's too small for Notepad++ which has hundreds of icons.

In master branch the shim executable still contains the umbrella icon. This adds roughly 40 Kb to the resource section and makes it possible to hold all icons from Notepad++ (and virtually any other app with a lot of icons).

As a quick workaround, I would suggest to use the code from master branch and simply add raw_copy(other, RT_GROUP_ICON); to resources::replace_icon until I come up to better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generated shim has an ugly icon
2 participants