MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / OnShowJob

Method OnShowJob

WinArk/ProcessPropertiesDlg.cpp:127–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127LRESULT 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
159LRESULT CProcessPropertiesDlg::OnExplore(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
160 if ((INT_PTR)::ShellExecute(nullptr, L"open", L"explorer",

Callers

nothing calls this directly

Calls 8

IsInJobMethod · 0.80
GetProcessMethod · 0.80
push_backMethod · 0.80
emptyMethod · 0.80
EnumHandlesMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetObjectNameMethod · 0.45

Tested by

no test coverage detected