1 | /* $Id: libDosKillProcessEx.c,v 1.1 2001-07-09 23:48:52 bird Exp $
|
---|
2 | *
|
---|
3 | * DosKillProcessEx - Extened Edition of DosKillProcess.
|
---|
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 | * Header Files *
|
---|
14 | *******************************************************************************/
|
---|
15 | #define INCL_DOSERRORS
|
---|
16 | #define INCL_DOSFILEMGR
|
---|
17 | #define INCL_DOSDEVICES
|
---|
18 |
|
---|
19 |
|
---|
20 | /*******************************************************************************
|
---|
21 | * Internal Functions *
|
---|
22 | *******************************************************************************/
|
---|
23 | #include <os2.h>
|
---|
24 | #include "win32k.h"
|
---|
25 | #include "libPrivate.h"
|
---|
26 |
|
---|
27 |
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * Extended DosKillProcess API.
|
---|
31 | * @returns NO_ERROR on success.
|
---|
32 | * ERROR_SIGNAL_PENDING returned if a kill signal is allready pending.
|
---|
33 | * ERROR_INIT_ROUTINE_FAILED if library isn't initiated.
|
---|
34 | * (Try set DKP_FLAG_KILL9.)
|
---|
35 | * other error code..
|
---|
36 | * @param flAction Action and flags defined in os2 headers and win32k.h
|
---|
37 | * @param pid Pid to kill or top of process tree to kill.
|
---|
38 | * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
|
---|
39 | */
|
---|
40 | APIRET APIENTRY DosKillProcessEx(ULONG flAction, PID pid)
|
---|
41 | {
|
---|
42 | APIRET rc;
|
---|
43 |
|
---|
44 | if (fInited)
|
---|
45 | {
|
---|
46 | K32KILLPROCESSEX Param;
|
---|
47 | ULONG cbParam = sizeof(Param);
|
---|
48 | ULONG cbData = 0UL;
|
---|
49 |
|
---|
50 | Param.hdr.cb = sizeof(Param);
|
---|
51 | Param.hdr.rc = ERROR_NOT_SUPPORTED;
|
---|
52 | Param.flAction = flAction;
|
---|
53 | Param.pid = pid;
|
---|
54 |
|
---|
55 | if (usCGSelector)
|
---|
56 | return libCallThruCallGate(K32_KILLPROCESSEX, &Param);
|
---|
57 | rc = DosDevIOCtl(hWin32k,
|
---|
58 | IOCTL_W32K_K32,
|
---|
59 | K32_KILLPROCESSEX,
|
---|
60 | &Param, sizeof(Param), &cbParam,
|
---|
61 | "", 1, &cbData);
|
---|
62 | if (rc == NO_ERROR)
|
---|
63 | rc = Param.hdr.rc;
|
---|
64 | }
|
---|
65 | else
|
---|
66 | rc = ERROR_INIT_ROUTINE_FAILED;
|
---|
67 |
|
---|
68 | return rc;
|
---|
69 | }
|
---|
70 |
|
---|