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

Method InitProcess

WinArk/ProcessPropertiesDlg.cpp:43–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43void CProcessPropertiesDlg::InitProcess() {
44 auto pi = m_px.GetProcessInfo();
45 CString text;
46 text.Format(L"%s (%u) Properties", pi->GetImageName().c_str(), pi->Id);
47 SetWindowText(text);
48
49 HICON hIcon = nullptr, hIconBig;
50 ::ExtractIconEx(m_px.GetExecutablePath().c_str(), 0, &hIconBig, &hIcon,1);
51 if (hIcon == nullptr) {
52 hIcon = AtlLoadSysIcon(IDI_APPLICATION);
53 hIconBig = hIcon;
54 }
55 ((CStatic)GetDlgItem(IDC_APPICON)).SetIcon(hIconBig);
56
57 SetDlgItemText(IDC_NAME, (L" " + pi->GetImageName()).c_str());
58 SetDlgItemInt(IDC_PID, pi->Id);
59 auto& path = m_px.GetExecutablePath();
60 bool imagePath = false;
61 if (!path.empty() && path[1] == L':') {
62 imagePath = true;
63 SetDlgItemText(IDC_PATH, path.c_str());
64 }
65 SetDlgItemText(IDC_COMMANDLINE, m_px.GetCommandLine().c_str());
66 text.Format(L"%d bit", m_px.GetBitness());
67 SetDlgItemText(IDC_PLATFORM, text);
68 SetDlgItemText(IDC_USERNAME, m_px.UserName().c_str());
69 SetDlgItemText(IDC_CREATED, FormatHelper::TimeToString(pi->CreateTime));
70
71 if (pi->ParentId > 0) {
72 auto parent = m_pm.GetProcessById(pi->ParentId);
73 if (parent && (parent->CreateTime < pi->CreateTime || parent->Id == 4)) {
74 text.Format(L" %s (%u)", parent->GetImageName().c_str(), parent->Id);
75 }
76 else {
77 text.Format(L" <non-existent> (%u)", pi->ParentId);
78 }
79 }
80 else {
81 text.Empty();
82 }
83 SetDlgItemText(IDC_PARENT, text);
84 SetDlgItemText(IDC_DESC, m_px.GetDescription().c_str());
85
86 GetDlgItem(IDC_EXPLORE).EnableWindow(imagePath);
87 auto dir = m_px.GetCurDirectory();
88 if (dir.empty())
89 GetDlgItem(IDC_EXPLORE_DIR).EnableWindow(FALSE);
90 else
91 SetDlgItemText(IDC_CURDIR, dir.c_str());
92
93 // enable / disable job button
94 GetDlgItem(IDC_JOB).EnableWindow((m_px.GetAttributes(m_pm) & ProcessAttributes::InJob) == ProcessAttributes::InJob);
95}
96
97LRESULT CProcessPropertiesDlg::OnShowEnvironment(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
98 HANDLE hProcess = DriverHelper::OpenProcess(m_px.GetProcessInfo()->Id, PROCESS_QUERY_INFORMATION | PROCESS_VM_READ);

Callers

nothing calls this directly

Calls 8

emptyMethod · 0.80
GetCommandLineMethod · 0.80
GetBitnessMethod · 0.80
UserNameMethod · 0.80
GetCurDirectoryMethod · 0.80
GetAttributesMethod · 0.80
GetProcessInfoMethod · 0.45
GetProcessByIdMethod · 0.45

Tested by

no test coverage detected