Reduce required permissions on OpenProcess
This commit is contained in:
@@ -3,7 +3,7 @@ use std::error::Error;
|
||||
use windows::Win32::{
|
||||
Foundation::{CloseHandle, MAX_PATH},
|
||||
System::Threading::{
|
||||
OpenProcess, QueryFullProcessImageNameW, PROCESS_QUERY_INFORMATION, PROCESS_VM_READ,
|
||||
OpenProcess, QueryFullProcessImageNameW, PROCESS_QUERY_LIMITED_INFORMATION
|
||||
},
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ pub fn pid_to_exe_path(pid: u32) -> Result<String, Box<dyn Error>> {
|
||||
let mut exe_name: Vec<u16> = Vec::with_capacity(MAX_PATH as usize);
|
||||
let mut size: u32 = exe_name.capacity().try_into().unwrap();
|
||||
unsafe {
|
||||
let process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, false, pid)?;
|
||||
let process = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, false, pid)?;
|
||||
QueryFullProcessImageNameW(
|
||||
process,
|
||||
Default::default(),
|
||||
|
||||
Reference in New Issue
Block a user