gboolean process_is_running (const char *process_name) { HANDLE proc_handle = get_process_handle(process_name); if (proc_handle) { CloseHandle(proc_handle); return TRUE; } else { return FALSE; } }
int win32_kill_process (const char *process_name) { HANDLE proc_handle = get_process_handle(process_name); if (proc_handle) { TerminateProcess(proc_handle, 0); CloseHandle(proc_handle); return 0; } else { return -1; } }
void runner::get_times(unsigned long long *_creation_time, unsigned long long *exit_time, unsigned long long *kernel_time, unsigned long long *user_time) { FILETIME __creation_time; FILETIME _exit_time; FILETIME _kernel_time; FILETIME _user_time; GetProcessTimes(get_process_handle(), &__creation_time, &_exit_time, &_kernel_time, &_user_time); if (_creation_time) { *_creation_time = *reinterpret_cast<unsigned long long*>(&__creation_time); } if (exit_time) { *exit_time = *reinterpret_cast<unsigned long long*>(&_exit_time); } if (kernel_time) { *kernel_time = *reinterpret_cast<unsigned long long*>(&_kernel_time); } if (user_time) { *user_time = *reinterpret_cast<unsigned long long*>(&_user_time); } }