From c05395c2585c9df6dbdc6a69758430f0be201ec1 Mon Sep 17 00:00:00 2001 From: Sline Date: Tue, 7 Oct 2025 10:01:35 +0800 Subject: [PATCH] fix(windows): show UAC prompt for TUN service install/uninstall (#4959) --- src-tauri/src/core/service.rs | 4 ++-- src-tauri/src/core/win_uwp.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src-tauri/src/core/service.rs b/src-tauri/src/core/service.rs index 3312f6c0..fc51a1c3 100644 --- a/src-tauri/src/core/service.rs +++ b/src-tauri/src/core/service.rs @@ -45,7 +45,7 @@ async fn uninstall_service() -> Result<()> { let token = Token::with_current_process()?; let level = token.privilege_level()?; let status = match level { - PrivilegeLevel::NotPrivileged => RunasCommand::new(uninstall_path).show(false).status()?, + PrivilegeLevel::NotPrivileged => RunasCommand::new(uninstall_path).show(true).status()?, _ => StdCommand::new(uninstall_path) .creation_flags(0x08000000) .status()?, @@ -80,7 +80,7 @@ async fn install_service() -> Result<()> { let token = Token::with_current_process()?; let level = token.privilege_level()?; let status = match level { - PrivilegeLevel::NotPrivileged => RunasCommand::new(install_path).show(false).status()?, + PrivilegeLevel::NotPrivileged => RunasCommand::new(install_path).show(true).status()?, _ => StdCommand::new(install_path) .creation_flags(0x08000000) .status()?, diff --git a/src-tauri/src/core/win_uwp.rs b/src-tauri/src/core/win_uwp.rs index 3db9a1a4..88c67aa3 100644 --- a/src-tauri/src/core/win_uwp.rs +++ b/src-tauri/src/core/win_uwp.rs @@ -18,7 +18,7 @@ pub fn invoke_uwptools() -> Result<()> { let level = token.privilege_level()?; match level { - PrivilegeLevel::NotPrivileged => RunasCommand::new(tool_path).status()?, + PrivilegeLevel::NotPrivileged => RunasCommand::new(tool_path).show(true).status()?, _ => StdCommand::new(tool_path).status()?, };