 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Mon Jun 10, 2019 5:24 am Post subject: Detach Opened Process |
|
|
When using:
example attach/open process Notepad to CE on my machine and then:
| Code: | a = getOpenedProcessID()
print(a) -- = 3932 is a Dec or F5C in Hex
|
But in CE Process list, PID has shown as Hex.
When close/terminate/close opened process by this function:
| Code: | function detach()
local id = getOpenedProcessID()
os.execute("taskkill -im "..id)
end
|
The opened process (notepad) is close. but on CE main form still, show the opened process (00000F5C-notepad.exe).
Questions:
1. Why getOpenedProcessID() return PID as Decimal, not as Hex, so it same to PID on the process list or attached process on CE main form?
2. How to make CE main form return to 'No Process Selected' when an opened process has terminated/closed?. Without open another process.
3. Suggestion for next version, add 'Close opened process' item to the File Menu or build in function/class to close the opened process and return CE to default.
Regards
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25835 Location: The netherlands
|
Posted: Mon Jun 10, 2019 7:38 am Post subject: |
|
|
1: it returns the pid as a 64 bit value
You're just converting it to decimal with print
if you want hexadecimal then do print(string.format("%x",a))
2: Use a timer in which you do readInteger(process) if it returns nil then change MainForm.ProcessLabel.Caption
3: Do you mean terminate the attached process?
If you mean detach then just make CE open another process, like cheatengine itself.
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Mon Jun 10, 2019 7:55 am Post subject: |
|
|
Thanks, DB, all clear for PID and other questions. For the detach process function, I used:
| Code: | function detach()
local id = getOpenedProcessID()
os.execute("taskkill -im "..id)
MainForm.ProcessLabel.Caption
end |
All works properly.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1534
|
Posted: Mon Jun 10, 2019 7:58 am Post subject: |
|
|
You probably remember this scenario.
"Auto Flash finder" (32 bit) for CE Autorun plugin
Here are the formats you can play on:
| Code: | | pid=pid,desc=string.format('%6d %04X <%6s> %s',pid,pid,string.sub |
| Code: | | for pid,pID,name in string.gmatch(DESC,"([0-9]+) ([0-9A-F]+) <.-> (.*)") do |
and final:
| Code: | | MainForm.ProcessLabel.caption = (string.format('%08X (%s %04d) %s %s',pid,"PID:",pid,name,'ON!')) |
| Code: | function pidDialog(doPid,autoSelectFirst,pn,dn)
autoSelectFirst = autoSelectFirst or false
local plugname = type(pn)=='table' and pn or {"iexplore","flashplayerplugin","plugin-container","opera","chrome","awesomium_process","torch","dragon","maxthon","palemoon","safari" }
local dllname = type(dn)=='table' and dn or {"flash","unity","plugin-container.exe" }
if type(pn)=='string' then table.insert(plugname,pn) end
if type(dn)=='string' then table.insert(dllname,dn) end
local indexOf = function(s,m) for i=1,#m do if string.find(string.lower(s),string.lower(m[i]),1,true) then return i end end end -- cave insensitive find
local function tmerge(t,o,...) for k,v in pairs(o) do t[k]=v end if select('#',...)>0 then return tmerge(t,...) else return t end end
local function callLater(f,...)
local a,n = {...},select('#',...)
local t = tmerge(createTimer(),{Interval=1,Enabled=true,OnTimer=function(sender) sender.Enabled=false sender.Destroy() f(unpack(a,1,n)) end})
return t
end
local function parseProc(i,s)
local dll=' ... '
for pid,name in string.gmatch(s,'([0-9A-F]+)-(.*)') do
local weight,pid = 0,tonumber(pid,16)
for _,v in ipairs(plugname) do
if indexOf(name,plugname) then
weight = weight + 1
local m = enumModules(pid)
for i=1,#m do
local ix = indexOf(m[i].Name,dllname)
if ix then
weight = weight + 1
dll = dllname[ix]
break
end
end
break
end
end
return {pid=pid,desc=string.format('%6d %04X <%6s> %s',pid,pid,string.sub(dll.." ",1,6):upper(),name),name=name,w=weight+i/2048,dll=dll}
end
end
local FP = createForm(false)
tmerge(FP,{FormStyle='fsStayOnTop',AutoSize=true,BorderWidth=4,Color=0x00ffff,Position='poScreenCenter',BorderStyle='bsToolWindow',Caption='Double Click to Select - Secimi Cift Tiklayin!'})
local LB = createListBox(FP)
tmerge(LB,{MultiSelect=false,AutoSize=true,Color=0xfff00f})
local cs = LB.Constraints
tmerge(cs,{MinHeight=80,MinWidth=280})
local fn = LB.Font
tmerge(fn,{Color=0x030303,Name='Courier New',Height=-12,Style='[bsBold]'})
LB.OnDblClick = function()
local idx,PID,NAME = LB.ItemIndex,nil,''
if idx >= 0 then
DESC = LB.Items[idx]
for pid,pID,name in string.gmatch(DESC,"([0-9]+) ([0-9A-F]+) <.-> (.*)") do
PID = tonumber(pid,10)
NAME = name
end
end
if PID ~= nil then callLater(doPid,PID,NAME,DESC) end
FP.close()
end -- LB.OnDblClick
FP.OnClose = function() FP.destroy(); FP = nil end
getProcesslist(LB.Items)
local plist = {}
for i=1,LB.Items.getCount() do
table.insert(plist,parseProc(i,LB.Items[i-1]))
end
table.sort(plist,function(a,b) return a.w > b.w end)
local currProcId = getOpenedProcessID()
for i=1,LB.Items.getCount() do
LB.Items.setString(i-1,plist[i].desc)
if plist[i].pid == currProcId then LB.setItemIndex(i-1) end
if i==1 and autoSelectFirst == true or type(autoSelectFirst)=='string' and indexOf(plist[i].dll,{autoSelectFirst}) ~=nil then
LB.setItemIndex(i-1) LB.OnDblClick() return
end
FP.show()
end
end
for i=0,MainForm.ComponentCount-1 do
local c = MainForm.Component[i]
end
miAutoFlash.onClick=function(sender)
pidDialog(function(pid,name)
openProcess(pid)
--===== Thanks freeER ====--
MainForm.ProcessLabel.caption = (string.format('%08X (%s %04d) %s %s',pid,"PID:",pid,name,'ON!'))
end,'flash','plugin')
end |
Enjoy it ..
_________________
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Mon Jun 10, 2019 8:19 am Post subject: |
|
|
@Aylin, actually this [[function pidDialog(doPid,autoSelectFirst,pn,dn)]] wrote by Panraven, if I am not wrong. And I have my own process list with custom GUI. What I need to solve is how to return CE Main Form Process Label Caption as CE default, when a process has terminated/closed. DB already gave the answer and solution.
| Description: |
|
| Filesize: |
43.83 KB |
| Viewed: |
4765 Time(s) |

|
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|