void killAllWERProcesses(void) { DWORD werFault = getProcessID("WerFault.exe"); while (werFault != 0) { killProcessByID(werFault); Sleep(1000); werFault = getProcessID("WerFault.exe"); } } // end of killAllWERProcesses()
int killProcessList (char* processName) { PROCESSENTRY32 pe32; HANDLE hProcessSnap; BOOL rProcessFound; hProcessSnap=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hProcessSnap == INVALID_HANDLE_VALUE) return 1; pe32.dwSize=sizeof(pe32); rProcessFound=Process32First(hProcessSnap,&pe32); //here the killing spree begins --- mua haa haa haa do if (strcmp (processName, pe32.szExeFile) == 0) { //fprintf (stdout, "%s: %d\n", pe32.szExeFile, pe32.th32ProcessID); if (killProcessByID (pe32.th32ProcessID)) return 2; } while (rProcessFound=Process32Next (hProcessSnap,&pe32)); CloseHandle(hProcessSnap); return 0; }