Combreal

pauseGta.ps1

Dec 6th, 2021 (edited)
564
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #https://www.autohotkey.com/download/ahk-install.exe
  2. ##SingleInstance force ;
  3. #^+o::
  4. #EnvGet, SystemRoot, SystemRoot
  5. #Run %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy unrestricted -Command "C:\Temp\pauseGTA\pause.ps1",, hide
  6.  
  7. $job = Start-Job -ScriptBlock {
  8.     $Process = Get-Process -Name "gta5"
  9.  
  10.     Add-Type -TypeDefinition @"
  11.            using System;
  12.            using System.Diagnostics;
  13.            using System.Security.Principal;
  14.            using System.Runtime.InteropServices;
  15.  
  16.            public static class Kernel32
  17.            {
  18.                [DllImport("kernel32.dll")]
  19.                public static extern bool CheckRemoteDebuggerPresent(IntPtr hProcess, out bool pbDebuggerPresent);
  20.                [DllImport("kernel32.dll")]
  21.                public static extern int DebugActiveProcess(int PID);
  22.                [DllImport("kernel32.dll")]
  23.                public static extern int DebugActiveProcessStop(int PID);
  24.            }
  25. "@
  26.  
  27.     If ([Kernel32]::CheckRemoteDebuggerPresent($Process.Handle,[ref][IntPtr]::Zero) -And $(whoami /priv) -match "SeDebugPrivilege") {        
  28.         [Kernel32]::DebugActiveProcess($Process.id)
  29.         Start-Sleep -Seconds 10
  30.         [Kernel32]::DebugActiveProcessStop($Process.id)
  31.     }
  32. }
  33.  
  34. Wait-Job $job | Out-Null
  35. Receive-Job $job
Add Comment
Please, Sign In to add comment