 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Fri Sep 09, 2016 3:41 pm Post subject: Find Specific Process When Duplicate Names Exist |
|
|
Cheat Engine gives you the ability to enumerate each module used within a specific process.
This can allow you to uniquely identify one process among multiples with the same name.
The following script will print a list of all modules used by the currently attached process.
Use this to find a specific module that only the correct process contains.
Code: | local modules = enumModules()
for j = 1, #modules do
print(modules[j].Name)
end |
The following function accepts two parameters: a process name and a module name.
It will return the unique identifier of the process matching the supplied names.
Code: | function findProcessWithModule(processName, moduleName)
local processes = createStringlist()
getProcesslist(processes)
for i = processes.Count - 1, 0, -1 do
local found = processes[i]:find(processName)
if found ~= nil then
local processId = processes[i]:sub(0, found - 2)
local modules = enumModules(processId)
for j = 1, #modules do
if modules[j].Name == moduleName then
processes.Destroy()
return tonumber(processId, 16)
end
end
end
end
processes.Destroy()
end |
You can directly open a process utilizing its process identifier.
Code: | local processId = findProcessWithModule("Calculator.exe", "user32.dll")
if processId ~= nil then
openProcess(processId)
end |
If you would like your table to automatically detect when this process exists, you can implement a timer.
Code: | if mytimer == nil then
mytimer = createTimer(nil, false)
end
mytimer.Interval = 1000
mytimer.OnTimer = function(timer)
local processId = findProcessWithModule("Calculator.exe", "user32.dll")
if processId ~= nil then
mytimer.Enabled = false
openProcess(processId)
end
end
mytimer.Enabled = true |
Last edited by Zanzer on Fri Sep 09, 2016 6:24 pm; edited 1 time in total |
|
Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 958
|
Posted: Fri Sep 09, 2016 6:15 pm Post subject: |
|
|
When enumerate the process using getProcesslist(processes) , it seems the list order follow the time of opening, that's later process opened will have higher index in the list, most lower index process are system process etc.
It may be a bit efficient to find target process by reversing the process for loop.
bye~
_________________
- Retarded. |
|
Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Fri Sep 09, 2016 6:24 pm Post subject: |
|
|
Reversed.
|
|
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
|
|