Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. XIncludeFile("~\SetCriticalFlag.pb")
  2.  
  3. ImportC "msvcrt.lib"
  4.   memset_ ( *str, char.l, length.l ) As "_memset@12"
  5. EndImport
  6.  
  7. OpenConsole()
  8. PrintN("Welcome, please enter the process that is set to critical...")
  9. pID = Val(Input())
  10. If SetCriticalFlag(pID, #False)
  11.   PrintN(#Null$)
  12.   PrintN("Process modified successfully! Would you like to kill the target process' tree using NtTerminateProcess? (y/n)")
  13.   Select Input()
  14.     Case "y"
  15.       PrintN("Traversing target process tree...")
  16.     Default
  17.       PrintN("Very well, press enter to exit...")
  18.       Input()
  19.       Return
  20.   EndSelect
  21.   Pe.PROCESSENTRY32
  22.   memset_(@pe, 0, SizeOf(PROCESSENTRY32))
  23.   pe\dwSize = SizeOf(PROCESSENTRY32)
  24.  
  25.   hSnap = CreateToolhelp32Snapshot_(#TH32CS_SNAPPROCESS, 0)
  26.  
  27.   If Process32First_(hSnap, @pe)
  28.     bContinue.b = #True
  29.    
  30.     While bContinue
  31.       If pe\th32ParentProcessID = pID
  32.         hChildProc = OpenProcess_(#PROCESS_ALL_ACCESS, #False, pe\th32ProcessID)
  33.        
  34.         If hChildProc
  35.           PrintN("Child process found! Handle: " + Str(hChildProc))
  36.           NtTerminateProcess_(hChildProc, 1)
  37.           CloseHandle_(hChildProc)
  38.           PrintN("Child process killed!")
  39.         EndIf
  40.       EndIf
  41.       bContinue = Process32Next_(hSnap, @pe)
  42.     Wend
  43.    
  44.     hProc = OpenProcess_(#PROCESS_ALL_ACCESS, #False, pID)
  45.    
  46.     If hProc
  47.       PrintN("Host process found! Handle: " + Str(hProc))
  48.       NtTerminateProcess_(hProc, 1)
  49.       CloseHandle_(hProc)
  50.       PrintN("Host process killed!")
  51.     EndIf
  52.   EndIf
  53.   PrintN("Press any key to close the program...")
  54.   Input()
  55. Else
  56.   PrintN("Failed to modify process!")
  57.   Input()
  58.   Return
  59. EndIf
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement