27#include <wine/unicode.h>
40static WCHAR opForceTerminate[] =
L"f";
41static WCHAR opImage[] =
L"im";
42static WCHAR opPID[] =
L"pid";
43static WCHAR opHelp[] =
L"?";
44static WCHAR opTerminateChildren[] =
L"t";
46static PWCHAR opList[] = {opForceTerminate, opImage, opPID, opHelp, opTerminateChildren};
48#define OP_PARAM_INVALID -1
50#define OP_PARAM_FORCE_TERMINATE 0
51#define OP_PARAM_IMAGE 1
53#define OP_PARAM_HELP 3
54#define OP_PARAM_TERMINATE_CHILD 4
68 WCHAR msg_buffer[8192];
113 WCHAR msg_buffer[8192];
127 static const WCHAR formatW[] = {
'%',
'1',0};
128 WCHAR msg_buffer[8192];
143 if (hwnd_pid ==
info->pid)
154 DWORD *pid_list, alloc_bytes = 1024 *
sizeof(*pid_list), needed_bytes;
175 if (alloc_bytes != needed_bytes)
185 pid_list = realloc_list;
188 *
list_count = needed_bytes /
sizeof(*pid_list);
237 DWORD *pid_list, pid_list_size;
299 found_process =
TRUE;
300 if (pid_list[
index] == self_pid)
332 DWORD *pid_list, pid_list_size;
426 found_process =
TRUE;
431 if (pid_list[
index] == self_pid)
460 found_process =
TRUE;
490 static unsigned int list_size = 16;
518static int get_argument_type(
WCHAR* argument)
522 if (argument[0] !=
L'/' && argument[0] !=
L'-')
524 return OP_PARAM_INVALID;
535 return OP_PARAM_INVALID;
551 int argument = get_argument_type(
argv[
i]);
555 case OP_PARAM_FORCE_TERMINATE:
577 if (argument == OP_PARAM_IMAGE)
579 if (argument == OP_PARAM_PID)
582 if (has_im && has_pid)
589 if (get_argument_type(
argv[
i + 1]) != OP_PARAM_INVALID)
603 if (has_help ==
TRUE)
613 case OP_PARAM_TERMINATE_CHILD:
618 case OP_PARAM_INVALID:
643 else if ((!has_im) && (!has_pid))
661 static const WCHAR opForceTerminate[] = {
'f',0};
662 static const WCHAR opImage[] = {
'i',
'm',0};
663 static const WCHAR opPID[] = {
'p',
'i',
'd',0};
664 static const WCHAR opHelp[] = {
'?',0};
665 static const WCHAR opTerminateChildren[] = {
't',0};
677 if ((*argdata ==
'/' || *argdata ==
'-') && !
strcmpW(opHelp, argdata + 1))
689 if (*argdata !=
'/' && *argdata !=
'-')
693 if (!
strcmpiW(opTerminateChildren, argdata))
695 if (!
strcmpiW(opForceTerminate, argdata))
699 else if ((got_im = !
strcmpiW(opImage, argdata)) ||
700 (got_pid = !
strcmpiW(opPID, argdata)))
709 if (got_im) has_im =
TRUE;
710 if (got_pid) has_pid =
TRUE;
712 if (has_im && has_pid)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define STRING_INVALID_SYNTAX
#define STRING_INVALID_OPTION
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
#define HeapFree(x, y, z)
#define WideCharToMultiByte
UINT WINAPI DECLSPEC_HOTPATCH GetConsoleOutputCP(VOID)
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)
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
BOOL WINAPI EnumProcessModules(HANDLE hProcess, HMODULE *lphModule, DWORD cb, LPDWORD lpcbNeeded)
BOOL WINAPI EnumProcesses(DWORD *lpidProcess, DWORD cb, LPDWORD lpcbNeeded)
DWORD WINAPI GetModuleBaseNameW(HANDLE hProcess, HMODULE hModule, LPWSTR lpBaseName, DWORD nSize)
GLuint GLuint GLsizei count
GLenum GLuint GLenum GLsizei const GLchar * buf
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
#define PROCESS_TERMINATE
#define PROCESS_QUERY_INFORMATION
static const WCHAR invalid[]
__WINE_SERVER_LIST_INLINE unsigned int list_count(const struct list *list)
static int terminate_processes(void)
static BOOL force_termination
static int taskkill_message(int msg)
static BOOL CALLBACK pid_enum_proc(HWND hwnd, LPARAM lParam)
static WCHAR ** task_list
static DWORD * enumerate_processes(DWORD *list_count)
static int WINAPIV taskkill_printfW(const WCHAR *msg,...)
static BOOL process_arguments(int argc, WCHAR *argv[])
static BOOL add_to_task_list(WCHAR *name)
static int WINAPIV taskkill_message_printfW(int msg,...)
static BOOL get_process_name_from_pid(DWORD pid, WCHAR *buf, DWORD chars)
static int taskkill_vprintfW(const WCHAR *msg, __ms_va_list va_args)
static int send_close_messages(void)
static unsigned int task_count
#define STRING_ENUM_FAILED
#define STRING_SEARCH_FAILED
#define STRING_MISSING_PARAM
#define STRING_MISSING_OPTION
#define STRING_TERMINATE_FAILED
#define STRING_CLOSE_PROC_SRCH
#define STRING_TERM_PROC_SEARCH
#define STRING_PARAM_TOO_MUCH
#define STRING_SELF_TERMINATION
#define STRING_MUTUAL_EXCLUSIVE
#define STRING_CLOSE_PID_SEARCH
#define STRING_TERM_PID_SEARCH
#define STD_OUTPUT_HANDLE
#define FORMAT_MESSAGE_FROM_STRING
DWORD WINAPI GetCurrentProcessId(void)
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
#define __ms_va_end(list)
#define __ms_va_start(list, arg)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)