Inform running processes about pending shutdown action

Started by Magnum, November 07, 2011, 12:47:57 AM

Previous topic - Next topic

Magnum

I don't understand what the 2nd sentence means.

Function NtShutdownSystem closes system. Caller should manually inform running processes about pending shutdown action.
Have a great day,
                         Andy

qWord

Probably you must send WM_QUERYENDSESSION and WM_ENDSESSION to all processes/GUI threads (BroadcastSystemMessage).
You may stay a way from the undocumented function and use one of the System Shutdown Functions instead...
FPU in a trice: SmplMath
It's that simple!

Vortex

Quote from: qWord on November 07, 2011, 09:04:24 AM
You may stay a way from the undocumented function.

I am sorry but that's not true. What are your options to shutdown a Windows PE system running only a console window?

http://www.masm32.com/board/index.php?topic=17417.0

qWord

Quote from: Vortex on November 07, 2011, 09:39:15 AMI am sorry but that's not true.
true/false?
Quote from: Vortex on November 07, 2011, 09:39:15 AMWhat are your options to shutdown a Windows PE system running only a console window?
Undocumented functions may be necessary in such exotic environments,  but for all normal windows version there is mostly no need to use them.
FPU in a trice: SmplMath
It's that simple!

sinsi

Quote from: Vortex on November 07, 2011, 09:39:15 AMWhat are your options to shutdown a Windows PE system running only a console window?
Power button? That usually forces a shutdown.
Light travels faster than sound, that's why some people seem bright until you hear them.

Vortex

Quote from: qWord on November 07, 2011, 10:11:23 AM
Undocumented functions may be necessary in such exotic environments,  but for all normal windows version there is mostly no need to use them.

A Windows PE environment is not an exotic one. They are the main components of Windows Automated Installation Kits to deploy Windows. Just visit the http://reboot.pro forum. You will see there a lot of Win PE projects.

Vortex

Quote from: sinsi on November 07, 2011, 10:24:10 AM
Power button? That usually forces a shutdown.

The power button is the last solution when you can shutdown the system programmatically.

sinsi

Vortex, thanks for that link (and for the next few hours/days of my idle time) :U
Light travels faster than sound, that's why some people seem bright until you hear them.

Vortex

Hi sinsi,

I am sure you will enjoy the reboot forum. The MultiPE project is an interesting one as you can build a mini version of Windows PE 1.X having a size of 72 Mb which is ideal for old computers with few RAM. Booting into Windows PE is a very good option to fix crashed Windows installations and recover data.

Magnum

Qword,

The system shutdown functions are significantly slower.

Have a great day,
                         Andy

ToutEnMasm


Magnum

ToutEnMasm,

I am using it to shutdown XP.

On my system, NTShutDownSystem is about 3 times faster than ExitWindowsEx.
I make sure everything is closed before using. :-)
Have a great day,
                         Andy

qWord

Quote from: Magnum on November 07, 2011, 01:16:53 PM
Qword,

The system shutdown functions are significantly slower.


:dazzled:
This has a good reason!
FPU in a trice: SmplMath
It's that simple!

Vortex

Hi ToutEnMasm,

Thanks for the article you mentioned but I guess there is a serious mistake. The author tells that :

QuoteIn WINPE, ExitWindowsEx may do nothing, because SMSS.EXE and Winlogon.EXE isn't running.

In my Win PE, both of those executables are running but yet you need the NTShutDownSystem function to stop the system :