void FileHandler::Write(const Process& process) { if (_File) { std::string processData(process.ExeFile()); processData.append("\t"); processData.append(process.Filename()); processData.append("\n"); fwrite(processData.c_str(), 1, processData.length(), _File); } }
void ProcessHandler::KillProcess(const Process& process) { std::vector<Process> processes = GetCurrentProcesses(); std::vector<Process>::iterator iter = processes.begin(); for (; iter != processes.end(); ++iter) { if (_stricmp(iter->ExeFile().c_str(), process.ExeFile().c_str()) == 0 || _stricmp(iter->Filename().c_str(), process.Filename().c_str()) == 0) { HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, iter->ProcessID()); if (hProcess) { TerminateProcess(hProcess, 0); } } } }