Solved: Lenovo Power Manager (PWMUI.EXE) Slow-Start Workaround

Owning a Lenovo/IBM computer, meaning usually having to deal with Lenovo’s quirky products,
and badly-designed/badly-programmed UI/core components. It’s a fact, so don’t bitch about it!

The semi-working workaround is to do a “warm-up”,
i. e. – starting "C:\Program Files (x86)\ThinkPad\Utilities\PWMUI.EXE" (as admin..)
and quickly force-closing it using task-manager, followed by quickly (needs to be less than 20 seconds later) restarting the PWMUI.EXE application again, and this time it will load-up in few seconds.

The cause is (…probably) for the shittiness of Lenovo’s power manager (PWMUI.exe) UI is that it was written using a very old .Net framework some of the shittiest code-library known to human race called Presentation Foundation, this code swap so many hands that older versions (2.0/3.0 -which PWMUI uses), got broken by newer versions, specifically – the resource-loading management, essentially switching from a proactive attitude to a “on-demand/on-the-fly” way, that requires getting an event signaling *stuff*… old code is getting into a “blocking mode”, and waits (A LOT!) before falling back to legacy back-end which load the resources the way versions 2.0/3.0 used to..
Also, when closed, the application *Presentation Foundation will unload the resources, so you’ll need to repeat the workaround each time you’ll want to run the power-manager application.


I’ve reversed-engineered the source of the power-manager application
which is quite and easy feat, due to the fact was written practically with minimal code, using the Presentation Foundation template of .Net.
It was probably written as a Visual-Basic.Net, I’ve converted it to C# which is nicer ;)
and the source (if you wish to help debug it, or even compile it using a more recent version of .Net, which will surely clear some issues) is available here: https://github.com/eladkarako/lenovo-pm-ui/.


Update:

The source “tells” that resource loading is delegated through Windows Presentation Foundation,
with its very buggy component named Windows Presentation Foundation Font Cache 3.0.0.0, running as a system-service.

So, the solution for the slowness, at-least partially –
– run font_cache_refresh.cmd from manually-removing-fonts-from-windows-and-refreshing-the-windows-font-cache-storage-file/
then open CMD as admin and paste-down the following command: sc config "FontCache3.0.0.0" start=disabled to make sure that if there is a service in that name, it is disabled.


Update:

avoiding Windows file/reg virtualization should speed up the process-start,
using a side-by-side manifest for PWMUI.EXE and a registry-fix to prefer a side-by-side manifest over internal resource.

It seems to do the trick,
in-fact it worked so well,
I’ve added manifest-files for all of the executes.


Enjoy!