Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ use crate::infrastructure::native::{
to_wide_null, width, window_userdata_non_null,
};
use crate::system::cpu_topology::CpuTopologyError;
use crate::system::process_identity::ProcIdentity;
use crate::system::process_identity::{ProcIdentity, find_proc_identity};
use crate::system::sampler::{SystemSample, SystemSampleError, SystemSampler};
use crate::ui::assets::{APPLICATION_ICON_RESOURCE, create_accelerator_table, load_icon_resource};
use crate::ui::dialogs::create_dialog;
Expand Down Expand Up @@ -2607,17 +2607,10 @@ unsafe extern "system" fn main_window_proc(
WM_NOTIFY => application.on_notify(lparam),
WM_MENUSELECT => application.on_menu_select(wparam, lparam),
WM_INITMENU => application.on_init_menu(),
WM_FINDPROC => {
let Ok(pid) = u32::try_from(wparam) else {
return 0;
};
let creation_time_100ns = lparam as u64;
if pid == 0 || creation_time_100ns == 0 {
0
} else {
application.on_find_process(ProcIdentity::new(pid, creation_time_100ns))
}
}
WM_FINDPROC => match find_proc_identity(wparam, lparam) {
Some(identity) => application.on_find_process(identity),
None => 0,
},
PWM_INPOPUP => application.on_popup_state(wparam != 0),
PWM_DEFERREDINIT => {
if let Err(error) = application.tray.load_icons() {
Expand Down
15 changes: 12 additions & 3 deletions src/pages/applications/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ use crate::infrastructure::native::{
window_rect_relative_to_page,
};
use crate::infrastructure::worker::{SingleFlightWorker, keep_pending};
use crate::system::process_identity::{ProcIdentity, query_process_identity_for_pid};
use crate::system::process_identity::{
FindProcPayload, ProcIdentity, find_proc_lparam, query_process_identity_for_pid,
};
use crate::ui::localization::{TextKey, text};
use crate::ui::menus::build_popup_menu;
use crate::ui::resource_ids::{
Expand Down Expand Up @@ -493,11 +495,18 @@ impl TaskPageState {
if let Some(identity) = self.selected_task_identities(true).first().copied()
&& window_matches_actionable_identity(identity)
{
// The payload lives on this stack until SendMessageW returns. The
// receiver copies both fields during that synchronous call, so the
// 64-bit creation time is not narrowed to LPARAM.
let payload = FindProcPayload {
pid: identity.process.pid,
creation_time_100ns: identity.process.creation_time_100ns,
};
SendMessageW(
self.main_hwnd,
crate::ui::resource_ids::WM_FINDPROC,
identity.process.pid as usize,
identity.process.creation_time_100ns as isize,
payload.pid as usize,
find_proc_lparam(&payload),
);
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/pages/processes/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ pub(super) struct ProcStaticMetadata {
pub(super) user_name_lower: String,
pub(super) session_id: Option<u32>,
pub(super) user_identity_resolved: bool,
// Set when this identity refuses a limited process open. Later refreshes keep the
// SystemProcessInformation counters and do not open it again.
pub(super) query_access_denied: bool,
}

pub(super) fn compare_entries(
Expand Down
Loading