-2

I really enjoy one of the windows computer hibernate benefits:

I can power up the computer by pressing any key or mouse button.

I wish I can shutdown my computer into hibernate state. I mean, software OS is completely off, but hardware goes to hibernate level (I think it is S4). So I don't need to bend over to press the "hard-to-reach" power button on the PC case every time I want to turn on the computer.

Is there anyway programmly I can do that?

Already tried:

DllCall("ntdll.dll", "dword", "NtSetSystemPowerState", "dword", X, "dword", X, "ulong", 0x80000000)

Multiple power state values tested using the correct privilege, they either shutdown my pc or do-nothing. I can't programmly put my pc into S3 or S4 power state.

Edit: Many don't even read the question right.

I don't want to "hibernate" the PC (which can be done easily)

I am looking for a way to set the motherboard into a "hibernate state" , while the OS is completely offloaded.

Kyle Chen
  • 1
  • 1
  • An imperfect method I can do this is: I hibernate the PC normally, then I destroy the "hiberfil.sys" file on the disk. In this way, the Hardware stays in hibernate mode, and once it wakes up by pressing the keyboard, OS will restart (because the hiberfile is missing) – Kyle Chen Jul 04 '20 at 13:24

2 Answers2

0
#include <stdlib.h>

int main()
{
    system("SHUTDOWN /H");
}

jyl
  • 401
  • 3
  • 12
  • 1
    While this code may answer the question, providing additional context regarding why and/or how this code answers the question improves its long-term value. – β.εηοιτ.βε Jun 14 '20 at 20:50
  • This put OS and Hardware both into hibernate mode. I want the OS gets to "Shutdown" mode, while the Hardware gets to "Hibernate" mode. – Kyle Chen Jul 04 '20 at 13:17
0

SetSuspendState is the API to put the system into hibernate and well documented on MSDN.