I found this on a batch file group and it does work considerably faster than using ExitWindowsEx,EWX_SHUTDOWN or EWX_FORCE,1.

Is there a way to have the program simulate the Ctrl key and see if it can achieve the same fast shutdown?

Thanks.


I recently read elsewhere of this very fast XP shutdown method:

in Task Manager select "Shut Down", hold down Ctrl key, click "Turn
Off".

The machine will shut down in about 3 seconds.

Can this be implemented in a command line sequence or batch file?

No problem starting Task Manager via a batch of course, but how to
then issue the "Shut Down / Control / Turn Off" sequence?

Thanks for your help.

link:
http://www.techgodown.com/how-to-shut-down-your-windows-xp-really-fast/
Posted on 2009-10-16 09:40:51 by skywalker
Sure, if you call NtShutdownSystem(2) from ntdll. Note, you need to enable SE_SHUTDOWN_NAME privilege before calling this function. The '2' parameter is for ShutdownPowerOff:
enum SHUTDOWN_ACTION {
    ShutdownNoReboot = 0,
    ShutdownReboot,
    ShutdownPowerOff
};
Posted on 2009-10-16 13:04:12 by sapero
I tried this, but it said "syntax error.

invoke NtShutDownSystem(2),

Attachments:
Posted on 2009-10-16 15:57:12 by skywalker
invoke NtShutDownSystem, 2

To call it directly, you need to link with ntdll.lib (use includelib). If you do not have ntdll.lib, use
.data
szNtdll: db "ntdll.dll",0
szNtShutDownSystem: db "NtShutDownSystem",0

.code
invoke GetModuleHandle, offset szNtdll
and eax,eax
jz error
invoke GetProcAddress, eax, offset szNtShutDownSystem
push 2
call eax
Posted on 2009-10-16 17:33:08 by sapero
Thanks.

Andy
Posted on 2009-10-17 08:57:27 by skywalker

Sure, if you call NtShutdownSystem(2) from ntdll. Note, you need to enable SE_SHUTDOWN_NAME privilege before calling this function. The '2' parameter is for ShutdownPowerOff:
enum SHUTDOWN_ACTION {
    ShutdownNoReboot = 0,
    ShutdownReboot,
    ShutdownPowerOff
};



Where in my code would I put this enum?

Thanks.
Posted on 2010-04-16 12:59:31 by skywalker
I guess you should read about what enums are.
Posted on 2010-04-16 13:37:41 by ti_mo_n

I guess you should read about what enums are.


From what I read, I would make the enums as equates starting with 1.

I did so, but the compiler still can't recognize NtShutDownSystem.

Andy
Posted on 2010-04-16 13:50:56 by skywalker
You mean NtShutdownSystem?
Posted on 2010-04-16 15:58:14 by SpooK
I looked thru IDA asm file and was able to reconstructed it.

push 2
call NtShutdownSystem
push 0
Posted on 2010-04-16 20:04:12 by skywalker