| 45 | } |
| 46 | |
| 47 | void CJobPropertiesDlg::UpdateJob() { |
| 48 | CClientDC dc(*this); |
| 49 | DrawStats(dc); |
| 50 | |
| 51 | // update process list |
| 52 | BYTE buffer[1 << 11]; |
| 53 | if (::QueryInformationJobObject(m_hJob, JobObjectBasicProcessIdList, buffer, sizeof(buffer), nullptr)) { |
| 54 | auto info = reinterpret_cast<JOBOBJECT_BASIC_PROCESS_ID_LIST*>(buffer); |
| 55 | |
| 56 | m_Processes.clear(); |
| 57 | auto count = info->NumberOfProcessIdsInList; |
| 58 | m_Processes.reserve(count); |
| 59 | for (DWORD i = 0; i < count; i++) { |
| 60 | auto pid = static_cast<DWORD>(info->ProcessIdList[i]); |
| 61 | ProcessInfo pi; |
| 62 | pi.Id = pid; |
| 63 | pi.Name = m_pm.GetProcessNameById(pid); |
| 64 | m_Processes.emplace_back(std::move(pi)); |
| 65 | } |
| 66 | m_ProcList.SetItemCountEx(static_cast<int>(count), LVSICF_NOSCROLL); |
| 67 | } |
| 68 | |
| 69 | m_Limits.clear(); |
| 70 | m_Limits.reserve(8); |
| 71 | { |
| 72 | JOBOBJECT_EXTENDED_LIMIT_INFORMATION info; |
| 73 | if (::QueryInformationJobObject(m_hJob, JobObjectExtendedLimitInformation, &info, sizeof(info), nullptr)) { |
| 74 | auto flags = info.BasicLimitInformation.LimitFlags; |
| 75 | if (flags & JOB_OBJECT_LIMIT_ACTIVE_PROCESS) |
| 76 | AddLimit(L"Active Processes", info.BasicLimitInformation.ActiveProcessLimit); |
| 77 | if (flags & JOB_OBJECT_LIMIT_BREAKAWAY_OK) |
| 78 | AddLimit(L"Breakway OK", L""); |
| 79 | if (flags & JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION) |
| 80 | AddLimit(L"Die on Unhandled Exception", L""); |
| 81 | if (flags & JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK) |
| 82 | AddLimit(L"Silent Breakaway OK", L""); |
| 83 | if (flags & JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE) |
| 84 | AddLimit(L"Kill on Job Close", L""); |
| 85 | if (flags & JOB_OBJECT_LIMIT_PRIORITY_CLASS) |
| 86 | AddLimit(L"Priority Class", |
| 87 | CString(FormatHelper::PriorityClassToString( |
| 88 | (WinSys::ProcessPriorityClass)info.BasicLimitInformation.PriorityClass))); |
| 89 | if (flags & JOB_OBJECT_LIMIT_SCHEDULING_CLASS) |
| 90 | AddLimit(L"Scheduling Class", info.BasicLimitInformation.SchedulingClass); |
| 91 | if (flags & JOB_OBJECT_LIMIT_AFFINITY) |
| 92 | AddLimit(L"Affinity: ", info.BasicLimitInformation.Affinity); |
| 93 | if (flags & JOB_OBJECT_LIMIT_JOB_MEMORY) |
| 94 | AddLimit(L"Job Memory", (std::to_wstring(info.JobMemoryLimit>>20)+L" MB").c_str()); |
| 95 | if (flags & JOB_OBJECT_LIMIT_PROCESS_MEMORY) |
| 96 | AddLimit(L"Process Memory", std::to_wstring(info.ProcessMemoryLimit >> 20) + L" MB"); |
| 97 | if (flags & JOB_OBJECT_LIMIT_WORKINGSET) |
| 98 | AddLimit(L"Maximum Working Set", (std::to_wstring(info.BasicLimitInformation.MaximumWorkingSetSize >> 20) + L" MB").c_str()); |
| 99 | } |
| 100 | } |
| 101 | { |
| 102 | JOBOBJECT_BASIC_UI_RESTRICTIONS info; |
| 103 | if (::QueryInformationJobObject(m_hJob, JobObjectBasicUIRestrictions, &info, sizeof(info), nullptr)) { |
| 104 | static struct { |
nothing calls this directly
no test coverage detected