Process Killer

Want Cheat Engine to do something specific and no idea how to do that, ask here. (From simple scripts to full trainers and extensions)
Post Reply
User avatar
corroder
Novice Cheater
Novice Cheater
Posts: 17
Joined: Fri Mar 03, 2017 1:54 am
Reputation: 1

Process Killer

Post by corroder »

Hi there,
This script is to get and attach process to CE.

Code: Select all

--- Process Handler
function GetTheProcessList()
 local T = {}
 local SL=createStringlist()
 getProcesslist(SL)
 for i=0,strings_getCount(SL)-1 do
  T[i] = strings_getString(SL,i)
 end
 return T
end

function GetPros(sender)
 local PL = GetTheProcessList()
 local S = {}
 local variable = drop.text
 list.Clear()
 for x = 0, #PL do
  if variable == "All" then
  list.Items.Add(PL[x])
  else
  if string.sub(PL[x],10) == variable then
  --S[#S+1] = PL[x]  --list for reference
  list.Items.Add(PL[x])
  end
  end
 end
end

function OpenPro()
 local a = list.ItemIndex
 if a ~= -1 then
 local b = string.sub(list.Items[a],0,8)
 b = tonumber(b,16)
 openProcess(b)
 else
 showMessage("Process not found...")
 return
 end
end
Now I try to make function process killer..

Code: Select all

function KillPro()
 local a = list.ItemIndex
 if a ~= -1 then
 local b = string.sub(list.Items[a],0,8)
 b = tonumber(b,16)
 shellExecute(string.format(b), '/c taskkill /PID ' .. getOpenedProcessID(), nil, false)
 else
 showMessage("Process not found...")
 return
 end
end
Is function KillPro() correct or is there any other way to kill a ran process ?

Thanks

User avatar
Metanoia
Noobzor
Noobzor
Posts: 13
Joined: Thu Mar 07, 2024 7:16 pm
Reputation: 24

Re: Process Killer

Post by Metanoia »

I might be 7 years to late but here :)


function _TerminateProcess(processHandle, exitCode)
local TerminateProcessAddress = getAddressSafe('TerminateProcess')
if not TerminateProcessAddress then return("Failed to get address of TerminateProcess") end
local param1, param2 = {type = 0, value = processHandle or getOpenedProcessHandle()}, {type = 0, value = exitCode or _GetExitCodeProcess(processHandle or getOpenedProcessHandle())}
return executeCodeLocalEx(TerminateProcessAddress, param1, param2)
end

registerLuaFunctionHighlight('_TerminateProcess')

function _GetExitCodeProcess(processHandle)
local GetExitCodeProcessAddress = getAddressSafe('GetExitCodeProcess')
if not GetExitCodeProcessAddress then return("Failed to get address of GetExitCodeProcess") end
local exitCode = createMemoryStream()
exitCode.Size = 8
local param1, param2 = {type = 0, value = processHandle or getOpenedProcessHandle()}, {type = 0, value = exitCode.Memory}
local result = executeCodeLocalEx(GetExitCodeProcessAddress, param1, param2)
local exitCodeValue = readInteger(exitCode)
exitCode.destroy()
exitCode = nil
return result ~= 0, exitCodeValue
end

registerLuaFunctionHighlight('_GetExitCodeProcess')


Just call this _TerminateProcess()

Post Reply

Who is online

Users browsing this forum: No registered users