-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add UWP tool support, fix install service bug (#19)
- Loading branch information
1 parent
0c9a9f0
commit b09331e
Showing
12 changed files
with
90 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,6 @@ pub mod sysopt; | |
pub mod timer; | ||
pub mod tray; | ||
pub mod win_service; | ||
pub mod win_uwp; | ||
|
||
pub use self::core::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#![cfg(target_os = "windows")] | ||
|
||
use crate::utils::dirs; | ||
use anyhow::{bail, Result}; | ||
use deelevate::{PrivilegeLevel, Token}; | ||
use runas::Command as RunasCommand; | ||
use std::process::Command as StdCommand; | ||
|
||
pub async fn invoke_uwptools() -> Result<()> { | ||
let binary_path = dirs::service_path()?; | ||
let tool_path = binary_path.with_file_name("enableLoopback.exe"); | ||
|
||
if !tool_path.exists() { | ||
bail!("enableLoopback exe not found"); | ||
} | ||
|
||
let token = Token::with_current_process()?; | ||
let level = token.privilege_level()?; | ||
|
||
match level { | ||
PrivilegeLevel::NotPrivileged => RunasCommand::new(tool_path).status()?, | ||
_ => StdCommand::new(tool_path) | ||
.status()?, | ||
}; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters