fix, win privacy mode, broker process
Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
parent
84d7115e36
commit
1648895156
@ -40,6 +40,7 @@ class _DesktopServerPageState extends State<DesktopServerPage>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
bind.cmClear();
|
||||||
windowManager.removeListener(this);
|
windowManager.removeListener(this);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
@ -931,6 +931,11 @@ pub mod connection_manager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
pub fn cm_clear() {
|
||||||
|
crate::privacy_win_mag::stop();
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
use hbb_common::tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender};
|
use hbb_common::tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender};
|
||||||
|
|
||||||
|
@ -1453,6 +1453,11 @@ pub fn cm_start_listen_ipc_thread() {
|
|||||||
crate::flutter::connection_manager::start_listen_ipc_thread();
|
crate::flutter::connection_manager::start_listen_ipc_thread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn cm_clear() {
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
crate::flutter::connection_manager::cm_clear();
|
||||||
|
}
|
||||||
|
|
||||||
/// Start an ipc server for receiving the url scheme.
|
/// Start an ipc server for receiving the url scheme.
|
||||||
///
|
///
|
||||||
/// * Should only be called in the main flutter window.
|
/// * Should only be called in the main flutter window.
|
||||||
|
@ -2273,6 +2273,15 @@ fn run_after_run_cmds(silent: bool) {
|
|||||||
std::thread::sleep(std::time::Duration::from_millis(300));
|
std::thread::sleep(std::time::Duration::from_millis(300));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn try_kill_broker() {
|
||||||
|
allow_err!(run_cmds(
|
||||||
|
format!("taskkill /F /IM {}", WIN_MAG_INJECTED_PROCESS_EXE),
|
||||||
|
false,
|
||||||
|
"kill_broker"
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
@ -59,6 +59,12 @@ struct WindowHandlers {
|
|||||||
|
|
||||||
impl Drop for WindowHandlers {
|
impl Drop for WindowHandlers {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
|
self.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WindowHandlers {
|
||||||
|
fn reset(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
if self.hthread != 0 {
|
if self.hthread != 0 {
|
||||||
CloseHandle(self.hthread as _);
|
CloseHandle(self.hthread as _);
|
||||||
@ -257,6 +263,10 @@ pub fn start() -> ResultType<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn stop() {
|
||||||
|
WND_HANDLERS.lock().unwrap().reset();
|
||||||
|
}
|
||||||
|
|
||||||
unsafe fn inject_dll<'a>(hproc: HANDLE, hthread: HANDLE, dll_file: &'a str) -> ResultType<()> {
|
unsafe fn inject_dll<'a>(hproc: HANDLE, hthread: HANDLE, dll_file: &'a str) -> ResultType<()> {
|
||||||
let dll_file_utf16: Vec<u16> = dll_file.encode_utf16().chain(Some(0).into_iter()).collect();
|
let dll_file_utf16: Vec<u16> = dll_file.encode_utf16().chain(Some(0).into_iter()).collect();
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ impl Server {
|
|||||||
// get a new unique id
|
// get a new unique id
|
||||||
pub fn get_new_id(&mut self) -> i32 {
|
pub fn get_new_id(&mut self) -> i32 {
|
||||||
self.id_count += 1;
|
self.id_count += 1;
|
||||||
self.id_count
|
self.id_count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,6 +389,8 @@ pub async fn start_server(is_server: bool) {
|
|||||||
}
|
}
|
||||||
#[cfg(any(target_os = "macos", target_os = "linux"))]
|
#[cfg(any(target_os = "macos", target_os = "linux"))]
|
||||||
tokio::spawn(async { sync_and_watch_config_dir().await });
|
tokio::spawn(async { sync_and_watch_config_dir().await });
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
crate::platform::try_kill_broker();
|
||||||
crate::RendezvousMediator::start_all().await;
|
crate::RendezvousMediator::start_all().await;
|
||||||
} else {
|
} else {
|
||||||
match crate::ipc::connect(1000, "").await {
|
match crate::ipc::connect(1000, "").await {
|
||||||
|
@ -533,7 +533,6 @@ pub async fn start_ipc<T: InvokeUiCM>(cm: ConnectionManager<T>) {
|
|||||||
e
|
e
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
allow_err!(crate::privacy_win_mag::start());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user