Merge pull request #1018 from fufesou/fix_cmd_window
fix_cmd_window: do not show cmd prompt window
This commit is contained in:
		
						commit
						515d90644a
					
				| @ -343,9 +343,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