12 HMODULE kernel32 = GetModuleHandleA(
"kernel32");
13 if (!kernel32)
return false;
15 FARPROC procPtr = GetProcAddress(kernel32,
"IsWow64Process");
20 BOOL(WINAPI * is_process_wow64)(IN HANDLE, OUT PBOOL)
21 = (BOOL(WINAPI*)(IN HANDLE, OUT PBOOL))procPtr;
23 BOOL isCurrWow64 = FALSE;
24 if (!is_process_wow64(process, &isCurrWow64)) {
27 return isCurrWow64 ? true :
false;
42 inline bool get_process_path(DWORD processID, WCHAR* szProcessName,
size_t processNameSize)
44 if (!szProcessName || !processNameSize)
return false;
46 HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, processID);
48 hProcess = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, processID);
49 if (!hProcess)
return false;
51 DWORD exeNameSize = processNameSize;
52 BOOL isOK = QueryFullProcessImageNameW(hProcess, 0, szProcessName, &exeNameSize);
53 CloseHandle(hProcess);
55 if (!isOK || !exeNameSize) {
77 std::vector<DWORD>::iterator itr;
78 for (itr = suspicious_pids.begin(); itr != suspicious_pids.end(); ++itr) {
80 HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
84 if (TerminateProcess(hProcess, 0)) {
88 std::cerr <<
"Could not terminate the process. PID = " << pid << std::endl;
90 CloseHandle(hProcess);