source: trunk/src/win32k/k32/k32KillProcessEx.cpp@ 10367

Last change on this file since 10367 was 6286, checked in by bird, 24 years ago

Kill API - initial coding.

File size: 3.0 KB
Line 
1/* $Id: k32KillProcessEx.cpp,v 1.1 2001-07-10 05:20:59 bird Exp $
2 *
3 * k32KillProcessEx - DosKillProcessEx extention.
4 *
5 * Copyright (c) 2001 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
6 *
7 * Project Odin Software License can be found in LICENSE.TXT
8 *
9 */
10
11
12/*******************************************************************************
13* Defined Constants And Macros *
14*******************************************************************************/
15#define INCL_DOSPROCESS
16#define INCL_DOSERRORS
17#define INCL_DOSEXCEPTIONS
18#define INCL_OS2KRNL_TK
19
20#define NO_WIN32K_LIB_FUNCTIONS
21
22
23
24/*******************************************************************************
25* Header Files *
26*******************************************************************************/
27#include <os2.h>
28#include "devSegDf.h" /* Win32k segment definitions. */
29#include "OS2Krnl.h"
30#include "win32k.h"
31#include "k32.h"
32#include "options.h"
33#include "dev32.h"
34#include "log.h"
35#include "macros.h"
36
37
38
39/**
40 * DosKillProcess extention.
41 * @returns NO_ERROR on success.
42 * Appropriate error code on failure.
43 * @param flAction Action flags.
44 * DKP_PROCESSTREE and DKP_PROCESS is supposed to be supported (currently not implemented).
45 * This parameter is extended with the flowing flags:
46 * DKP_FLAG_KILL9
47 * @param pid The identity of the process or root in process tree to be killed.
48 * @sketch
49 * @status Paritially implemented.
50 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
51 */
52APIRET k32KillProcessEx(ULONG flAction, PID pid)
53{
54 APIRET rc;
55
56 /*
57 * Validate input.
58 */
59 if ( (flAction & DKP_ACTION_MASK) > DKP_PROCESS
60 || flAction & ~(DKP_ACTION_MASK | DKP_FLAG_MASK))
61 {
62 kprintf(("k32KillProcessEx(flAction=0x%08x, pid=0x%04x): flags are invalid\n", flAction, pid));
63 return ERROR_INVALID_PARAMETER;
64 }
65
66 if ( (ULONG)pid == 0UL
67 || (ULONG)pid >= 0x10000)
68 {
69 kprintf(("k32KillProcessEx(flAction=0x%08x, pid=0x%04x): pid is out of range\n", flAction, pid));
70 return ERROR_INVALID_PROCID;
71 }
72
73
74 /*
75 * Do the work:
76 *
77 * Currently we'll try do things the nice way first, if that failes
78 * we'll do the brute force kill. The reason for this is that I don't
79 * think APTERM do proper cleanup, like calling exceptionhandlers...
80 */
81 rc = POST_SIGNAL32((USHORT)XCPT_SIGNAL_KILLPROC,
82 (USHORT)(flAction & DKP_ACTION_MASK),
83 (USHORT)(flAction & DKP_FLAG_KILL9 ? ~0 : 0),
84 (USHORT)pid);
85
86 if (rc == ERROR_SIGNAL_PENDING && flAction & DKP_FLAG_KILL9)
87 {
88 rc = POST_SIGNAL32((USHORT)XCPT_SIGNAL_APTERM,
89 (USHORT)(flAction & DKP_ACTION_MASK),
90 (USHORT)~0,
91 (USHORT)pid);
92 }
93
94 return rc;
95}
96
Note: See TracBrowser for help on using the repository browser.