#include <stdlib.h>
#include <windows.h>
#include <tlhelp32.h>
#include <wine/debug.h>
#include "taskkill.h"
Go to the source code of this file.
◆ add_to_task_list()
Definition at line 574 of file taskkill.c.
575{
576 static unsigned int list_size = 16;
577
579 {
583 }
585 {
586 void *realloc_list;
587
588 list_size *= 2;
590 if (!realloc_list)
592
594 }
595
598}
static WCHAR ** task_list
static unsigned int task_count
Referenced by process_arguments().
◆ enumerate_processes()
static BOOL enumerate_processes |
( |
void |
| ) |
|
|
static |
Definition at line 162 of file taskkill.c.
163{
165 void *realloc_list;
167
171
175
179
180 do
181 {
185 {
188 if (!realloc_list)
191 }
196}
#define INVALID_HANDLE_VALUE
static unsigned int process_count
static struct @6 * process_list
#define TH32CS_SNAPPROCESS
Referenced by is_netmeeting_running(), and wmain().
◆ find_parent()
Definition at line 310 of file taskkill.c.
311{
314
317
319 {
321 {
324 }
325 }
327}
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
Referenced by mark_child_processes().
◆ mark_child_processes()
static void mark_child_processes |
( |
void |
| ) |
|
|
static |
Definition at line 329 of file taskkill.c.
330{
332
334 {
336 continue;
337#ifdef __REACTOS__
338
340 continue;
341#endif
344 {
346 {
349#ifdef __REACTOS__
350 pkill_list[pkill_size++] =
i;
351#endif
352 break;
353 }
354 }
355 }
356}
static BOOL find_parent(unsigned int process_index, unsigned int *parent_index)
Referenced by wmain().
◆ mark_task_process()
Definition at line 198 of file taskkill.c.
199{
200#ifndef __REACTOS__
202#endif
207
210 {
212 {
214 break;
215 }
216 }
217
219 {
222 {
224 break;
225 }
227 goto not_found;
231 {
234 }
235#ifdef __REACTOS__
236 else
237 {
238 pkill_list[pkill_size++] =
i;
239 }
240#endif
241 return;
242 }
243
245 {
247 {
250 {
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
267 if (pkill_size == 0)
268 {
269#endif
270not_found:
273#ifdef __REACTOS__
274 }
275#endif
276}
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
static int taskkill_message(int msg)
static int WINAPIV taskkill_message_printfW(int msg,...)
#define STRING_SEARCH_FAILED
#define STRING_SELF_TERMINATION
DWORD WINAPI GetCurrentProcessId(void)
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Referenced by wmain().
◆ pid_enum_proc()
Definition at line 146 of file taskkill.c.
147{
150
152
153 if (hwnd_pid ==
info->pid)
154 {
157 }
158
160}
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Referenced by send_close_messages().
◆ process_arguments()
Definition at line 746 of file taskkill.c.
747{
749 {
753
754
756 {
758 if ((*argdata ==
'/' || *argdata ==
'-') && !
lstrcmpW(
L"?", argdata + 1))
759 {
762 }
763 }
764
766 {
768
770 if (*argdata != '/' && *argdata != '-')
772 argdata++;
773
778
779
780 else if ((got_im = !
wcsicmp(
L"im", argdata)) ||
781 (got_pid = !
wcsicmp(
L"pid", argdata)))
782 {
784 {
788 }
789
790 if (got_im) has_im =
TRUE;
791 if (got_pid) has_pid =
TRUE;
792
793 if (has_im && has_pid)
794 {
798 }
799
803 }
804 else
805 {
810 }
811 }
812 }
813 else
814 {
818 }
819
821}
#define STRING_INVALID_OPTION
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
static const WCHAR invalid[]
static BOOL force_termination
static BOOL kill_child_processes
static BOOL add_to_task_list(WCHAR *name)
#define STRING_MISSING_PARAM
#define STRING_MISSING_OPTION
#define STRING_MUTUAL_EXCLUSIVE
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;
483
484#ifdef __REACTOS__
487#else
489#endif
490 {
491#ifdef __REACTOS__
493#else
495 continue;
496#endif
497
504 {
509 else
511 continue;
512 }
515 }
516
518}
static void taskkill_message_print_process(int msg, unsigned int index)
static BOOL CALLBACK pid_enum_proc(HWND hwnd, LPARAM lParam)
#define STRING_CLOSE_CHILD
#define STRING_CLOSE_PROC_SRCH
#define STRING_CLOSE_PID_SEARCH
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
141
143}
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
static int WINAPIV taskkill_printfW(const WCHAR *msg,...)
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()
◆ taskkill_message_printfW()
◆ taskkill_printfW()
◆ taskkill_vprintfW()
Definition at line 78 of file taskkill.c.
79{
80 int wlen;
82 WCHAR msg_buffer[8192];
83
86
88 {
90 char *msgA;
91
92
93
94
98 if (!msgA)
99 return 0;
100
104 }
105
107}
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
#define WideCharToMultiByte
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleW(IN HANDLE hConsoleOutput, IN CONST VOID *lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
UINT WINAPI GetOEMCP(void)
GLuint GLuint GLsizei count
#define STD_OUTPUT_HANDLE
#define FORMAT_MESSAGE_FROM_STRING
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;
527
528#ifdef __REACTOS__
531#else
533#endif
534 {
535#ifdef __REACTOS__
537#else
539 continue;
540#endif
541
546 {
549 continue;
550 }
552 {
553#ifdef __REACTOS__
556 else
557#endif
561 continue;
562 }
567 else
570 }
572}
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
#define PROCESS_TERMINATE
#define STRING_TERM_CHILD_FAILED
#define STRING_TERM_CHILD
#define STRING_TERMINATE_FAILED
#define STRING_TERM_PROC_SEARCH
#define STRING_TERM_PID_SEARCH
Referenced by wmain().
◆ WINE_DEFAULT_DEBUG_CHANNEL()
WINE_DEFAULT_DEBUG_CHANNEL |
( |
taskkill |
| ) |
|
◆ wmain()
Definition at line 825 of file taskkill.c.
826{
827 int search_status = 0, terminate_status;
829
831 return 1;
832
834 {
836 return 1;
837 }
838
839#ifdef __REACTOS__
841 if (!pkill_list)
842 return 1;
844 pkill_size = 0;
845
847#endif
848
855 else
857 return search_status ? search_status : terminate_status;
858}
static int terminate_processes(void)
static void mark_task_process(const WCHAR *str, int *status_code)
static BOOL process_arguments(int argc, WCHAR *argv[])
static void mark_child_processes(void)
static int send_close_messages(void)
static BOOL enumerate_processes(void)
#define STRING_ENUM_FAILED
◆ force_termination
◆ is_numeric
◆ kill_child_processes
◆ matched
Definition at line 46 of file taskkill.c.
Referenced by compare_and_check(), flush_refs(), ldap_parse_resultA(), ldap_parse_resultW(), mark_child_processes(), mark_task_process(), Tokenizer::match(), matches_domain_pattern(), module_find_cb(), pdb_fetch_file_info(), pdb_init(), pdb_process_internal(), FxPkgPnp::PnpEventHardwareAvailable(), FxPkgPnp::PnpEventRestartHardwareAvailable(), FxPkgPnp::PnpEventStartingFromStopped(), search_domain_for_zone(), SECUR32_findPackageW(), send_close_messages(), terminate_processes(), and test_try_transform().
◆ process_count
struct { ... }
* process_list |
◆ task_count
◆ task_list