From: Alexander Grigoriev on
" for example, from another login session, by a virtual
> machine manager, remotely via WMI, and so on."

This is solved by a corresponding security policy. Because you are
controlling a special hardware, it's not unreasonable to lock the machine up
and cut off all other possible sources of shutdown. Essentially, it's a
kiosk. You only want to shutdown it on your own conditions, nobody else's.

"Brian Knittel" <briknit(a)newsgroup.nospam> wrote in message
news:%23qV8AJsPKHA.1372(a)TK2MSFTNGP02.phx.gbl...
>> Make your application the only app in the login session (specify it as a
>> shell), so there's no possibility to issue a shutdown other than by your
>> program's only means.
>
> Unfortunately, this won't help. Shutdown can be invoked other than from
> this session's Start menu: for example, from another login session, by a
> virtual machine manager, remotely via WMI, and so on.
>
> And, I don't really want to prevent shutdowns. I want to postpone shutting
> down while the hardware under control is still busy, and failing that, at
> least avoid having the application terminated _without notice_ during an
> intended shutdown.
>
> What I am doing now is to set a timer a couple of seconds short of
> HungAppTimeout, and permit the shutdown to proceed if that much time
> elapses, so I can shut shut down gracefully -- if reluctantly -- rather
> than be terminated. But, it would be better to know if I was NOT going to
> be terminated, so I woudn't have to bail out at all, until the hardware is
> ready.
>
> That is what I asked in my post: How can you configure Windows not to
> force termination? Or failing that, how can you tell if a shutdown is
> going to end in forced termination? And is there some _accurate_
> documentation about these details somewhere?
>
>
>
>
>
>
>


From: Pavel A. on
"Brian Knittel" <briknit(a)newsgroup.nospam> wrote in message
news:#BwcHfsPKHA.2092(a)TK2MSFTNGP04.phx.gbl...

> MS, is there anyone there with responsibility for this part of Windows
> Server who knows the answer to this?

Yes, but they don't read this newsgroup. They are the Product support.
If you have MSDN subscription, it usually comes with a certain number
of prepaid support incidents that you can use to solve such issues.

Good luck.
-- pa


From: Remy Lebeau on

"Brian Knittel" <briknit(a)newsgroup.nospam> wrote in message
news:%23BwcHfsPKHA.2092(a)TK2MSFTNGP04.phx.gbl...

> Microsoft's writeup comparing shutdown in Vista to XP
> (http://msdn.microsoft.com/en-us/library/ms700677(VS.85).aspx)
> mentions a flag named ENDSESSION_FORCEFULSHUTDOWN
> passed in WM_QUERYENDSESSION, but there is no flag with
> this name defined in the Windoww SDK.

Are you using an up-to-date Platform SDK?

> (And this is just one of the finer details. There are a whole raft of
> web pages and blogs out there covering shutdown messages that
> have even the basic details wrong.

Such as? Shutdown behavior does differ from version to version.

> Even the aforementioned Microsoft writeup
> http://msdn.microsoft.com/en-us/library/ms700677(VS.85).aspx gets
> it wrong in two places, including this incorrect statement: "Shutdown
> then continues, as Windows sends WM_QUERYENDSESSION and
> WM_ENDSESSION to the remaining running applications in turn.")

That is correct behavior in XP, which the paragraph that statement appears
in is describing. Besides, you are taking that statement out of context
anyway. It is saying that shutdown continues after an app has replied TRUE
to WM_QUERYENDSESSION and has recieved WM_ENDSESSION.

> The "forced shutdown" mode is known by the process that is
> supervising shutdown. It can't be queried by applications? There
> is no API access to this information?

Nope, none.

--
Remy Lebeau (TeamB)


From: Remy Lebeau on

"Alexander Grigoriev" <alegr(a)earthlink.net> wrote in message
news:e$KjNjkPKHA.1268(a)TK2MSFTNGP04.phx.gbl...

> Make your application the only app in the login session (specify it as
> a shell), so there's no possibility to issue a shutdown other than by
> your program's only means.

The OS runs the shell as a user-mode application, and thus is subject to the
same shutdown rules as other user-mode applications. MSDN says as much.
The actual shutdown is managed at a lower level.

--
Remy Lebeau (TeamB)


From: Remy Lebeau on

"Brian Knittel" <briknit(a)newsgroup.nospam> wrote in message
news:%23qV8AJsPKHA.1372(a)TK2MSFTNGP02.phx.gbl...

> And, I don't really want to prevent shutdowns. I want to postpone
> shutting down while the hardware under control is still busy

For XP and earlier, you can simply delay responding to WM_QUERYENDSESSION
until the hardware is ready.

On Vista and later, you should use the new ShutdownBlockReasonCreate()
function, and return FALSE to WM_QUERYENDSESSION without delay.

The article you mentioned earlier
(http://msdn.microsoft.com/en-us/library/ms700677.aspx) describes proper
shutdown blocking procedures for Vista and later.

> and failing that, at least avoid having the application terminated
> _without
> notice_ during an intended shutdown.

Once shutdown has been successfully initiated, it cannot be stopped by apps.
Vista and later make sure of that, and WILL force termination without notice
(hense the term "force") when needed. The article above describes that as
well.

> How can you configure Windows not to force termination?

AFAIK, you can't. The documentation is quite clear that termination is a
very important part of shutdown operations, and will be honored.

> Or failing that, how can you tell if a shutdown is going to end in
> forced termination?

You cannot determine that before it actually happens.

--
Remy Lebeau (TeamB)