Mail Archives: djgpp/1999/12/06/08:03:08
On Sun, 5 Dec 1999, Alex Crowther wrote:
> Are there any djgpp ports of unix commands that can send signals,
> more specifically the kill signal so I can kill windows processes
> without using the task manager.
DOS doesn't have any standard way of killing a subprocess, and Windows
doesn't provide any system call to kill a process in another virtual
machine, either. That's why there are no DJGPP ports of Unix-standard
command `kill'.
The way Windows ``task manager''[1] kills a program is just a hack: it
calls the DOS function to set PSP to the program that is about to be
killed, then calls the DOS Exit function. In other words, it creates
an illusion that the program itself exited. Obviously, this is only
possible if you know the PSP of the program, which Windows knows
because it launched the program in the first place.
If you want to kill a subprocess that runs in the same virtual
machine, then, in theory, you could hook Int 21h and get the
subprocess' PSP (e.g., when the subprocess calls some DOS function).
But hooking Int 21h in protected mode is not an easy task, since
software interrupts aren't reflected to protected-mode handlers, so
you need to hook it in real mode... It's a mess, although it
certainly *is* doable.
[1] Actually, there's no ``task manager'' per se on Windows 9X. The
Windows Explorer, which is the default Windows shell, does what I
described above.
- Raw text -