| 125 | } |
| 126 | |
| 127 | LRESULT CProcessPropertiesDlg::OnShowJob(WORD, WORD wID, HWND, BOOL&) { |
| 128 | ObjectManager mgr; |
| 129 | mgr.EnumHandles(L"Job"); |
| 130 | HANDLE hJob{ nullptr }; |
| 131 | USHORT type = 0; |
| 132 | std::vector<HANDLE> handles; |
| 133 | for (auto& hi : mgr.GetHandles()) { |
| 134 | hJob = DriverHelper::DupHandle(UlongToHandle(hi->HandleValue), hi->ProcessId, JOB_OBJECT_QUERY | SYNCHRONIZE, 0); |
| 135 | if (!hJob) |
| 136 | continue; |
| 137 | if (m_px.GetProcess()->IsInJob(hJob)) { |
| 138 | handles.push_back(hJob); |
| 139 | if (type == 0) |
| 140 | type = hi->ObjectTypeIndex; |
| 141 | } |
| 142 | hJob = nullptr; |
| 143 | } |
| 144 | if (handles.empty()) { |
| 145 | AtlMessageBox(*this, L"Failed to open job object", IDS_TITLE, MB_ICONERROR); |
| 146 | return 0; |
| 147 | } |
| 148 | hJob = handles.back(); |
| 149 | handles.pop_back(); |
| 150 | std::for_each(handles.begin(), handles.end(), [](auto h) { ::CloseHandle(h); }); |
| 151 | |
| 152 | auto name = mgr.GetObjectName(hJob, type); |
| 153 | CJobPropertiesDlg dlg(m_pm, hJob, name.c_str()); |
| 154 | dlg.DoModal(); |
| 155 | ::CloseHandle(hJob); |
| 156 | return 0; |
| 157 | } |
| 158 | |
| 159 | LRESULT CProcessPropertiesDlg::OnExplore(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { |
| 160 | if ((INT_PTR)::ShellExecute(nullptr, L"open", L"explorer", |
nothing calls this directly
no test coverage detected