Which executable file started my executable file?

Is there a reliable way to find out which executable called my executable?

I have a .NET executable, but I would like to know who started my application.

+3
source share
3 answers

The answer to your question is http://www.codeproject.com/KB/threads/ParentPID.aspx

In short, you create a snapshot of all the processes that work with lpfCreateToolhelp32Snapshot(), and then iterate through it to find your process (indicated GetCurrentProcessId()) using lpfProcess32First()/lpfProcess32Next(). Once you find your own process, the structure you get gives you the process ID of the parent process, the one that launched your application.

Once you get the parent PID, it is easy to get the exe file name and other attributes with EnumProcessModules()and GetModuleFileNameEx().

But you can probably just use the code from the link.

+1
source

Do you want to find this programmatically? You will then find these related questions helpful:

, Process Explorer Sysinternals.

+1

? Windows , unix - PID , , ( , ). , PID , . , , , .

+1

Source: https://habr.com/ru/post/1740127/


All Articles