之前试过挂起winlogon进程来阻止关机
不过有时候可以有时不可以
甚至试过导致系统崩溃
不是很稳定
有兴趣的可以自行测试一下$process='winlogon.exe'
_ProcessSuspend($process)
MsgBox('','','已经挂起'&$process&@CRLF&'10秒之内无法关机!')
Sleep(10000)
_ProcessResume($process)
MsgBox('','','已经恢复'&$process&@CRLF&'又可以关机了!')
Func _ProcessSuspend($process)
$processid = ProcessExists($process)
If $processid Then
$ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid)
$i_sucess = DllCall("ntdll.dll","int","NtSuspendProcess","int",$ai_Handle[0])
DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle)
If IsArray($i_sucess) Then
Return 1
Else
SetError(1)
Return 0
Endif
Else
SetError(2)
Return 0
Endif
EndFunc
Func _ProcessResume($process)
$processid = ProcessExists($process)
If $processid Then
$ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid)
$i_sucess = DllCall("ntdll.dll","int","NtResumeProcess","int",$ai_Handle[0])
DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle)
If IsArray($i_sucess) Then
Return 1
Else
SetError(1)
Return 0
Endif
Else
SetError(2)
Return 0
Endif
EndFunc
|