OnAutoItExitRegister("ItExit")
While 1
WEnd
Func ItExit()
If @exitMethod = 3 Then
_WinAPI_NtShutdownSystem(1) ;检测到注销,执行快速重启.
EndIf
If @exitMethod = 4 Then
_WinAPI_NtShutdownSystem(2) ;检测到关机,执行闪电关机.
EndIf
EndFunc ;==>ItExit
Func _WinAPI_NtShutdownSystem($flags = 2) ;1快速重启,2快速关机
DllCall("ntdll.dll", "int", "RtlAdjustPrivilege", "long", 0x13, "int", True, "int", False, "ptr", DllStructGetPtr(DllStructCreate("int 0")))
DllCall("ntdll.dll", "int", "NtShutdownSystem", "int", $flags)
EndFunc ;==>_WinAPI_NtShutdownSystem
|