Thread: enumerating process

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,666
    > printf ("Processo: %s\n", szProcessName);
    Well you do print whatever happened to be in the buffer last, whether or not some previous functions returned 'success' or 'failure'.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  2. #2
    -AppearingOnThis..........
    Join Date
    May 2005
    Location
    Netherlands
    Posts
    44
    You need to have your printf() after all the functions, as some processes you aren't allowed to open without debugging privileges. At the moment you're just printing something without knowing if those functions succeeded or not.

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    161
    thanx everyone I've put the printf into the :
    Code:
    if ( NULL != hProcess )
    the strange thing is that I have to filter the first result, infact if I don't initialize

    Code:
    char szProcessName[MAX_PATH]
    the first (bugged!) result is the last executed program.. if I initialize it to something, this something will be the first process found.. anyway I've filtered it out and it's working well, anyway I will debug better the code to see what it's really happening, because I'm afraid this will lead to some other nested bugs

    thanks to everyone
    This forum is the best one I've ever seen. Great ppl, great coders

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