Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
9.3 KiB

  1. #include <windows.h>
  2. #include "resource.h"
  3. #include "cmdlineres.h"
  4. #include "cmdline.rc"
  5. /////////////////////////////////////////////////////////////////////////////
  6. //
  7. // String Table
  8. //
  9. STRINGTABLE DISCARDABLE
  10. BEGIN
  11. IDS_HELP_LINE1 "\nTASKKILL [/S system [/U username [/P [password]]]]\n"
  12. IDS_HELP_LINE2 " { [/FI filter] [/PID processid | /IM imagename] } [/T] [/F]\n"
  13. IDS_HELP_LINE3 "\n"
  14. IDS_HELP_LINE4 "Description:\n"
  15. IDS_HELP_LINE5 " This tool is used to terminate tasks by process id (PID) or image name.\n"
  16. IDS_HELP_LINE6 ""
  17. IDS_HELP_LINE7 "\n"
  18. IDS_HELP_LINE8 "Parameter List:\n"
  19. IDS_HELP_LINE9 " /S system Specifies the remote system to connect to.\n\n"
  20. IDS_HELP_LINE10 " /U [domain\\]user Specifies the user context under which the\n"
  21. IDS_HELP_LINE11 " command should execute.\n\n"
  22. IDS_HELP_LINE12 " /P [password] Specifies the password for the given user\n"
  23. IDS_HELP_LINE13 " context. Prompts for input if omitted.\n\n"
  24. IDS_HELP_LINE14 " /FI filter Applies a filter to select a set of tasks.\n"
  25. IDS_HELP_LINE15 " Allows ""*"" to be used. ex. imagename eq acme*\n\n"
  26. IDS_HELP_LINE16 " /PID processid Specifies the PID of the process to be terminated.\n"
  27. IDS_HELP_LINE17 " Use TaskList to get the PID.\n\n"
  28. IDS_HELP_LINE18 " /IM imagename Specifies the image name of the process\n"
  29. IDS_HELP_LINE19 " to be terminated. Wildcard '*' can be used\n"
  30. IDS_HELP_LINE20 " to specify all tasks or image names.\n\n"
  31. IDS_HELP_LINE21 " /T Terminates the specified process and any\n"
  32. IDS_HELP_LINE22 " child processes which were started by it.\n\n"
  33. IDS_HELP_LINE23 " /F Specifies to forcefully terminate the process(es).\n\n"
  34. IDS_HELP_LINE24 ""
  35. IDS_HELP_LINE25 " /? Displays this help message.\n"
  36. IDS_HELP_LINE26 "\n"
  37. IDS_HELP_LINE27 "Filters:\n"
  38. IDS_HELP_LINE28 " Filter Name Valid Operators Valid Value(s)\n"
  39. IDS_HELP_LINE29 " ----------- --------------- -------------------------\n"
  40. IDS_HELP_LINE30 " STATUS eq, ne RUNNING |\n"
  41. IDS_HELP_LINE31 " NOT RESPONDING | UNKNOWN\n"
  42. IDS_HELP_LINE32 " IMAGENAME eq, ne Image name\n"
  43. IDS_HELP_LINE33 " PID eq, ne, gt, lt, ge, le PID value\n"
  44. IDS_HELP_LINE34 " SESSION eq, ne, gt, lt, ge, le Session number.\n"
  45. IDS_HELP_LINE35 " CPUTIME eq, ne, gt, lt, ge, le CPU time in the format\n"
  46. IDS_HELP_LINE36 " of hh:mm:ss.\n"
  47. IDS_HELP_LINE37 " hh - hours,\n"
  48. IDS_HELP_LINE38 " mm - minutes, ss - seconds\n"
  49. IDS_HELP_LINE39 " MEMUSAGE eq, ne, gt, lt, ge, le Memory usage in KB\n"
  50. IDS_HELP_LINE40 " USERNAME eq, ne User name in [domain\\]user\n"
  51. IDS_HELP_LINE41 " format\n"
  52. IDS_HELP_LINE42 " MODULES eq, ne DLL name\n"
  53. IDS_HELP_LINE43 " SERVICES eq, ne Service name\n"
  54. IDS_HELP_LINE44 " WINDOWTITLE eq, ne Window title\n"
  55. IDS_HELP_LINE45 "\n"
  56. IDS_HELP_LINE46 " NOTE\n"
  57. IDS_HELP_LINE47 " ----\n"
  58. IDS_HELP_LINE48 " 1) Wildcard '*' for /IM switch is accepted only when a filter is applied.\n"
  59. IDS_HELP_LINE49 " 2) Termination of remote processes will always be done forcefully (/F).\n"
  60. IDS_HELP_LINE50 " 3) ""WINDOWTITLE"" and ""STATUS"" filters are not considered when a remote\n"
  61. IDS_HELP_LINE51 " machine is specified.\n\n"
  62. IDS_HELP_LINE52 "Examples:\n"
  63. IDS_HELP_LINE53 " TASKKILL /IM notepad.exe\n"
  64. IDS_HELP_LINE54 " TASKKILL /PID 1230 /PID 1241 /PID 1253 /T\n"
  65. IDS_HELP_LINE55 " TASKKILL /F /IM cmd.exe /T \n"
  66. IDS_HELP_LINE56 " TASKKILL /F /FI ""PID ge 1000"" /FI ""WINDOWTITLE ne untitle*""\n"
  67. IDS_HELP_LINE57 " TASKKILL /F /FI ""USERNAME eq NT AUTHORITY\\SYSTEM"" /IM notepad.exe\n"
  68. IDS_HELP_LINE58 " TASKKILL /S system /U domain\\username /FI ""USERNAME ne NT*"" /IM *\n"
  69. IDS_HELP_LINE59 " TASKKILL /S system /U username /P password /FI ""IMAGENAME eq note*""\n"
  70. END
  71. STRINGTABLE DISCARDABLE
  72. BEGIN
  73. IDS_FILTER_STATUS "status"
  74. IDS_FILTER_IMAGENAME "imagename"
  75. IDS_FILTER_PID "pid"
  76. IDS_FILTER_SESSION "session"
  77. IDS_FILTER_CPUTIME "cputime"
  78. IDS_FILTER_MEMUSAGE "memusage"
  79. IDS_FILTER_USERNAME "username"
  80. IDS_FILTER_SERVICES "services"
  81. IDS_FILTER_WINDOWNAME "windowtitle"
  82. IDS_FILTER_MODULES "modules"
  83. IDS_FVALUES_STATUS "running|not responding|unknown"
  84. IDS_OPERATORS_STRING " eq | ne "
  85. IDS_OPERATORS_NUMERIC " eq | ne | lt | gt | le | ge "
  86. IDS_VALUE_RUNNING "Running"
  87. IDS_VALUE_NOTRESPONDING "Not Responding"
  88. IDS_VALUE_UNKNOWN "Unknown"
  89. IDS_PID_0_DOMAIN "NT AUTHORITY"
  90. IDS_PID_0_USERNAME "SYSTEM"
  91. END
  92. STRINGTABLE DISCARDABLE
  93. BEGIN
  94. IDS_MSG_KILL_SUCCESS "SUCCESS: The process with PID %d has been terminated.\n"
  95. IDS_MSG_KILL_SUCCESS_QUEUED "SUCCESS: Sent termination signal to the process with PID %d.\n"
  96. IDS_MSG_KILL_SUCCESS_EX "SUCCESS: The process ""%s"" with PID %d has been terminated.\n"
  97. IDS_MSG_KILL_SUCCESS_QUEUED_EX "SUCCESS: Sent termination signal to the process ""%s"" with PID %d.\n"
  98. IDS_MSG_TREE_KILL_SUCCESS "SUCCESS: The process with PID %d (child process of PID %d) has been terminated.\n"
  99. IDS_MSG_TREE_KILL_SUCCESS_QUEUED "SUCCESS: Sent termination signal to process with PID %d, child of PID %d.\n"
  100. IDS_ERROR_KILL_FAILED "ERROR: The process with PID %d could not be terminated.\nReason: %s"
  101. IDS_ERROR_KILL_FAILED_EX "ERROR: The process ""%s"" with PID %d could not be terminated.\nReason: %s"
  102. IDS_ERROR_PROCESS_NOTFOUND "ERROR: The process ""%s"" not found.\n"
  103. IDS_ERROR_TREE_KILL_FAILED "ERROR: The process with PID %d (child process of PID %d) could not be terminated.\nReason: %s"
  104. IDS_ERROR_NO_PROCESSES "\nINFO: No tasks running with the specified criteria.\n"
  105. IDS_ERROR_UNABLE_TO_TERMINATE "Operation is not valid. Error code: %d was returned.\n"
  106. IDS_ERROR_CRITICAL_SYSTEM_PROCESS "This is critical system process. Taskkill cannot end this process.\n"
  107. IDS_ERROR_CANNOT_KILL_SILENTLY "This process can only be terminated forcefully (with /F option).\n"
  108. IDS_ERROR_CANNOT_KILL_ITSELF "The process cannot terminate itself.\n"
  109. IDS_ERROR_TASK_HAS_CHILDS "One or more child processes of this process were still running.\n"
  110. IDS_ERROR_COM_ERROR "%s Error Code: 0x%08lx was returned.\n"
  111. IDS_ERROR_USERNAME_BUT_NOMACHINE "Invalid syntax. /U can be specified only when /S is specified.\nType ""TASKKILL /?"" for usage.\n"
  112. IDS_ERROR_PASSWORD_BUT_NOUSERNAME "Invalid syntax. /P can be specified only when /U is specified.\nType ""TASKKILL /?"" for usage.\n"
  113. IDS_ERROR_USERNAME_EMPTY "Invalid syntax. User name cannot be empty.\n"
  114. IDS_ERROR_SERVER_EMPTY "Invalid syntax. System name cannot be empty.\n"
  115. IDS_ERROR_WILDCARD_WITHOUT_FILTERS "Invalid syntax. '*' is accepted only when a filter is applied.\nType ""TASKKILL /?"" for usage.\n"
  116. IDS_ERROR_PID_OR_IM_ONLY "Invalid syntax. /PID and /IM cannot be used at the same time.\nType ""TASKKILL /?"" for usage.\n"
  117. IDS_ERROR_NO_PID_AND_IM "Invalid syntax. Neither /FI nor /PID nor /IM were specified.\nType ""TASKKILL /?"" for usage.\n"
  118. IDS_ERROR_STRING_FOR_PID "Specify a valid numeric value for '/PID' option.\n"
  119. IDS_ERROR_INVALID_USAGE_REQUEST "Invalid syntax.\nType ""TASKKILL /?"" for usage.\n"
  120. IDS_ERROR_PLATFORM_SHOULD_BE_X86 "The specified command can only be executed by a 64-bit executable.\n"
  121. END
  122. //
  123. // Version resources
  124. //
  125. #include <ntverp.h>
  126. #define VER_FILETYPE VFT_APP
  127. #define VER_FILESUBTYPE VFT2_UNKNOWN
  128. #define VER_FILEDESCRIPTION_STR "Terminates Processes"
  129. #define VER_INTERNALNAME_STR "taskkill.exe"
  130. #define VER_ORIGINALFILENAME_STR "taskkill.exe"
  131. #include <common.ver>