ReactOS 0.4.16-dev-981-g80eb313
taskkill.c File Reference
#include <stdlib.h>
#include <windows.h>
#include <tlhelp32.h>
#include <wine/debug.h>
#include "taskkill.h"
Include dependency graph for taskkill.c:

Go to the source code of this file.

Classes

struct  pid_close_info
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (taskkill)
 
static int taskkill_vprintfW (const WCHAR *msg, va_list va_args)
 
static int WINAPIV taskkill_printfW (const WCHAR *msg,...)
 
static int WINAPIV taskkill_message_printfW (int msg,...)
 
static int taskkill_message (int msg)
 
static BOOL CALLBACK pid_enum_proc (HWND hwnd, LPARAM lParam)
 
static BOOL enumerate_processes (void)
 
static void mark_task_process (const WCHAR *str, int *status_code)
 
static void taskkill_message_print_process (int msg, unsigned int index)
 
static BOOL find_parent (unsigned int process_index, unsigned int *parent_index)
 
static void mark_child_processes (void)
 
static int send_close_messages (void)
 
static int terminate_processes (void)
 
static BOOL add_to_task_list (WCHAR *name)
 
static BOOL process_arguments (int argc, WCHAR *argv[])
 
int wmain (int argc, WCHAR *argv[])
 

Variables

static BOOL force_termination = FALSE
 
static BOOL kill_child_processes = FALSE
 
static WCHAR ** task_list
 
static unsigned int task_count
 
struct {
   PROCESSENTRY32W   p
 
   BOOL   matched
 
   BOOL   is_numeric
 
} * process_list
 
static unsigned int process_count
 

Function Documentation

◆ add_to_task_list()

static BOOL add_to_task_list ( WCHAR name)
static

Definition at line 574 of file taskkill.c.

575{
576 static unsigned int list_size = 16;
577
578 if (!task_list)
579 {
580 task_list = malloc(list_size * sizeof(*task_list));
581 if (!task_list)
582 return FALSE;
583 }
584 else if (task_count == list_size)
585 {
586 void *realloc_list;
587
588 list_size *= 2;
589 realloc_list = realloc(task_list, list_size * sizeof(*task_list));
590 if (!realloc_list)
591 return FALSE;
592
593 task_list = realloc_list;
594 }
595
597 return TRUE;
598}
#define realloc
Definition: debug_ros.c:6
#define malloc
Definition: debug_ros.c:4
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
Definition: name.c:39
static WCHAR ** task_list
Definition: taskkill.c:40
static unsigned int task_count
Definition: taskkill.c:41

Referenced by process_arguments().

◆ enumerate_processes()

static BOOL enumerate_processes ( void  )
static

Definition at line 162 of file taskkill.c.

163{
164 unsigned int alloc_count = 128;
165 void *realloc_list;
167
170 return FALSE;
171
173 if (!process_list)
174 return FALSE;
175
176 process_list[0].p.dwSize = sizeof(process_list[0].p);
178 return FALSE;
179
180 do
181 {
182 process_list[process_count].is_numeric = FALSE;
183 process_list[process_count++].matched = FALSE;
185 {
186 alloc_count *= 2;
187 realloc_list = realloc(process_list, alloc_count * sizeof(*process_list));
188 if (!realloc_list)
189 return FALSE;
190 process_list = realloc_list;
191 }
195 return TRUE;
196}
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
BOOL WINAPI Process32NextW(HANDLE hSnapshot, LPPROCESSENTRY32W lppe)
Definition: toolhelp.c:1073
HANDLE WINAPI CreateToolhelp32Snapshot(DWORD dwFlags, DWORD th32ProcessID)
Definition: toolhelp.c:1255
BOOL WINAPI Process32FirstW(HANDLE hSnapshot, LPPROCESSENTRY32W lppe)
Definition: toolhelp.c:984
GLfloat GLfloat p
Definition: glext.h:8902
long alloc_count
Definition: nc_alloc.cpp:36
static unsigned int process_count
Definition: taskkill.c:50
static struct @6 * process_list
#define TH32CS_SNAPPROCESS
Definition: tlhelp32.h:26

Referenced by is_netmeeting_running(), and wmain().

◆ find_parent()

static BOOL find_parent ( unsigned int  process_index,
unsigned int parent_index 
)
static

Definition at line 310 of file taskkill.c.

311{
312 DWORD parent_id = process_list[process_index].p.th32ParentProcessID;
313 unsigned int i;
314
315 if (!parent_id)
316 return FALSE;
317
318 for (i = 0; i < process_count; ++i)
319 {
320 if (process_list[i].p.th32ProcessID == parent_id)
321 {
322 *parent_index = i;
323 return TRUE;
324 }
325 }
326 return FALSE;
327}
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static DWORD parent_id
Definition: cursoricon.c:2270

Referenced by mark_child_processes().

◆ mark_child_processes()

static void mark_child_processes ( void  )
static

Definition at line 329 of file taskkill.c.

330{
331 unsigned int i, parent;
332
333 for (i = 0; i < process_count; ++i)
334 {
336 continue;
337#ifdef __REACTOS__
338 // Prevent self-termination if we are in the process tree
339 if (process_list[i].p.th32ProcessID == self_pid)
340 continue;
341#endif
342 parent = i;
343 while (find_parent(parent, &parent))
344 {
346 {
347 WINE_TRACE("Adding child %04lx.\n", process_list[i].p.th32ProcessID);
348 process_list[i].matched = TRUE;
349#ifdef __REACTOS__
350 pkill_list[pkill_size++] = i;
351#endif
352 break;
353 }
354 }
355 }
356}
r parent
Definition: btrfs.c:3010
#define WINE_TRACE
Definition: debug.h:354
static BOOL find_parent(unsigned int process_index, unsigned int *parent_index)
Definition: taskkill.c:310
BOOL matched
Definition: taskkill.c:46

Referenced by wmain().

◆ mark_task_process()

static void mark_task_process ( const WCHAR str,
int status_code 
)
static

Definition at line 198 of file taskkill.c.

199{
200#ifndef __REACTOS__
201 DWORD self_pid = GetCurrentProcessId();
202#endif
203 const WCHAR *p = str;
205 unsigned int i;
206 DWORD pid;
207
209 while (*p)
210 {
211 if (!iswdigit(*p++))
212 {
214 break;
215 }
216 }
217
218 if (is_numeric)
219 {
220 pid = wcstol(str, NULL, 10);
221 for (i = 0; i < process_count; ++i)
222 {
223 if (process_list[i].p.th32ProcessID == pid)
224 break;
225 }
227 goto not_found;
228 process_list[i].matched = TRUE;
229 process_list[i].is_numeric = TRUE;
230 if (pid == self_pid)
231 {
233 *status_code = 1;
234 }
235#ifdef __REACTOS__
236 else
237 {
238 pkill_list[pkill_size++] = i;
239 }
240#endif
241 return;
242 }
243
244 for (i = 0; i < process_count; ++i)
245 {
246 if (!wcsicmp(process_list[i].p.szExeFile, str) && !process_list[i].matched)
247 {
248 process_list[i].matched = TRUE;
249 if (process_list[i].p.th32ProcessID == self_pid)
250 {
252 *status_code = 1;
253 }
254#ifdef __REACTOS__
255 else
256 {
257 pkill_list[pkill_size++] = i;
258 continue;
259 }
260#endif
261 return;
262 }
263 }
264
265#ifdef __REACTOS__
266 // Cannot find any process matching the PID or name
267 if (pkill_size == 0)
268 {
269#endif
270not_found:
272 *status_code = 128;
273#ifdef __REACTOS__
274 }
275#endif
276}
#define NULL
Definition: types.h:112
#define wcsicmp
Definition: compat.h:15
unsigned int BOOL
Definition: ntddk_ex.h:94
#define iswdigit(_c)
Definition: ctype.h:667
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
const WCHAR * str
static int taskkill_message(int msg)
Definition: taskkill.c:136
static int WINAPIV taskkill_message_printfW(int msg,...)
Definition: taskkill.c:121
BOOL is_numeric
Definition: taskkill.c:47
#define STRING_SEARCH_FAILED
Definition: taskkill.h:34
#define STRING_SELF_TERMINATION
Definition: taskkill.h:37
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by wmain().

◆ pid_enum_proc()

static BOOL CALLBACK pid_enum_proc ( HWND  hwnd,
LPARAM  lParam 
)
static

Definition at line 146 of file taskkill.c.

147{
148 struct pid_close_info *info = (struct pid_close_info *)lParam;
149 DWORD hwnd_pid;
150
151 GetWindowThreadProcessId(hwnd, &hwnd_pid);
152
153 if (hwnd_pid == info->pid)
154 {
155 PostMessageW(hwnd, WM_CLOSE, 0, 0);
156 info->found = TRUE;
157 }
158
159 return TRUE;
160}
LPARAM lParam
Definition: combotst.c:139
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WM_CLOSE
Definition: winuser.h:1632
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by send_close_messages().

◆ process_arguments()

static BOOL process_arguments ( int  argc,
WCHAR argv[] 
)
static

Definition at line 746 of file taskkill.c.

747{
748 if (argc > 1)
749 {
750 int i;
751 WCHAR *argdata;
752 BOOL has_im = FALSE, has_pid = FALSE;
753
754 /* Only the lone help option is recognized. */
755 if (argc == 2)
756 {
757 argdata = argv[1];
758 if ((*argdata == '/' || *argdata == '-') && !lstrcmpW(L"?", argdata + 1))
759 {
761 exit(0);
762 }
763 }
764
765 for (i = 1; i < argc; i++)
766 {
767 BOOL got_im = FALSE, got_pid = FALSE;
768
769 argdata = argv[i];
770 if (*argdata != '/' && *argdata != '-')
771 goto invalid;
772 argdata++;
773
774 if (!wcsicmp(L"t", argdata))
776 else if (!wcsicmp(L"f", argdata))
778 /* Options /IM and /PID appear to behave identically, except for
779 * the fact that they cannot be specified at the same time. */
780 else if ((got_im = !wcsicmp(L"im", argdata)) ||
781 (got_pid = !wcsicmp(L"pid", argdata)))
782 {
783 if (!argv[i + 1])
784 {
787 return FALSE;
788 }
789
790 if (got_im) has_im = TRUE;
791 if (got_pid) has_pid = TRUE;
792
793 if (has_im && has_pid)
794 {
797 return FALSE;
798 }
799
800 if (!add_to_task_list(argv[i + 1]))
801 return FALSE;
802 i++;
803 }
804 else
805 {
806 invalid:
809 return FALSE;
810 }
811 }
812 }
813 else
814 {
817 return FALSE;
818 }
819
820 return TRUE;
821}
static int argc
Definition: ServiceArgs.c:12
#define STRING_USAGE
Definition: resource.h:44
#define STRING_INVALID_OPTION
Definition: resource.h:55
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4243
static const WCHAR invalid[]
Definition: assoc.c:39
#define argv
Definition: mplay32.c:18
#define L(x)
Definition: ntvdm.h:50
#define exit(n)
Definition: config.h:202
static BOOL force_termination
Definition: taskkill.c:37
static BOOL kill_child_processes
Definition: taskkill.c:38
static BOOL add_to_task_list(WCHAR *name)
Definition: taskkill.c:574
#define STRING_MISSING_PARAM
Definition: taskkill.h:28
#define STRING_MISSING_OPTION
Definition: taskkill.h:27
#define STRING_MUTUAL_EXCLUSIVE
Definition: taskkill.h:29

Referenced by wmain().

◆ send_close_messages()

static int send_close_messages ( void  )
static

Definition at line 477 of file taskkill.c.

478{
479 const WCHAR *process_name;
480 struct pid_close_info info;
481 unsigned int i;
482 int status_code = 0;
483
484#ifdef __REACTOS__
485 DWORD index;
486 for (index = 0; index < pkill_size; ++index)
487#else
488 for (i = 0; i < process_count; i++)
489#endif
490 {
491#ifdef __REACTOS__
492 i = pkill_list[index];
493#else
494 if (!process_list[i].matched)
495 continue;
496#endif
497
498 info.pid = process_list[i].p.th32ProcessID;
499 process_name = process_list[i].p.szExeFile;
500 info.found = FALSE;
501 WINE_TRACE("Terminating pid %04lx.\n", info.pid);
503 if (info.found)
504 {
506 taskkill_message_printfW(STRING_CLOSE_CHILD, info.pid, process_list[i].p.th32ParentProcessID);
507 else if (process_list[i].is_numeric)
509 else
511 continue;
512 }
514 status_code = 128;
515 }
516
517 return status_code;
518}
#define index(s, c)
Definition: various.h:29
GLuint index
Definition: glext.h:6031
static void taskkill_message_print_process(int msg, unsigned int index)
Definition: taskkill.c:278
static BOOL CALLBACK pid_enum_proc(HWND hwnd, LPARAM lParam)
Definition: taskkill.c:146
#define STRING_CLOSE_CHILD
Definition: taskkill.h:38
#define STRING_CLOSE_PROC_SRCH
Definition: taskkill.h:31
#define STRING_CLOSE_PID_SEARCH
Definition: taskkill.h:30
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)

Referenced by wmain().

◆ taskkill_message()

static int taskkill_message ( int  msg)
static

Definition at line 136 of file taskkill.c.

137{
138 WCHAR msg_buffer[8192];
139
140 LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
141
142 return taskkill_printfW(L"%1", msg_buffer);
143}
#define msg(x)
Definition: auth_time.c:54
#define ARRAY_SIZE(A)
Definition: main.h:20
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
static int WINAPIV taskkill_printfW(const WCHAR *msg,...)
Definition: taskkill.c:109
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)

Referenced by mark_task_process(), process_arguments(), and wmain().

◆ taskkill_message_print_process()

static void taskkill_message_print_process ( int  msg,
unsigned int  index 
)
static

Definition at line 278 of file taskkill.c.

279{
280 WCHAR pid_str[16];
281
283 {
285 return;
286 }
287 wsprintfW(pid_str, L"%lu", process_list[index].p.th32ProcessID);
289}
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)

Referenced by send_close_messages(), and terminate_processes().

◆ taskkill_message_printfW()

static int WINAPIV taskkill_message_printfW ( int  msg,
  ... 
)
static

Definition at line 121 of file taskkill.c.

122{
123 va_list va_args;
124 WCHAR msg_buffer[8192];
125 int len;
126
127 LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
128
129 va_start(va_args, msg);
130 len = taskkill_vprintfW(msg_buffer, va_args);
131 va_end(va_args);
132
133 return len;
134}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
GLenum GLsizei len
Definition: glext.h:6722
static int taskkill_vprintfW(const WCHAR *msg, va_list va_args)
Definition: taskkill.c:78

Referenced by mark_task_process(), process_arguments(), send_close_messages(), taskkill_message_print_process(), and terminate_processes().

◆ taskkill_printfW()

static int WINAPIV taskkill_printfW ( const WCHAR msg,
  ... 
)
static

Definition at line 109 of file taskkill.c.

110{
111 va_list va_args;
112 int len;
113
114 va_start(va_args, msg);
115 len = taskkill_vprintfW(msg, va_args);
116 va_end(va_args);
117
118 return len;
119}

Referenced by taskkill_message().

◆ taskkill_vprintfW()

static int taskkill_vprintfW ( const WCHAR msg,
va_list  va_args 
)
static

Definition at line 78 of file taskkill.c.

79{
80 int wlen;
82 WCHAR msg_buffer[8192];
83
84 wlen = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, msg, 0, 0, msg_buffer,
85 ARRAY_SIZE(msg_buffer), &va_args);
86
87 if (!WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), msg_buffer, wlen, &count, NULL))
88 {
89 DWORD len;
90 char *msgA;
91
92 /* On Windows WriteConsoleW() fails if the output is redirected. So fall
93 * back to WriteFile() using OEM code page.
94 */
95 len = WideCharToMultiByte(GetOEMCP(), 0, msg_buffer, wlen,
96 NULL, 0, NULL, NULL);
97 msgA = malloc(len);
98 if (!msgA)
99 return 0;
100
101 WideCharToMultiByte(GetOEMCP(), 0, msg_buffer, wlen, msgA, len, NULL, NULL);
103 free(msgA);
104 }
105
106 return count;
107}
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:203
#define free
Definition: debug_ros.c:5
#define WideCharToMultiByte
Definition: compat.h:111
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleW(IN HANDLE hConsoleOutput, IN CONST VOID *lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved)
Definition: readwrite.c:1447
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
UINT WINAPI GetOEMCP(void)
Definition: locale.c:2060
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define STD_OUTPUT_HANDLE
Definition: winbase.h:294
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:447

Referenced by taskkill_message_printfW(), and taskkill_printfW().

◆ terminate_processes()

static int terminate_processes ( void  )
static

Definition at line 520 of file taskkill.c.

521{
522 const WCHAR *process_name;
523 unsigned int i;
524 int status_code = 0;
526 DWORD pid;
527
528#ifdef __REACTOS__
529 DWORD index;
530 for (index = 0; index < pkill_size; ++index)
531#else
532 for (i = 0; i < process_count; i++)
533#endif
534 {
535#ifdef __REACTOS__
536 i = pkill_list[index];
537#else
538 if (!process_list[i].matched)
539 continue;
540#endif
541
542 pid = process_list[i].p.th32ProcessID;
543 process_name = process_list[i].p.szExeFile;
545 if (!process)
546 {
548 status_code = 128;
549 continue;
550 }
551 if (!TerminateProcess(process, 1))
552 {
553#ifdef __REACTOS__
556 else
557#endif
559 status_code = 1;
561 continue;
562 }
565 else if (process_list[i].is_numeric)
567 else
570 }
571 return status_code;
572}
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1532
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
#define PROCESS_TERMINATE
Definition: pstypes.h:158
#define STRING_TERM_CHILD_FAILED
Definition: taskkill.h:40
#define STRING_TERM_CHILD
Definition: taskkill.h:39
#define STRING_TERMINATE_FAILED
Definition: taskkill.h:36
#define STRING_TERM_PROC_SEARCH
Definition: taskkill.h:33
#define STRING_TERM_PID_SEARCH
Definition: taskkill.h:32

Referenced by wmain().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( taskkill  )

◆ wmain()

int wmain ( int  argc,
WCHAR argv[] 
)

Definition at line 825 of file taskkill.c.

826{
827 int search_status = 0, terminate_status;
828 unsigned int i;
829
831 return 1;
832
833 if (!enumerate_processes())
834 {
836 return 1;
837 }
838
839#ifdef __REACTOS__
840 pkill_list = malloc(process_count * sizeof(unsigned int*));
841 if (!pkill_list)
842 return 1;
843 memset(pkill_list, 0, process_count * sizeof(unsigned int*));
844 pkill_size = 0;
845
846 self_pid = GetCurrentProcessId();
847#endif
848
849 for (i = 0; i < task_count; ++i)
850 mark_task_process(task_list[i], &search_status);
854 terminate_status = terminate_processes();
855 else
856 terminate_status = send_close_messages();
857 return search_status ? search_status : terminate_status;
858}
#define memset(x, y, z)
Definition: compat.h:39
static int terminate_processes(void)
Definition: taskkill.c:520
static void mark_task_process(const WCHAR *str, int *status_code)
Definition: taskkill.c:198
static BOOL process_arguments(int argc, WCHAR *argv[])
Definition: taskkill.c:746
static void mark_child_processes(void)
Definition: taskkill.c:329
static int send_close_messages(void)
Definition: taskkill.c:477
static BOOL enumerate_processes(void)
Definition: taskkill.c:162
#define STRING_ENUM_FAILED
Definition: taskkill.h:35

Variable Documentation

◆ force_termination

BOOL force_termination = FALSE
static

Definition at line 37 of file taskkill.c.

Referenced by process_arguments(), and wmain().

◆ is_numeric

◆ kill_child_processes

BOOL kill_child_processes = FALSE
static

Definition at line 38 of file taskkill.c.

Referenced by process_arguments(), send_close_messages(), terminate_processes(), and wmain().

◆ matched

◆ p

Definition at line 45 of file taskkill.c.

◆ process_count

◆ 

◆ task_count

unsigned int task_count
static

Definition at line 41 of file taskkill.c.

Referenced by add_to_task_list(), and wmain().

◆ task_list

WCHAR** task_list
static

Definition at line 40 of file taskkill.c.

Referenced by add_to_task_list(), test_multiselect(), and wmain().