[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
-[NSTask terminate] implementation for MinGW
From: |
Wim Oudshoorn |
Subject: |
-[NSTask terminate] implementation for MinGW |
Date: |
Tue, 20 Jul 2004 15:33:39 +0200 |
User-agent: |
Mutt/1.4.1i |
The current implementation of -[NSTask terminate] for MinGW
will call TerminateProcess.
According to the documentation of TerminateProcess
this will not kill the children of the process to be killed.
The documentation of the -[NSTask terminate] method
expects that all the children are also killed.
This problem is simple enough. However the solution is
more complicated because MSWindows does note have
a method to kill all the children and does not provide
a nice interface to get to the children of a process.
I looked a little into it and it seems there
are two viable solutions:
(For a detailed description of how to walk through
processes look at:
http://www.alexfedotov.com/articles/enumproc.asp
or for killing processes
http://www.alexfedotov.com/articles/killproc.asp
)
Solution 1: Use the process status helper library (psapi.dll)
Solution 2: Use non-documented zwQuerySystemInformation function
The (dis)advantage of the first solution are
- psapi.dll is standard included in Windows 2000/XP, but
not with Windows NT. There is a version for Windows NT
but that version needs to be seperatedly installed.
Problem with this is that the installation instructions
for MinGW become more complicated and the installer
becomes more complicated
+ Uses only documented methods
The (dis)advantage of the second solution are
- Use non documented methods
+ Works on Windows 2000/XP and NT without depending on an
additional component.
I am left with the following questions:
1) Is there perhaps a better method for doing this?
2) Which solution do people prefer?
Wim Oudshoorn
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- -[NSTask terminate] implementation for MinGW,
Wim Oudshoorn <=