Advertisement
perpetucake

Untitled

Jan 20th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. WinWait, ahk_class Devil Daggers
  2.  
  3. pause = 0
  4. p::
  5. if (pause == 0){
  6.     Process_Suspend("dd.exe")
  7.     pause = 1
  8. }else{
  9. Process_Resume("dd.exe")
  10. pause = 0
  11. }
  12. return
  13.  
  14. Process_Suspend(PID_or_Name){
  15.  
  16.     PID := (InStr(PID_or_Name,".")) ? ProcExist(PID_or_Name) : PID_or_Name
  17.  
  18.     h:=DllCall("OpenProcess", "uInt", 0x1F0FFF, "Int", 0, "Int", pid)
  19.  
  20.     If !h  
  21.  
  22.         Return -1
  23.  
  24.     DllCall("ntdll.dll\NtSuspendProcess", "Int", h)
  25.  
  26.     DllCall("CloseHandle", "Int", h)
  27.  
  28. }
  29.  
  30.  
  31.  
  32. Process_Resume(PID_or_Name){
  33.  
  34.     PID := (InStr(PID_or_Name,".")) ? ProcExist(PID_or_Name) : PID_or_Name
  35.  
  36.     h:=DllCall("OpenProcess", "uInt", 0x1F0FFF, "Int", 0, "Int", pid)
  37.  
  38.     If !h  
  39.  
  40.         Return -1
  41.  
  42.     DllCall("ntdll.dll\NtResumeProcess", "Int", h)
  43.  
  44.     DllCall("CloseHandle", "Int", h)
  45.  
  46. }
  47.  
  48.  
  49.  
  50. ProcExist(PID_or_Name=""){
  51.  
  52.     Process, Exist, % (PID_or_Name="") ? DllCall("GetCurrentProcessID") : PID_or_Name
  53.  
  54.     Return Errorlevel
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement