ReactOS 0.4.15-dev-7712-gbbbcd8e
kill.c File Reference
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
Include dependency graph for kill.c:

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN   /* Exclude rarely-used stuff from Windows headers */
 

Functions

int ExecuteKill (char *lpPid)
 
int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN   /* Exclude rarely-used stuff from Windows headers */

Definition at line 31 of file kill.c.

Function Documentation

◆ ExecuteKill()

int ExecuteKill ( char lpPid)

Definition at line 37 of file kill.c.

38{
40 DWORD dwProcessId;
41
42 dwProcessId = (DWORD) atol(lpPid);
43 fprintf( stderr, "Killing PID %ld...\n",dwProcessId);
46 FALSE,
47 dwProcessId
48 );
49 if (NULL == hProcess)
50 {
51 fprintf( stderr, "Could not open the process with PID = %ld\n", dwProcessId);
52 return 0;
53 }
56 0
57 )
58 ) {
59 fprintf( stderr, "Could not terminate the process with PID = %ld\n", dwProcessId);
60 return 0;
61 }
63 return 0;
64}
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
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
unsigned long DWORD
Definition: ntddk_ex.h:95
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_ long __cdecl atol(_In_z_ const char *_Str)
#define PROCESS_TERMINATE
Definition: pstypes.h:157
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:71
#define DWORD
Definition: nt_native.h:44

Referenced by main().

◆ main()

int main ( int argc  ,
char argv[] 
)

Definition at line 66 of file kill.c.

67{
68 char tail;
70
71 if (argc < 2)
72 {
73 fprintf( stderr, "Usage: %s PID (Process ID) \n", argv[0] );
74 return 1;
75 }
76 tail = ExecuteKill(argv[1]);
77 return 0;
78}
static int argc
Definition: ServiceArgs.c:12
struct outqueuenode * tail
Definition: adnsresfilter.c:66
int ExecuteKill(char *lpPid)
Definition: kill.c:37
#define argv
Definition: mplay32.c:18
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
Definition: ntbasedef.h:319