delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/06/08:03:08

Date: Mon, 6 Dec 1999 12:26:30 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Alex Crowther <mr_spod AT hotmail DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: signal question ..
In-Reply-To: <384AA773.8881436@hotmail.com>
Message-ID: <Pine.SUN.3.91.991206122614.19715H-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019