;- Author : n0way
;- Name of the project : Process Suspender
;- Date : 24/12/12 (what a shame to code this day)
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiComboBox.au3>
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
Global $Form1 = GUICreate("Process Suspender ", 578, 123, 192, 124)
GUISetIcon("\icone\devico.ico")
Global $Label1 = GUICtrlCreateLabel("Process Name : ", 6, 18, 99, 18)
GUICtrlSetFont(-1, 9, 800, 0, "Tahoma")
Global $Combo1 = GUICtrlCreateCombo("", 106, 16, 193, 25)
Global $Button1 = GUICtrlCreateButton("Suspend", 312, 16, 75, 25, $WS_GROUP)
Global $Button2 = GUICtrlCreateButton("Resume", 400, 16, 75, 25, $WS_GROUP)
Global $Button3 = GUICtrlCreateButton("Kill", 488, 16, 75, 25, $WS_GROUP)
Global $Label2 = GUICtrlCreateLabel("Process Name : ", 6, 82, 99, 18)
GUICtrlSetFont(-1, 9, 800, 0, "Tahoma")
Global $Combo2 = GUICtrlCreateCombo("", 106, 48, 193, 25)
Global $Button4 = GUICtrlCreateButton("Suspend", 312, 48, 75, 25, $WS_GROUP)
Global $Button5 = GUICtrlCreateButton("Resume", 400, 48, 75, 25, $WS_GROUP)
Global $Button6 = GUICtrlCreateButton("Kill", 488, 48, 75, 25, $WS_GROUP)
Global $Label3 = GUICtrlCreateLabel("Process Name : ", 6, 50, 99, 18)
GUICtrlSetFont(-1, 9, 800, 0, "Tahoma")
Global $Combo3 = GUICtrlCreateCombo("", 106, 80, 193, 25)
Global $Button7 = GUICtrlCreateButton("Suspend", 312, 80, 75, 25, $WS_GROUP)
Global $Button8 = GUICtrlCreateButton("Resume", 400, 80, 75, 25, $WS_GROUP)
Global $Button9 = GUICtrlCreateButton("Kill", 488, 80, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
Func GetProcessList()
$proc = ProcessList()
For $i = 2 To $proc[0][0]
_GUICtrlComboBox_AddString($combo1, $proc[$i][0])
_GUICtrlComboBox_AddString($combo2, $proc[$i][0])
_GUICtrlComboBox_AddString($combo3, $proc[$i][0])
Next
EndFunc
GetProcessList()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $button1
_ProcessSuspend(GuiCTRLRead($combo1))
Case $Button2
_ProcessResume(GuiCtrlRead($combo1))
Case $Button3
ProcessClose(GuiCtrlRead($combo1))
Case $button4
_ProcessSuspend(GuiCTRLRead($combo2))
Case $Button5
_ProcessResume(GuiCtrlRead($combo2))
Case $Button6
ProcessClose(GuiCtrlRead($combo2))
Case $button7
_ProcessSuspend(GuiCTRLRead($combo3))
Case $Button8
_ProcessResume(GuiCtrlRead($combo3))
Case $Button9
ProcessClose(GuiCtrlRead($combo3))
EndSwitch
WEnd