Process handle search Topic is solved
-
- Posts: 147
- Joined: 05 Nov 2016, 22:42
Process handle search
The above picture shows the process that have the handle of chrome.exe.
I want to get a list of process that have a handle to a particular process.
Re: Process handle search
Something like this? GetProcessThreads.ahk
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
-
- Posts: 147
- Joined: 05 Nov 2016, 22:42
Re: Process handle search
jNizM wrote:Something like this? GetProcessThreads.ahk
Well, can not get a list of handles instead of threads?
Re: Process handle search
Maybe that's what you are looking for:
Code: Select all
for process in ComObjGet("winmgmts:").ExecQuery("Select Handle, Name from Win32_Process WHERE Name='Chrome.exe'")
processes .= process.Name . " - " . process.Handle . "`r`n"
MsgBox % processes
; see https://autohotkey.com/board/topic/8228-process-listfile-namescommand-lines/page-2 (lexikos answer)
-
- Posts: 147
- Joined: 05 Nov 2016, 22:42
Re: Process handle search
A_AhkUser wrote:Maybe that's what you are looking for:
Code: Select all
for process in ComObjGet("winmgmts:").ExecQuery("Select Handle, Name from Win32_Process WHERE Name='Chrome.exe'") processes .= process.Name . " - " . process.Handle . "`r`n" MsgBox % processes ; see https://autohotkey.com/board/topic/8228-process-listfile-namescommand-lines/page-2 (lexikos answer)
Unfortunately, this does not show all the handles.
For example, when you do "openprocess" with the cheat engine, the "handle" should output the cheat engine process. However, this is not output.
Re: Process handle search
Not sure but maybe it is due to the fact that you lunched the processes from whom belong the aforementioned handles as administrator unlike the script itself.whynotregister wrote:Unfortunately, this does not show all the handles.
Re: Process handle search
Its a bit more complicated to get all handles...
You need SetPrivilege, OpenProcess, NtQuerySystemInformation/ZwQuerySystemInformation, NtQueryObject/ZwQueryObject
You need SetPrivilege, OpenProcess, NtQuerySystemInformation/ZwQuerySystemInformation, NtQueryObject/ZwQueryObject
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
-
- Posts: 147
- Joined: 05 Nov 2016, 22:42
Re: Process handle search
How should I implement it?jNizM wrote:Its a bit more complicated to get all handles...
You need SetPrivilege, OpenProcess, NtQuerySystemInformation/ZwQuerySystemInformation, NtQueryObject/ZwQueryObject
As far as I know, it is possible to implement in user mode api.
Re: Process handle search
Will post an example as soon I finished it.
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
-
- Posts: 147
- Joined: 05 Nov 2016, 22:42
Re: Process handle search
Very Thank youjNizM wrote:Will post an example as soon I finished it.
Re: Process handle search Topic is solved
Here is my first (not whole finished) attempt: GetProcessHandles
Maybe you need to start it as admin (runas admin function can be found in this forum too)
Maybe you need to start it as admin (runas admin function can be found in this forum too)
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
-
- Posts: 147
- Joined: 05 Nov 2016, 22:42
Re: Process handle search
It does not seem to work.jNizM wrote:Here is my first (not whole finished) attempt: GetProcessHandles
Maybe you need to start it as admin (runas admin function can be found in this forum too)
Code: Select all
#include GetProcessHandles.ahk
winget,pid,pid,ahk_exe Chrome.exe
if pid > 0
msgbox % GetProcessHandles(pid)
Tested with administrator privileges.
Re: Process handle search
Code: Select all
for i, v in GetProcessHandles(PID)
MsgBox % v
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
-
- Posts: 147
- Joined: 05 Nov 2016, 22:42
Re: Process handle search
Thank you very much. Nice script.jNizM wrote:Code: Select all
for i, v in GetProcessHandles(PID) MsgBox % v