A simple C WinAPI program for terminating processes via process image names - follow-up (See the previous (i.e. first) version of this tool.)
(See the next follow-up.)
After taking into consideration all the advice by Martin R, I ended up with the following tool for terminating all the processes with given process image names:
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;windows.h&gt;
#include &lt;TlHelp32.h&gt;

int main(int argc, char* argv[]) {
    if (argc != 2) {
        fprintf(stderr, &quot;processkiller.exe PROCESS_NAME&quot;);
        return EXIT_FAILURE;
    }

    PROCESSENTRY32 entry;
    entry.dwSize = sizeof(PROCESSENTRY32);
    HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);

    if (snapshot == INVALID_HANDLE_VALUE) {
        fputs(&quot;Error: could not get the process snapshot.&quot;, stderr);
        return EXIT_FAILURE;
    }

    size_t totalProcessesMatched = 0;
    size_t totalProcessesTerminated = 0;

    if (Process32First(snapshot, &amp;entry)) {
        do {
            if (strcmp(entry.szExeFile, argv[1]) == 0) {
                totalProcessesMatched++;

                HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 
                                              FALSE, 
                                              entry.th32ProcessID);

                if (hProcess == NULL) {
                    fprintf(stderr,
                            &quot;Error: could not open the process with ID = %d, &quot;
                            &quot;called \&quot;%s\&quot;.\n&quot;, 
                            entry.th32ProcessID, 
                            entry.szExeFile);
                } else {
                    BOOL terminated = TerminateProcess(hProcess, 0);

                    if (terminated) {
                        totalProcessesTerminated++;

                        BOOL closed = CloseHandle(hProcess);

                        if (!closed) {
                            fprintf(stderr,
                                    &quot;Warning: could not close a handle &quot;
                                    &quot;for process ID = %d, called \&quot;%s\&quot;.\n&quot;,
                                    entry.th32ProcessID, 
                                    entry.szExeFile);
                        }

                        printf(&quot;Terminated process ID %d\n&quot;, entry.th32ProcessID);
                    }
                }
            }
        } while (Process32Next(snapshot, &amp;entry));
    }

    BOOL snapshotHandleClosed = CloseHandle(snapshot);

    if (!snapshotHandleClosed) {
        fputs(&quot;Warning: could not close the process snapshot.&quot;, stderr);
    }

    printf(&quot;Info: total matching processes: %d, total terminated: %d.\n&quot;, 
           totalProcessesMatched, 
           totalProcessesTerminated);

    return EXIT_SUCCESS;
}

Critique request
Am I going anywhere? Is this tool coded properly? Am I sufficiently verbose about statistics/error information?
Regarding:
size_t totalProcessesMatched = 0;
size_t totalProcessesTerminated = 0;
...
printf(&quot;Info: total matching processes: %d, total terminated: %d.\n&quot;, 
       totalProcessesMatched, 
       totalProcessesTerminated);

the printf() is trying to output a int, but the variables to output are size_t which should be output using a %zu format specifier.
If you compiler is not telling you about these kinds of problems, then enable the warnings until it does.
regarding;
fprintf(stderr, &quot;processkiller.exe PROCESS_NAME&quot;);  

This would be 1) left in the stderr output stream because the format string does not have a \n on the end of it.  2) any program can be executed via any name so hard coding the name is a bad idea.  Suggest:
fprintf(stderr, &quot;%s PROCESS_NAME\n&quot;, argv[0] );

regarding:
fputs(&quot;Error: could not get the process snapshot.&quot;, stderr);

strongly suggest making use of the get_last_error() facility and printing the actual error text to stderr rather than some 'random' error message
regarding;
if (strcmp(entry.szExeFile, argv[1]) == 0) {

this does not compile because the statement:
#include &lt;string.h&gt;

is missing.