Fonction NTProcess - AutoIt

    Publicités

Users Who Are Viewing This Thread (Total: 0, Members: 0, Guests: 0)

Exetra

Membre d'Honneur
V
Dec 17, 2010
916
0
922
Voila ma fonction NTProcess pour AutoIt

Code:
Func _NTProcess($NtAction,$process)
        If $NtAction = "2" Then
                $KtwAction = "NtResumeProcess"
        ElseIf $NtAction = "1" Then
                $KtwAction = "NtSuspendProcess"
        ElseIf $NtAction = "3" Then
                $KtwAction = "NtTerminateProcess"
        EndIf
$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",$KtwAction,"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

Utilisation

_NTProcess(1,"AutoIt.exe") = Suspends AutoIt.exe
_NTProcess(2,"AutoIt.exe") = Reprends AutoIt.exe
_NTProcess(3,"AutoIt.exe") = Tue AutoIt.exe
 

Ice-Crack

Membre actif
May 6, 2011
495
0
742
28
Ou :

_NTProcess("NtSuspendProcess", "Autoit.exe") ==> SUSPENDRE
_NTProcess("NtResumeProcess", "Autoit.exe") ==> RESUME
_NTKill("Autoit.exe") ==> KILL