fix_cmd_window: do not show cmd prompt window
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
416832a1ed
commit
e06c373389
8
Cargo.lock
generated
8
Cargo.lock
generated
@ -378,9 +378,12 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
|
||||
checksum = "f0b3de4a0c5e67e16066a0715723abd91edc2f9001d09c46e1dca929351e130e"
|
||||
dependencies = [
|
||||
"serde 1.0.139",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cache-padded"
|
||||
@ -3964,6 +3967,7 @@ dependencies = [
|
||||
"async-process",
|
||||
"async-trait",
|
||||
"base64",
|
||||
"bytes",
|
||||
"cc",
|
||||
"cfg-if 1.0.0",
|
||||
"clap 3.2.12",
|
||||
|
@ -393,8 +393,10 @@ fn get_capturer(use_yuv: bool) -> ResultType<CapturerInfo> {
|
||||
#[cfg(windows)]
|
||||
let mut captuerer_privacy_mode_id = privacy_mode_id;
|
||||
#[cfg(windows)]
|
||||
if crate::ui::win_privacy::is_process_consent_running()? {
|
||||
captuerer_privacy_mode_id = 0;
|
||||
if captuerer_privacy_mode_id != 0 {
|
||||
if crate::ui::win_privacy::is_process_consent_running()? {
|
||||
captuerer_privacy_mode_id = 0;
|
||||
}
|
||||
}
|
||||
log::debug!(
|
||||
"Try create capturer with captuerer privacy mode id {}",
|
||||
|
@ -5,6 +5,7 @@ use crate::{
|
||||
use hbb_common::{allow_err, bail, lazy_static, log, tokio, ResultType};
|
||||
use std::{
|
||||
ffi::CString,
|
||||
os::windows::process::CommandExt,
|
||||
sync::Mutex,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
@ -24,7 +25,9 @@ use winapi::{
|
||||
CreateProcessAsUserW, GetCurrentThreadId, QueueUserAPC, ResumeThread,
|
||||
PROCESS_INFORMATION, STARTUPINFOW,
|
||||
},
|
||||
winbase::{WTSGetActiveConsoleSessionId, CREATE_SUSPENDED, DETACHED_PROCESS},
|
||||
winbase::{
|
||||
WTSGetActiveConsoleSessionId, CREATE_NO_WINDOW, CREATE_SUSPENDED, DETACHED_PROCESS,
|
||||
},
|
||||
winnt::{MEM_COMMIT, PAGE_READWRITE},
|
||||
winuser::*,
|
||||
},
|
||||
@ -317,6 +320,7 @@ fn wait_find_privacy_hwnd(msecs: u128) -> ResultType<HWND> {
|
||||
pub fn is_process_consent_running() -> ResultType<bool> {
|
||||
let output = std::process::Command::new("cmd")
|
||||
.args(&["/C", "tasklist | findstr consent.exe"])
|
||||
.creation_flags(CREATE_NO_WINDOW)
|
||||
.output()?;
|
||||
Ok(output.status.success() && !output.stdout.is_empty())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user