Thread: Process detection

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    98

    Process detection

    I'm currently working on a tool which is used to monitor system status in an NT4 environment. One of the functions is to check to see if a certain process is running based on the name of that function.

    I'm struggling to find a way of doing this directly from within a C program though - the best I've come up with so far is to call tlist from the resource kit, save its output in a file and then scan the file for the proc name. This seems a pretty crappy way to do things though, so if anyone can help it would be much appreciated.

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793

    Re: Process detection

    Originally posted by Morgan
    I'm currently working on a tool which is used to monitor system status in an NT4 environment. One of the functions is to check to see if a certain process is running based on the name of that function.

    I'm struggling to find a way of doing this directly from within a C program though - the best I've come up with so far is to call tlist from the resource kit, save its output in a file and then scan the file for the proc name. This seems a pretty crappy way to do things though, so if anyone can help it would be much appreciated.
    Do you mean "One of the functions is to check to see if a certain process is running based on the name of that program file. "

    If so; EnumProcesses() to get PIDs, OpenProcess() to get handles then GetProcessImageFileName() to get the name of the exe...

    There are other ways too, but for NT these should do the business!

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    98
    Cheers, Fordy!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. init adopts zombie process?
    By password636 in forum Linux Programming
    Replies: 4
    Last Post: 07-01-2009, 10:05 AM
  2. create a child process that creates a child process
    By cus in forum Linux Programming
    Replies: 9
    Last Post: 01-13-2009, 02:14 PM
  3. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  4. Problem with forking a process
    By Unitedroad in forum C Programming
    Replies: 10
    Last Post: 10-04-2007, 01:43 AM
  5. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM