win: give the executable an icon and a version block - #30
Merged
Conversation
Installed from the MSI, PolterType sat in the Start menu wearing the shell's placeholder. Measured on the installed binary: zero icon resources and no VERSIONINFO at all. The only icon we ever produced was the installer's, and ARPPRODUCTICON reaches one screen — Add/Remove Programs. The Start-menu shortcut is authored non-advertised with an empty IconLocation, meaning "ask the target file", and the target had nothing to give; Explorer, Alt-Tab, the taskbar and every pinned entry were in the same position. The Settings window had no icon of its own either. poltertype-app gains a build script that renders an .ico into OUT_DIR and hands it to rc.exe via winresource, together with a VERSIONINFO block naming the product rather than the crate. The shortcut inherits it with no change to the WiX template — the fix is upstream of the installer. The mark is rendered, not checked in: the geometry moves out of xtask into a new poltertype-icon crate so the build script, the installers and the Settings window all draw from one source and cannot drift. Release CI drops ImageMagick with it — every size now comes off the vector mark instead of a box filter over one 1024 px master. Verified on this machine through the shell's own APIs: ExtractIconEx reports one icon group where it reported none, GDI+ loads all six sizes, SHGetFileInfo draws the mark for a shortcut authored exactly like the MSI's, and the Settings window answers WM_GETICON with a 64 px copy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
Installed from the MSI, PolterType sits in the Start menu wearing the
shell's placeholder. Measured on the installed binary:
Zero icon resources, no
VERSIONINFOat all, and a shortcut whoseIconLocationis,0— "ask the target file". The target had nothingto give.
The only icon we ever produced was the installer's, and
ARPPRODUCTICONreaches exactly one screen: Add/Remove Programs.Explorer, Alt-Tab, the taskbar and every pinned entry were in the same
position, and the Settings window had no icon of its own either.
What this does
poltertype-appgains a build script that renders an.icointoOUT_DIRand hands it torc.exeviawinresource, together with aVERSIONINFOblock naming the product rather than the crate. The WiXtemplate is untouched — the shortcut inherits the icon because the
fix is upstream of the installer.
The mark is rendered, not checked in. The geometry moves out of
xtaskinto a new
poltertype-iconcrate, so the build script, the installersand the Settings window all draw from one source and cannot drift. It is
a build-dependency of the app; nothing in it is linked into the shipped
binary except the 64 px window icon.
Release CI drops ImageMagick with it:
cargo xtask assets icon-icorasterises every size from the vector mark instead of box-filtering one
1024 px master.
Verified on real Windows, through the shell's own APIs
ExtractIconEx(exe, -1)VersionInfo.ProductNamePolterTypenew Icon(ico, N, N)SHGetFileInfoon an MSI-style shortcutWM_GETICONThe
.icois 113 KB: 16/32/48/64/128 as DIBs, 256 PNG-compressed.Notes for review
CARGO_CFG_TARGET_OS, notcfg!— a buildscript runs on the machine doing the building, and the question is
about the machine that will run the binary. That also keeps
poltertype-appat zero#[cfg(target_os)].ico/tests.rsreads the container back the way Windows does. Awrong offset table produces a file that parses and that the shell
silently declines to draw, which is indistinguishable from the bug
being fixed.
cargo denyis not installed on the machine this was written on, sothe new dependencies' licences were checked by hand against
deny.toml:winresourceMIT,toml/serde_spanned/toml_writerMIT OR Apache-2.0.