Re: Reaping a process without a parent process/service/daemon



Thanks for the replies...you guys are right...I sort of realized that while I
was typing up the message, but wanted to get some confirmation that my
thinking was correct. Your replies confirm that. Thanks again!

"Alexander Nickolov" wrote:

You don't need a parent-child relationship as long as you
have the PID and the rights to open the process. See the
OpenProcess() API.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://vcfaq.mvps.org
=====================================

"vka2b" <vka2b@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1DB23F46-8650-465C-B908-D79AEFC789C8@xxxxxxxxxxxxxxxx
Hello,

I am currently in the process of porting my company's application from
UNIX/Linux to Windows. The way our application currently runs is as
follows:
We have a daemon process that runs in the background and polls a database.
As soon as it detects a pre-defined condition in the database, it forks
and
execs a child process that carries out some specified behavior.

In the Windows world, we would normally just replace the daemon with a
Windows service. However, we are trying to avoid doing so, and would like
to
just be able to manually directly execute the processes that the
daemon/service would normally kick off. This should be straightforward,
however, there is one piece of functionality that the UNIX/Linux daemon
process used to provide that I am not sure how to duplicate if we don't
have
some sort of parent process/service: The daemon would check the status of
the child processes (i.e. using waitpid) and take appropriate actions
depending on if the child exited cleanly or not.

I know that Visual C++ has the GetExitCodeProcess method that is
equivalent
to waitpid, but this would involve at least having some sort of
shell/parent
process that kicks off the underlying process to monitor (not necessarily
a
service, but still not running the process directly). Is there any other
way
in the Windows world to determine the status of a process? I have heard
some
ideas such as check the Windows Event Log and such, but I wanted to see if
anybody in the forums had a more specific/programmatic solution.

Any help is greatly appreciated. Also, please let me know if I posted
this
to the wrong place (it seemed like the most fitting, but I apologize if
it's
not).

Thanks,
Vineet



.



Relevant Pages

  • Re: Reaping a process without a parent process/service/daemon
    ... You don't need a parent-child relationship as long as you ... UNIX/Linux to Windows. ... We have a daemon process that runs in the background and polls a database. ... execs a child process that carries out some specified behavior. ...
    (microsoft.public.vc.language)
  • Re: Reaping a process without a parent process/service/daemon
    ... UNIX/Linux to Windows. ... We have a daemon process that runs in the background and polls a database. ... execs a child process that carries out some specified behavior. ...
    (microsoft.public.vc.language)
  • Re: Weird file name sorting order in folder explorer window
    ... I very often sort files in explorer, ... and it happens to me even in a newly created folder that has ... more recent versions try to sort filenames numerically, ... Microsoft MVP [Windows Shell/User] ...
    (microsoft.public.scripting.vbscript)
  • Re: Blank Documents
    ... The only thing of this sort I could find in the KB said it occurred ... only in Windows 95. ... >> disk. ... >> Try running CHKDSK to see if it reports any problems on the drive. ...
    (microsoft.public.word.application.errors)
  • Re: Copying pictures in a certain order
    ... However, when you are getting a list of files on the CD, with Windows ... For instance, to sort by date, click on the date column. ... you can get Explorer to sort in either ascending or descending order. ... formatted pseudo disk so that the meta-data entries correspond to the ...
    (rec.photo.digital)