Bug 7970 - Client icon isn't changed on upgrade on Windows
Summary: Client icon isn't changed on upgrade on Windows
Status: NEW
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Client platforms (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: LowPrio
Assignee: Bugzilla mail exporter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-15 14:06 CEST by Pierre Ossman
Modified: 2022-08-16 12:40 CEST (History)
0 users

See Also:
Acceptance Criteria:
* Start menu icon is updated automatically on install * Task bar icon is updated automatically on install * Any other shortcut icons are updated automatically on install


Attachments

Description Pierre Ossman cendio 2022-07-15 14:06:48 CEST
(moved off bug 7918)

== Pierre Ossman cendio 2022-05-05 10:27:32 CEST ==

Note that it seems Windows has some caching of icons. When installing a client with the new logo, the launcher on the task bar still retains the old icon.

Perhaps we can call something in the installer that flushes this cache?


==  Pierre Ossman cendio 2022-07-15 08:26:45 CEST ==

(In reply to Pierre Ossman from comment #1)
> Note that it seems Windows has some caching of icons. When installing a
> client with the new logo, the launcher on the task bar still retains the old
> icon.
> 
> Perhaps we can call something in the installer that flushes this cache?

I found this:

> Applications that register new handlers of any type must call SHChangeNotify
> with the SHCNE_ASSOCCHANGED flag to instruct the Shell to invalidate the icon
> and thumbnail cache. This will also load new icon and thumbnail handlers that
> have been registered. Note, however, that icon overlay handlers are not
> reloaded.

https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shchangenotify

However, we already call this function from the installer. So something isn't working. We do have this note, though:

> ; Refresh the shell. Note: MSDN says that SHCNF_IDLIST must be specified,
> but the NSIS example does not. 

That comment isn't true any more, as NSIS has updated their example:

https://nsis.sourceforge.io/Refresh_shell_icons


== Pierre Ossman cendio 2022-07-15 09:42:15 CEST ==

Hmm... Odd. I can't reproduce this on the Windows 10 laptop. But I can reproduce it on the Windows 10 desktop in the lab.

One theory is that this has to do with a 32-/64-bit mismatch. Our installer is always 32-bit, and the laptop is 32-bit, whilst the desktop is 64-bit.
Comment 1 Pierre Ossman cendio 2022-07-15 14:12:37 CEST
More digging:

* Windows 11 is also broken, so this is not just a Windows 10 issue

* Using SHCNF_IDLIST doesn't seem to have any effect, anywhere

* The start menu entry seems to update properly, so it's the task bar and other shortcuts that are the issue

* All icons blink at the end of the installation, indicating that something is getting refreshed

* Running "ie4uinit -show" fixes the issue on Windows 10, but does nothing on Windows 11, not even a blink of icons

* Creating a small C program that calls SHChangeNotify() with SHCNE_ASSOCCHANGED fixes other shortcuts on Windows 11, but not the taskbar icon

* Running the above in 32-bit or 64-bit doesn't matter, it works either way, making it very mysterious why NSIS fails when doing the same call

Note You need to log in before you can comment on or make changes to this bug.