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