Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

fix: win, prompt uac, update_install_option (#11741)

fufesouf56c5c1bbbb5
diff --git a/src/platform/windows.rs b/src/platform/windows.rs
index f17b21044..7ec5b5a15 100644
--- a/src/platform/windows.rs
+++ b/src/platform/windows.rs
@@ -1658,27 +1658,13 @@ pub fn get_license_from_exe_name() -> ResultType<CustomServer> {
get_custom_server_from_string(&exe)
}
-pub fn check_update_printer_option() {
- if !is_installed() {
- return;
- }
- let app_name = crate::get_app_name();
- if let Ok(b) = remote_printer::is_rd_printer_installed(&app_name) {
- let v = if b { "1" } else { "0" };
- if let Err(e) = update_install_option(REG_NAME_INSTALL_PRINTER, v) {
- log::error!(
- "Failed to update printer option \"{}\" to \"{}\", error: {}",
- REG_NAME_INSTALL_PRINTER,
- v,
- e
- );
- }
- }
-}
-
// We can't directly use `RegKey::set_value` to update the registry value, because it will fail with `ERROR_ACCESS_DENIED`
// So we have to use `run_cmds` to update the registry value.
pub fn update_install_option(k: &str, v: &str) -> ResultType<()> {
+ // Don't update registry if not installed or not server process.
+ if !is_installed() || !crate::is_server() {
+ return Ok(());
+ }
let app_name = crate::get_app_name();
let ext = app_name.to_lowercase();
let cmds =
diff --git a/src/rendezvous_mediator.rs b/src/rendezvous_mediator.rs
index b8f3de408..aa31ec323 100644
--- a/src/rendezvous_mediator.rs
+++ b/src/rendezvous_mediator.rs
@@ -64,7 +64,7 @@ impl RendezvousMediator {
}
crate::hbbs_http::sync::start();
#[cfg(target_os = "windows")]
- if crate::platform::is_installed() && !crate::is_custom_client() {
+ if crate::platform::is_installed() && crate::is_server() && !crate::is_custom_client() {
crate::updater::start_auto_update();
}
check_zombie();
diff --git a/src/server.rs b/src/server.rs
index 7f51e5a99..87e6f390f 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -567,8 +567,6 @@ pub async fn start_server(is_server: bool, no_server: bool) {
crate::platform::try_kill_broker();
#[cfg(feature = "hwcodec")]
scrap::hwcodec::start_check_process();
- #[cfg(target_os = "windows")]
- crate::platform::check_update_printer_option();
crate::RendezvousMediator::start_all().await;
} else {
match crate::ipc::connect(1000, "").await {