Skip to content

Commit f56c5c1

Browse files
authored
fix: win, prompt uac, update_install_option (rustdesk#11741)
Signed-off-by: fufesou <linlong1266@gmail.com>
1 parent a615b5e commit f56c5c1

3 files changed

Lines changed: 5 additions & 21 deletions

File tree

src/platform/windows.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,27 +1658,13 @@ pub fn get_license_from_exe_name() -> ResultType<CustomServer> {
16581658
get_custom_server_from_string(&exe)
16591659
}
16601660

1661-
pub fn check_update_printer_option() {
1662-
if !is_installed() {
1663-
return;
1664-
}
1665-
let app_name = crate::get_app_name();
1666-
if let Ok(b) = remote_printer::is_rd_printer_installed(&app_name) {
1667-
let v = if b { "1" } else { "0" };
1668-
if let Err(e) = update_install_option(REG_NAME_INSTALL_PRINTER, v) {
1669-
log::error!(
1670-
"Failed to update printer option \"{}\" to \"{}\", error: {}",
1671-
REG_NAME_INSTALL_PRINTER,
1672-
v,
1673-
e
1674-
);
1675-
}
1676-
}
1677-
}
1678-
16791661
// We can't directly use `RegKey::set_value` to update the registry value, because it will fail with `ERROR_ACCESS_DENIED`
16801662
// So we have to use `run_cmds` to update the registry value.
16811663
pub fn update_install_option(k: &str, v: &str) -> ResultType<()> {
1664+
// Don't update registry if not installed or not server process.
1665+
if !is_installed() || !crate::is_server() {
1666+
return Ok(());
1667+
}
16821668
let app_name = crate::get_app_name();
16831669
let ext = app_name.to_lowercase();
16841670
let cmds =

src/rendezvous_mediator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl RendezvousMediator {
6464
}
6565
crate::hbbs_http::sync::start();
6666
#[cfg(target_os = "windows")]
67-
if crate::platform::is_installed() && !crate::is_custom_client() {
67+
if crate::platform::is_installed() && crate::is_server() && !crate::is_custom_client() {
6868
crate::updater::start_auto_update();
6969
}
7070
check_zombie();

src/server.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,6 @@ pub async fn start_server(is_server: bool, no_server: bool) {
567567
crate::platform::try_kill_broker();
568568
#[cfg(feature = "hwcodec")]
569569
scrap::hwcodec::start_check_process();
570-
#[cfg(target_os = "windows")]
571-
crate::platform::check_update_printer_option();
572570
crate::RendezvousMediator::start_all().await;
573571
} else {
574572
match crate::ipc::connect(1000, "").await {

0 commit comments

Comments
 (0)