Skip to content

Instantly share code, notes, and snippets.

@SmugZombie
Created June 16, 2016 00:53
Show Gist options
  • Save SmugZombie/9ea99c475a37684eb290b2a1f0319309 to your computer and use it in GitHub Desktop.
Save SmugZombie/9ea99c475a37684eb290b2a1f0319309 to your computer and use it in GitHub Desktop.
Process_Suspend(PID_or_Name){
PID := (InStr(PID_or_Name,".")) ? ProcExist(PID_or_Name) : PID_or_Name
h:=DllCall("OpenProcess", "uInt", 0x1F0FFF, "Int", 0, "Int", pid)
If !h
Return -1
DllCall("ntdll.dll\NtSuspendProcess", "Int", h)
DllCall("CloseHandle", "Int", h)
}
Process_Resume(PID_or_Name){
PID := (InStr(PID_or_Name,".")) ? ProcExist(PID_or_Name) : PID_or_Name
h:=DllCall("OpenProcess", "uInt", 0x1F0FFF, "Int", 0, "Int", pid)
If !h
Return -1
DllCall("ntdll.dll\NtResumeProcess", "Int", h)
DllCall("CloseHandle", "Int", h)
}
ProcExist(PID_or_Name=""){
Process, Exist, % (PID_or_Name="") ? DllCall("GetCurrentProcessID") : PID_or_Name
Return Errorlevel
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment