block program from seeing process tree

This is a discussion on block program from seeing process tree within the C# Programming forums, part of the General Programming Boards category; I'm not sure if this is the right place to ask this, but does anyone know if it is possible ...

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    39

    block program from seeing process tree

    I'm not sure if this is the right place to ask this, but does anyone know if it is possible to disable a program from seeing the process tree?

    I have a program that I can only run one instance of. When I try to start it a second time, it doesn't do anything. I would like to create a script that loads the program in a way that I can run multiple instances. Since I assume the program checks the process tree on startup to see if an other instance is already running, I figure disabling access to the process tree could do the trick.

    Any ideas anyone?

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    There is a way to have a user only see his own processes so you could start it as another user to achieve the desired effect, but checking the process tree is not actually the easiest way to force only one instance of your program, so it might not be as successfull as you think it will be. Try copying your program and running it from a different folder and different name of the executable. If that works, great. If not, your process list will not help either.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    There is a hacky way to see if your process is already running...if it uses a window and it has a title. You look for the unique window title by calling the appropriate EnumWindows family of functions using P/invoke. If you find a window with the specified title then you know an instance of your process is already running. There are better ways to determine this but I thought I would offer it up.

  4. #4
    Registered User
    Join Date
    Dec 2009
    Posts
    39
    Quote Originally Posted by nvoigt View Post
    There is a way to have a user only see his own processes so you could start it as another user to achieve the desired effect, but checking the process tree is not actually the easiest way to force only one instance of your program, so it might not be as successfull as you think it will be. Try copying your program and running it from a different folder and different name of the executable. If that works, great. If not, your process list will not help either.
    Good idea, but you were right; it didn't work. Any ideas of how I could bypass it anyway?

  5. #5
    Registered User
    Join Date
    Dec 2009
    Posts
    39
    Quote Originally Posted by VirtualAce View Post
    There is a hacky way to see if your process is already running...if it uses a window and it has a title. You look for the unique window title by calling the appropriate EnumWindows family of functions using P/invoke. If you find a window with the specified title then you know an instance of your process is already running. There are better ways to determine this but I thought I would offer it up.
    I'm not really looking for ways to make sure only one instance of a program can be ran, rather than ways to bypass it.

  6. #6
    Registered User
    Join Date
    Jun 2005
    Posts
    6,438
    There are many possible ways that a program can detect another instance of itself. Not all of them involve looking at a process tree.

    A common way is actually using a mutex or a semaphore (these are objects managed by the system). There are ways and means of blocking such techniques but there are also countermeasures (for example, controlling access to the mutex).

    Generally, these types of questions come from people who are trying to bypass licensing schemes, or something similar, so I am disinclined from offering solutions.
    Right 98% of the time, and don't care about the other 3%.

  7. #7
    Registered User
    Join Date
    Dec 2009
    Posts
    39
    Quote Originally Posted by grumpy View Post
    There are many possible ways that a program can detect another instance of itself. Not all of them involve looking at a process tree.

    A common way is actually using a mutex or a semaphore (these are objects managed by the system). There are ways and means of blocking such techniques but there are also countermeasures (for example, controlling access to the mutex).

    Generally, these types of questions come from people who are trying to bypass licensing schemes, or something similar, so I am disinclined from offering solutions.
    Well I'm trying to run 2 instances of the same multiplayer game. I can accomplish the same result by running each instance in a different virtualpc, but that seems like to much overhead.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Process Memory block
    By ssharish2005 in forum Tech Board
    Replies: 6
    Last Post: 06-29-2011, 04:02 PM
  2. Process Control Block
    By Dibyayan Chakra in forum C Programming
    Replies: 11
    Last Post: 05-28-2011, 06:30 PM
  3. Eternal block of process with sem_wait ( )
    By bonnuit in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 11:27 AM
  4. hit a stumbling block in program
    By pastitprogram in forum C++ Programming
    Replies: 2
    Last Post: 08-11-2008, 02:44 PM
  5. have to program to get process ID?
    By George2 in forum Tech Board
    Replies: 12
    Last Post: 08-23-2006, 10:13 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21