[BUG] Shutdown and shell-less session

Started by fixer, February 05, 2018, 11:58:36 AM

Previous topic - Next topic

fixer

Shell usually handles things like desktop, taskbar, etc. Explorer.exe is the default shell for Windows. But actually it can be some other program or no shell at all (the simplest way-explorer.exe unexpectedly crashed).

Sometimes when you try to shutdown, some programs complain they have unsaved data or something like this and prevent shutdown. Then Windows shows a window like this and that program are blocking shutdown, do you want to cancel it or forcefully stop them and shutdown.

The issue happens when you don't have a shell running (or on a different desktop with no shell) and shutdown while some program tries to block it. You'll see a window asking whether to force stutdown or to cancel it. The problem is you can't cancel it. The call goes to csrss.exe into winsrv.dll, it calls GetShellWindow API and just does nothing if returned value is NULL (no registered shell on current desktop). So clicking Cancel just does nothing, you can only force shutdown loosing all unsaved data. While this bug is not that easy to trigger, the outcome may not be a pleasant one.

P.S. This behavior is observed on Windows 7. Looks like later releases like Windows 10 being shutdown in shell-less session don't bother to show warning window at all, they just forcefully close all applications loosing all unsaved data.