Announcement

Collapse
No announcement yet.

Find parent process

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Michael Mattias
    replied
    If this program is only permitted to be executed as a child of some process, an easier way to accomplish this would be to have the parent program create a mutex, and the child process see if it can find that mutex. If it can't, you just end the child process doing nothing.

    Basically you are using the same technology you would use to prevent two instances of any program at the same time, but you are using it for another purpose.

    If the situation is not as posited, please describe and I'm sure someone will have some ideas for you.

    MCM

    Leave a comment:


  • Paulo Ferreira
    replied
    Originally posted by Michael Mattias View Post
    ...
    But what are you trying to accomplish?
    MCM
    I need to know what is the parent process and decide if it has or not
    permission to execute my process.

    Leave a comment:


  • Michael Mattias
    replied
    By using the Toolhelp functions...
    - CreateToolHelp32Snapshot
    - Process32First/Next

    ... you can get the parent process of your current process, which can get you the primary executable module name associated with same (GetModuleBaseName or EnumProcessModules or Module32/Firstnext).

    But what are you trying to accomplish? This topic has come up here before, and IIRC it has always involved something like, "If started from <X> I [do | do not] want to allow some feature of my application to work." And if I continue to remember correctly, this problem was always solved some other way.

    MCM

    Leave a comment:


  • Paulo Ferreira
    started a topic Find parent process

    Find parent process

    Is there a way to identify the process that launch my application (exe / dll) ?
    - Manual start,
    - Other app or dll,
    - Task manager,
    - etc ...
Working...
X