Skip to content

win: give the executable an icon and a version block - #30

Merged
vstrelnikof merged 1 commit into
mainfrom
fix/windows-app-icon
Aug 15, 2026
Merged

win: give the executable an icon and a version block#30
vstrelnikof merged 1 commit into
mainfrom
fix/windows-app-icon

Conversation

@vstrelnikof

Copy link
Copy Markdown
Member

What was wrong

Installed from the MSI, PolterType sits in the Start menu wearing the
shell's placeholder. Measured on the installed binary:

icon groups in installed exe: 0
FileVersion  = []
ProductName  = []
Shortcut icon = [,0]

Zero icon resources, no VERSIONINFO at all, and a shortcut whose
IconLocation is ,0 — "ask the target file". The target had nothing
to give.

The only icon we ever produced was the installer's, and
ARPPRODUCTICON reaches 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-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 WiX
template 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 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. 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-ico
rasterises every size from the vector mark instead of box-filtering one
1024 px master.

Verified on real Windows, through the shell's own APIs

Check Before After
ExtractIconEx(exe, -1) 0 icon groups 1
VersionInfo.ProductName empty PolterType
GDI+ new Icon(ico, N, N) all six sizes load at their exact size
SHGetFileInfo on an MSI-style shortcut placeholder draws the mark
Settings window WM_GETICON 0 a 64 px copy

The .ico is 113 KB: 16/32/48/64/128 as DIBs, 256 PNG-compressed.

Notes for review

  • The build script tests CARGO_CFG_TARGET_OS, not cfg! — a build
    script runs on the machine doing the building, and the question is
    about the machine that will run the binary. That also keeps
    poltertype-app at zero #[cfg(target_os)].
  • ico/tests.rs reads the container back the way Windows does. A
    wrong offset table produces a file that parses and that the shell
    silently declines to draw, which is indistinguishable from the bug
    being fixed.
  • cargo deny is not installed on the machine this was written on, so
    the new dependencies' licences were checked by hand against
    deny.toml: winresource MIT, toml/serde_spanned/toml_writer
    MIT OR Apache-2.0.

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.
@vstrelnikof
vstrelnikof merged commit dab97db into main Aug 15, 2026
4 checks passed
@vstrelnikof
vstrelnikof deleted the fix/windows-app-icon branch August 15, 2026 21:08
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.

1 participant