LIEF icon indicating copy to clipboard operation
LIEF copied to clipboard

PE: Expose group_icon resource

Open ralphje opened this issue 7 years ago • 3 comments

Currently, LIEF has the ability to expose ICON resources, but omits GROUP_ICON resources. These resources combine multiple ICON resources. Rebuilding these is probably more useful than all separate icon files.

See https://blogs.msdn.microsoft.com/oldnewthing/20120720-00/?p=7083

ralphje avatar Feb 14 '18 05:02 ralphje

I disagree, "GROUP_ICON" are exposed here: https://github.com/lief-project/LIEF/blob/79a5d0e93be82878efdb36282798a34950bce893/src/PE/ResourcesManager.cpp#L587-L611

Feel free to re-open it.

romainthomas avatar Mar 18 '18 07:03 romainthomas

Ah, I see that there is some support for group icons. I missed that, that is also not very clear from the documentation. However, as far as I can see, there is no API to extract the entire group icon, or to add a group icon structure.

As far as I understand it, a groupicon is a resource of different icons, for instance with different resolutions. At this point, an icon is considered a separate object, that is decoupled from its group in the API. You can't extract the entire .ico file that is present in the PE file, you can only extract a single icon with a generic header.

I would expect some structure like this:

ResourcesManager -> GroupIcon -> Icon

Where the GroupIcon resource also has a save option, that saves the .ico file with all different icons in it, and the Icon may still be accessible through the current means. But this way, you can also add new GroupIcon structures if needed.

Perhaps I'm still mistaken, but perhaps this makes my point more clear.

@romainthomas I'm unable to re-open this issue, but this highlight should be enough to get your attention.

ralphje avatar Mar 18 '18 09:03 ralphje

Ok I see. From my point of view it's not a priority as you can save the icons by iterating on the icons attribute. For the modification part, It would be nice but I'm focused on the Mach-O modification at this moment.

Feel free you contribute :)

romainthomas avatar Mar 18 '18 10:03 romainthomas