更新时间2022-04-03 01:44:22
就是使vb程序无法被普通的任务管理器结束任务和taskkill杀死。双程序互相保护也行,有办法吗?
。。。
你这个要hook。复杂。
你的防taskkill要hook钩子。复杂。
互相保护简单。代码:
'查找是否运行:
Public Function CheckExeIsRun(exeName) As Boolean
On Error GoTo Err
Dim WMI
Dim Obj
Dim Objs
CheckExeIsRun = False
Set WMI = GetObject("WinMgmts:")
Set Objs = ***.instancesof("Win32_Process")
For Each Obj In Objs
If (InStr(UCase(exeName), UCase(***.description)) <> 0) Then
CheckExeIsRun = True
If Not Objs Is Nothing Then Set Objs = Nothing
If Not WMI Is Nothing Then Set WMI = Nothing
Exit Function
End If
Next
If Not Objs Is Nothing Then Set Objs = Nothing
If Not WMI Is Nothing Then Set WMI = Nothing
Exit Function
Err:
If Not Objs Is Nothing Then Set Objs = Nothing
If Not WMI Is Nothing Then Set WMI = Nothing
End Function
'创建timer1
private sub timer1_timer
if checkexeisrun("工程名" & ".exe") then
else
shell"文件路径"
end if
'再创建一个文件,把对象设置为双方,一个退出,就用另一个重启。
'采纳谢谢!