Change of System Power states from Driver level?

Hi All,

I am looking for a way to do System Restart by triggering it from Kernel Level(Preferably in Network Stack).
For eg. on Receiving certain packets from the network, I wanted to trigger a system restart.

But After reading it from MSDN documentation, I don’t see any way to trigger Power manager from Kernel level for system restart or shutdown.

Am I missing something, Is there any method or Hook available to trigger the same?

Thanks Inadvance,
Muthu

There is no kernel api to initiate a shutdown. Instead, you can have a user mode service which communicates with your driver. The service can initiate the shutdown. If that is all the service is used for, that is rather expensive solution for a single feature, not to mention a vector to attack the machine from over the network.

if you really want to cause a restart from KM, it is easy

void* pVal;

pVal = NULL
*pVal = 123;

this is far from gracefull however. As Doron points out the kernel is meant to SERVE and is designed to obay the instructions from UM. it is not meant to command and it certianly should not do that based on a remote input (a certian packet from the network)

Thank you for the response. I am able to reset using ACPI’s FADT->Reset_Register method in Driver level.
This whole experiment is for some internal testing not to release it to any customers.

I am able to reset using ACPI’s FADT->Reset_Register method in Driver level.

Looks like really bad idea to me. Equivallent to pressing reset button i.e. no gracefull shutdown with all consequences.

There is no kernel api to initiate a shutdown.

ZwShutdownSystem() isnt’ available anymore?

AFAIK, ZwShutdownSystem is called as a part of the sequence of shutdown step , it does not initiate the whole shutdown sequence