fix: win, prompt uac, update_install_option (#11741)
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -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 =
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user