Win "Power off system" - what method is used?
#1
Question 
Since upgrading my various Kodi HTPCs from Windows 8.1 to Windows 10 I've noticed that OS updates coming down through Automatic Updates are not installing in my day-to-day usage.

I'm still using Kodi 14.2 due to being a little gun shy after all the issues through 15.0, 15.1, until we got 15.2 which seems (from most reports) to have finally ironed out the major kinks. I will update sometime (or maybe just wait for 16.x with the DX11 support) but have put it off as I have 3 devices to update that use a shared MySQL database and if I have to troubleshoot or rollback, don't need grief from the family as they are 'down' through this process Smile

Anyway..

I treat my HTPCs like Kodi 'appliances';
1. Power On
2. They autologin a local user account
3. They launch Kodi (just called from Startup folder link)
4. I watch content
5. When finished, I select "Power off System" from Kodi's power button menu

Under Windows 7 and 8.1, updates downloaded in the background would install (as best as I can recall) and be applied through the above routines.
Under Windows 10. I'm finding security updates stay 'queued' in a pending update state until I exit Kodi, and then either
  1. From the Windows 10 Start Menu -> Menu -> select Update and Shut Down
  2. From Windows 10 -> Settings -> Update & Security -> Windows Update -> see the pending update and click Restart

Is there a different method/API call that needs to be used with Windows 10 so that if there are pending updates ready to install, that when Kodi is exited via "Power off System" the updates are applied then Windows shut down?

I haven't looked at the Kodi source code to check and I'm not a developer so please excuse what may be dumb suggestions, but if "Power off System" is simply calling ExitWindowsEx() API function, then changing this to InitiateShutdown and including the SHUTDOWN_INSTALL_UPDATES flag would possibly resolve this issue. InitiateShutdown is supported on Vista and higher whereas ExitWindowsEx was from XP era and doesn't support any flags to apply pending updates.

I also appreciate the inconsistency of my assumption that pending updates were installing under Win7/8 as ExitWindowsEx wouldn't've allowed this...
Kodi 17.6 on multiple Windows 10 x64 machines with shared MySQL 5.6.43 database. Kodi 18 on Xbox One. Content (music, video, photos) stored on Windows Server 2012 R2 file server and accessed by SMB.
Reply
#2
I just let Window 10 auto-install and auto-reboot the updates when it wants to. KODI 15.2 is running constantly on the PC for me, and some days I know I'll wake the PC up to find the login screen after a reboot. If I had set the computer for auto-login I don't think I'd ever see that logon screen.

So I basically do things opposite to you... I let Windows close down KODI when it wants to reboot after an update.
Reply
#3
Yep, completely understand your perspective.
I personally prefer shutting down my Kodi HTPCs rather than letting them sleep/wake due to:
1. One of my systems connected to an AV receiver generally loses video sync when waking from sleep so I then have to go through the additional steps of turning my receiver off then on and even then, Kodi can sometimes be a little flaky so I reboot the system for good measure before using in this situation.
2. The speed of startup from power off with Win10 on my dedicated HTPCs is perfectly acceptable to me. Yes, it would be faster from sleep, but I still have point 1. above.
3. An off PC consumes less power than a sleeping PC

Either way, if Kodi were to use the API call and flags I mentioned, then everyone wins Smile
Kodi 17.6 on multiple Windows 10 x64 machines with shared MySQL 5.6.43 database. Kodi 18 on Xbox One. Content (music, video, photos) stored on Windows Server 2012 R2 file server and accessed by SMB.
Reply
#4
On a side note, there is a cheat I've used for fussy AV receivers before. Get one of these and put it in between HTPC and AV amp. http://www.amazon.co.uk/gp/product/B0020426AG I've used those to "smooth out" bugs between PVRs, AV Amps and TVs. Especially when older kit is connected to something new talking a subtly different HDMI.


Have you tried looking into the KODI source code yourself? It is there to be accessed meaning you could put in the change yourself. (Not that I've ever tried...). Sounds like a sensible fix to me.
Reply
#5
Kodi uses InitiateShutdown since Helix with SHUTDOWN_INSTALL_UPDATES flag, so it should work...
https://github.com/xbmc/xbmc/blob/master...32Util.cpp
Reply
#6
Isn't win10 only installing updates on restart and not on shutdown? At least that's what I noticed
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply

Logout Mark Read Team Forum Stats Members Help
"Power off system" - what method is used?0