Old 15th February 2014, 15:00   #1
Junior Member
Join Date: Feb 2014
Posts: 7
Question Preventing Windows restart during SILENT install

I read that an NSIS installer will prevent a Windows restart to happen while the script is running, returning FALSE to WM_QUERYENDSESSION. But I wasn't able to find what happens when the installer runs in SILENT mode.
Does anybody know certainly what happens if a reboot is launch (by external causes) while a SILENT install is running?
If the reboot isn't prevented, is there some way to get that?

Thank you.
orhuidobro is offline   Reply With Quote
Old 15th February 2014, 17:44   #2
Afrow UK
Afrow UK's Avatar
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
It will not block a reboot because there is no window to handle WM_QUERYENDSESSION. If you need to do this you can create a hidden window which handles WM_QUERYENDSESSION. It would need to be in a plug-in.

Edit: This could be a useful plug-in so I might write it at some point. Additional features could be to use the ShutdownBlockReasonCreate/ShutdownBlockReasonDestroy APIs on Windows Vista+ and to add a function to allow a shutdown/reboot (I think I already wrote a plug-in for this bit but it is very old).

Afrow UK is offline   Reply With Quote
Old 15th February 2014, 19:52   #3
Major Dude
LoRd_MuldeR's Avatar
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Not quite sure, but Console and Service applications can receive a WM_QUERYENDSESSION notification trough a handler routine registered via SetConsoleCtrlHandler(). Could it work with applications that don't actually have a console attached?

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

reboot, restart, silent, wm_queryendsession

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump