Disable shutdown confirmation



Jared Holzman
07-09-2005, 10:25 PM
Hey All,

I've got a headless embedded device running XPE SP1 and am using the
ACPI Power Button to shutdown the device cleanly when I want it to turn
off. I'm also using Remote Desktop to administer the device, but I've
discovered after I've logger in via Remote Desktop, the power button no
longer appears to shutdown the device. After plugging in a monitor, I've
discovered the reason is that after an RDP login the following dialog
appears on pressing of the power button:

"Other people are logged on to this computer. Shutting down Windows
might cause them to lose data.

Do you want to continue shutting down?"

How do I disable this confirmation?

TIA,
Jared

Slobodan Brcin \(eMVP\)
07-09-2005, 10:25 PM
Jared,

If you are using headless device, have you read and implemented message box interception?

Read this and follow link on the page:
http://msdn.microsoft.com/embedded/community/community/tips/xp/popups/default.aspx

Regards,
Slobodan


"Jared Holzman" <jhz@unknown.net> wrote in message news:429C141C.C3F6F867@unknown.net...
> Hey All,
>
> I've got a headless embedded device running XPE SP1 and am using the
> ACPI Power Button to shutdown the device cleanly when I want it to turn
> off. I'm also using Remote Desktop to administer the device, but I've
> discovered after I've logger in via Remote Desktop, the power button no
> longer appears to shutdown the device. After plugging in a monitor, I've
> discovered the reason is that after an RDP login the following dialog
> appears on pressing of the power button:
>
> "Other people are logged on to this computer. Shutting down Windows
> might cause them to lose data.
>
> Do you want to continue shutting down?"
>
> How do I disable this confirmation?
>
> TIA,
> Jared
>

Jared
07-09-2005, 10:26 PM
Slobodan,

Thanks! That EnableDefault Response setting solved the problem nicely, now perhaps you can
help me with another one.

My program uses SetConsoleCtrlHandler so it can be notified when the power button is pressed
and clean itself up before the shutdown occurs. Unfortunately this only seems to work some
of the time. Sometimes pushing the power button causes the program to get killed immediately
without notification. This causes a problem as my program uses the watchdog on the CPU card
and this will fire before windows finsihes shutting down resulting in the device resetting
and restarting rather then shutting down as intended. The call to setconsolectrlhandler does
not fail as this would be logged at the console so I'm not sure why the notification doesn't
always work. I am using winlogon and the explorer shell and am starting my program from the
HKLM\Software\Microsoft\Windows\CurrentVersion\Run key.

It usually seems to fail following a system reset rather than a shutdown, of course this
then causes the system to reset the next time resulting in a self perpepuating condition.
I have found that if I beleive this condition has occured and I manually restart the program
from the local console then it will behave correctly. Of course I'm never sure if the
condition has occured until I push the power button and observe what happens, so it could
just be coincidence.

TIA,
Jared

"Slobodan Brcin (eMVP)" wrote:

> Jared,
>
> If you are using headless device, have you read and implemented message box interception?
>
> Read this and follow link on the page:
> http://msdn.microsoft.com/embedded/community/community/tips/xp/popups/default.aspx
>
> Regards,
> Slobodan
>
> "Jared Holzman" <jhz@unknown.net> wrote in message news:429C141C.C3F6F867@unknown.net...
> > Hey All,
> >
> > I've got a headless embedded device running XPE SP1 and am using the
> > ACPI Power Button to shutdown the device cleanly when I want it to turn
> > off. I'm also using Remote Desktop to administer the device, but I've
> > discovered after I've logger in via Remote Desktop, the power button no
> > longer appears to shutdown the device. After plugging in a monitor, I've
> > discovered the reason is that after an RDP login the following dialog
> > appears on pressing of the power button:
> >
> > "Other people are logged on to this computer. Shutting down Windows
> > might cause them to lose data.
> >
> > Do you want to continue shutting down?"
> >
> > How do I disable this confirmation?
> >
> > TIA,
> > Jared
> >

KM
07-09-2005, 10:26 PM
Jared,

Do you process CTRL_SHUTDOWN_EVENT in your own HandlerRoutine?
Actually, accroding to SDK (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/handlerroutine.asp) this
signal is intended to be received only by services. Interactive applications are terminated at logoff, so they are not present when
the system sends this signal. I guess if you make a service that installs its own HandlerRoutine, it should work stable.

You can also try and lower the shutdown range for your current app with SetProcessShutdownParameters API so it get time to process
that signal. (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/setprocessshutdownparameters.asp)

KM

> My program uses SetConsoleCtrlHandler so it can be notified when the power button is pressed
> and clean itself up before the shutdown occurs. Unfortunately this only seems to work some
> of the time. Sometimes pushing the power button causes the program to get killed immediately
> without notification. This causes a problem as my program uses the watchdog on the CPU card
> and this will fire before windows finsihes shutting down resulting in the device resetting
> and restarting rather then shutting down as intended. The call to setconsolectrlhandler does
> not fail as this would be logged at the console so I'm not sure why the notification doesn't
> always work. I am using winlogon and the explorer shell and am starting my program from the
> HKLM\Software\Microsoft\Windows\CurrentVersion\Run key.
>
> It usually seems to fail following a system reset rather than a shutdown, of course this
> then causes the system to reset the next time resulting in a self perpepuating condition.
> I have found that if I beleive this condition has occured and I manually restart the program
> from the local console then it will behave correctly. Of course I'm never sure if the
> condition has occured until I push the power button and observe what happens, so it could
> just be coincidence.

KM

> "Slobodan Brcin (eMVP)" wrote:
>
>> Jared,
>>
>> If you are using headless device, have you read and implemented message box interception?
>>
>> Read this and follow link on the page:
>> http://msdn.microsoft.com/embedded/community/community/tips/xp/popups/default.aspx
>>
>> Regards,
>> Slobodan
>>
>> "Jared Holzman" <jhz@unknown.net> wrote in message news:429C141C.C3F6F867@unknown.net...
>> > Hey All,
>> >
>> > I've got a headless embedded device running XPE SP1 and am using the
>> > ACPI Power Button to shutdown the device cleanly when I want it to turn
>> > off. I'm also using Remote Desktop to administer the device, but I've
>> > discovered after I've logger in via Remote Desktop, the power button no
>> > longer appears to shutdown the device. After plugging in a monitor, I've
>> > discovered the reason is that after an RDP login the following dialog
>> > appears on pressing of the power button:
>> >
>> > "Other people are logged on to this computer. Shutting down Windows
>> > might cause them to lose data.
>> >
>> > Do you want to continue shutting down?"
>> >
>> > How do I disable this confirmation?
>> >
>> > TIA,
>> > Jared
>> >
>


Disable shutdown confirmation