mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
feat, win virtual display
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -3,7 +3,7 @@ pub mod win10;
|
||||
#[cfg(windows)]
|
||||
use hbb_common::lazy_static;
|
||||
use hbb_common::{bail, ResultType};
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[cfg(windows)]
|
||||
use std::sync::Mutex;
|
||||
@@ -33,17 +33,29 @@ pub fn download_driver() -> ResultType<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn install_update_driver(_reboot_required: &mut bool) -> ResultType<()> {
|
||||
fn get_driver_install_abs_path() -> ResultType<PathBuf> {
|
||||
#[cfg(windows)]
|
||||
let install_path = win10::DRIVER_INSTALL_PATH;
|
||||
#[cfg(not(windows))]
|
||||
let install_path = "";
|
||||
bail!("Not implemented for non-windows");
|
||||
|
||||
let abs_path = Path::new(install_path).canonicalize()?;
|
||||
let exe_file = std::env::current_exe()?;
|
||||
let abs_path = match exe_file.parent() {
|
||||
Some(cur_dir) => cur_dir.join(install_path),
|
||||
None => bail!(
|
||||
"Invalid exe parent for {}",
|
||||
exe_file.to_string_lossy().as_ref()
|
||||
),
|
||||
};
|
||||
if !abs_path.exists() {
|
||||
bail!("{} not exists", install_path)
|
||||
}
|
||||
Ok(abs_path)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn install_update_driver(_reboot_required: &mut bool) -> ResultType<()> {
|
||||
let abs_path = get_driver_install_abs_path()?;
|
||||
|
||||
#[cfg(windows)]
|
||||
unsafe {
|
||||
@@ -76,15 +88,7 @@ pub fn install_update_driver(_reboot_required: &mut bool) -> ResultType<()> {
|
||||
|
||||
#[no_mangle]
|
||||
pub fn uninstall_driver(_reboot_required: &mut bool) -> ResultType<()> {
|
||||
#[cfg(windows)]
|
||||
let install_path = win10::DRIVER_INSTALL_PATH;
|
||||
#[cfg(not(windows))]
|
||||
let install_path = "";
|
||||
|
||||
let abs_path = Path::new(install_path).canonicalize()?;
|
||||
if !abs_path.exists() {
|
||||
bail!("{} not exists", install_path)
|
||||
}
|
||||
let abs_path = get_driver_install_abs_path()?;
|
||||
|
||||
#[cfg(windows)]
|
||||
unsafe {
|
||||
|
||||
Reference in New Issue
Block a user