Hi All,
I am writing a tool, which should monitor some exe-processes, which are not
very solid. Th main function is to re-start them, if they hung, but this is
complicated. I can detect things like no longer generating IO or such
properties and I use WMI to do that. I am also looking for attached
subprocesses, which are one of the system debuggers.
I wrote a test-program, which creates a divide by zero error after some
seconds. I can detect - with the help of wmi - that my watched process get's
a subprocess attached, which is, for example, "vs7jit.exe" and I know the
handle.
Then I do:
Process p = Process.GetProcessById(pid/handle);
p.Kill();
I can verify by logging and with the help of "TLIST.EXE" [from the resource
kit], that I got the right PID and that "Kill()" works, but not as expected:
After Kill(), the debugger is not removed [the GUI stays visible] and is
appearing with another PID as a subprocess of "svchost.exe". Also using
"p.CloseMainWindow()" is not usable, because it returns false [the docs
explain one of the reasons, which fit in my case:The process has "a modal
dialog is being shown"].
How can I kill the debugger, so that my program dies [this is handled and
the process can be restarted]. Configuring the system to never display a
debugger is not an option for other reasons. The
Management.Win32_Process.Terminate method could be another option, so I post
this to the WMI group also. My proggi is written in C#.
And help would be great!!!!
Best regards,
Manfred Braun
(Private)
Mannheim
Germany
mailto:_m*************@manfbraun.de
(Remove the anti-spam-underscore to mail me!)