mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-28 15:49:04 +08:00
commit
e263acef3e
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -2559,7 +2559,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "impersonate_system"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/21pages/impersonate-system#af4a82050580217a434c2024e181a98de24823ec"
|
||||
source = "git+https://github.com/21pages/impersonate-system#c48f37a8fd17413b2a4ba655c3873bdc5c8d25aa"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
@ -412,15 +412,6 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Timer(const Duration(seconds: 1), () async {
|
||||
final installed = bind.mainIsInstalled();
|
||||
final root = await bind.mainIsRoot();
|
||||
final release = await bind.mainIsRelease();
|
||||
if (Platform.isWindows && release && !installed && !root) {
|
||||
msgBox('custom-elevation-nocancel', 'Prompt', 'elevation_prompt', '',
|
||||
gFFI.dialogManager);
|
||||
}
|
||||
});
|
||||
Timer(const Duration(seconds: 5), () async {
|
||||
updateUrl = await bind.mainGetSoftwareUpdateUrl();
|
||||
if (updateUrl.isNotEmpty) setState(() {});
|
||||
|
@ -85,11 +85,6 @@ pub fn core_main() -> Option<Vec<String>> {
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
#[cfg(windows)]
|
||||
#[cfg(not(debug_assertions))]
|
||||
if !crate::platform::is_installed() && args.is_empty() {
|
||||
crate::platform::elevate_or_run_as_system(is_setup, _is_elevate, _is_run_as_system);
|
||||
}
|
||||
if args.is_empty() {
|
||||
std::thread::spawn(move || crate::start_server(false));
|
||||
} else {
|
||||
|
@ -34,5 +34,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("uac_warning", "Temporarily denied access due to elevation request, please wait for the remote user to accept the UAC dialog. To avoid this problem, it is recommended to install the software on the remote device or run it with administrator privileges."),
|
||||
("elevated_foreground_window_warning", "Temporarily unable to use the mouse and keyboard, because the current window of the remote desktop requires higher privilege to operate, you can request the remote user to minimize the current window. To avoid this problem, it is recommended to install the software on the remote device or run it with administrator privileges."),
|
||||
("JumpLink", "View"),
|
||||
("Stop service", "Stop Service"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -21,7 +21,10 @@ use winapi::{
|
||||
errhandlingapi::GetLastError,
|
||||
handleapi::CloseHandle,
|
||||
minwinbase::STILL_ACTIVE,
|
||||
processthreadsapi::{GetCurrentProcess, GetExitCodeProcess, OpenProcess, OpenProcessToken},
|
||||
processthreadsapi::{
|
||||
GetCurrentProcess, GetCurrentProcessId, GetExitCodeProcess, OpenProcess,
|
||||
OpenProcessToken,
|
||||
},
|
||||
securitybaseapi::GetTokenInformation,
|
||||
shellapi::ShellExecuteA,
|
||||
winbase::*,
|
||||
@ -878,23 +881,35 @@ fn get_install_info_with_subkey(subkey: String) -> (String, String, String, Stri
|
||||
(subkey, path, start_menu, exe)
|
||||
}
|
||||
|
||||
pub fn copy_exe_cmd(src_exe: &str, _exe: &str, _path: &str) -> String {
|
||||
pub fn copy_exe_cmd(src_exe: &str, _exe: &str, path: &str) -> String {
|
||||
#[cfg(feature = "flutter")]
|
||||
return format!(
|
||||
let main_exe = format!(
|
||||
"XCOPY \"{}\" \"{}\" /Y /E /H /C /I /K /R /Z",
|
||||
PathBuf::from(src_exe)
|
||||
.parent()
|
||||
.unwrap()
|
||||
.to_string_lossy()
|
||||
.to_string(),
|
||||
_path
|
||||
path
|
||||
);
|
||||
#[cfg(not(feature = "flutter"))]
|
||||
return format!(
|
||||
let main_exe = format!(
|
||||
"copy /Y \"{src_exe}\" \"{exe}\"",
|
||||
src_exe = src_exe,
|
||||
exe = _exe
|
||||
);
|
||||
|
||||
return format!(
|
||||
"
|
||||
{main_exe}
|
||||
copy /Y \"{ORIGIN_PROCESS_EXE}\" \"{path}\\{broker_exe}\"
|
||||
\"{src_exe}\" --extract \"{path}\"
|
||||
",
|
||||
main_exe = main_exe,
|
||||
path = path,
|
||||
ORIGIN_PROCESS_EXE = crate::ui::win_privacy::ORIGIN_PROCESS_EXE,
|
||||
broker_exe = crate::ui::win_privacy::INJECTED_PROCESS_EXE,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn update_me() -> ResultType<()> {
|
||||
@ -905,18 +920,16 @@ pub fn update_me() -> ResultType<()> {
|
||||
chcp 65001
|
||||
sc stop {app_name}
|
||||
taskkill /F /IM {broker_exe}
|
||||
taskkill /F /IM {app_name}.exe
|
||||
taskkill /F /IM {app_name}.exe /FI \"PID ne {cur_pid}\"
|
||||
{copy_exe}
|
||||
\"{src_exe}\" --extract \"{path}\"
|
||||
sc start {app_name}
|
||||
{lic}
|
||||
",
|
||||
src_exe = src_exe,
|
||||
copy_exe = copy_exe_cmd(&src_exe, &exe, &path),
|
||||
broker_exe = crate::ui::win_privacy::INJECTED_PROCESS_EXE,
|
||||
path = path,
|
||||
app_name = crate::get_app_name(),
|
||||
lic = register_licence(),
|
||||
cur_pid = get_current_pid(),
|
||||
);
|
||||
std::thread::sleep(std::time::Duration::from_millis(1000));
|
||||
run_cmds(cmds, false, "update")?;
|
||||
@ -1087,8 +1100,6 @@ if exist \"{tmp_path}\\{app_name} Tray.lnk\" del /f /q \"{tmp_path}\\{app_name}
|
||||
chcp 65001
|
||||
md \"{path}\"
|
||||
{copy_exe}
|
||||
copy /Y \"{ORIGIN_PROCESS_EXE}\" \"{path}\\{broker_exe}\"
|
||||
\"{src_exe}\" --extract \"{path}\"
|
||||
reg add {subkey} /f
|
||||
reg add {subkey} /f /v DisplayIcon /t REG_SZ /d \"{exe}\"
|
||||
reg add {subkey} /f /v DisplayName /t REG_SZ /d \"{app_name}\"
|
||||
@ -1119,10 +1130,7 @@ sc delete {app_name}
|
||||
",
|
||||
uninstall_str=uninstall_str,
|
||||
path=path,
|
||||
src_exe=src_exe,
|
||||
exe=exe,
|
||||
ORIGIN_PROCESS_EXE = crate::ui::win_privacy::ORIGIN_PROCESS_EXE,
|
||||
broker_exe=crate::ui::win_privacy::INJECTED_PROCESS_EXE,
|
||||
subkey=subkey,
|
||||
app_name=crate::get_app_name(),
|
||||
version=crate::VERSION,
|
||||
@ -1178,13 +1186,14 @@ fn get_before_uninstall() -> String {
|
||||
sc stop {app_name}
|
||||
sc delete {app_name}
|
||||
taskkill /F /IM {broker_exe}
|
||||
taskkill /F /IM {app_name}.exe
|
||||
taskkill /F /IM {app_name}.exe /FI \"PID ne {cur_pid}\"
|
||||
reg delete HKEY_CLASSES_ROOT\\.{ext} /f
|
||||
netsh advfirewall firewall delete rule name=\"{app_name} Service\"
|
||||
",
|
||||
app_name = app_name,
|
||||
broker_exe = crate::ui::win_privacy::INJECTED_PROCESS_EXE,
|
||||
ext = ext
|
||||
ext = ext,
|
||||
cur_pid = get_current_pid(),
|
||||
)
|
||||
}
|
||||
|
||||
@ -1613,3 +1622,7 @@ pub fn is_foreground_window_elevated() -> ResultType<bool> {
|
||||
is_elevated(Some(process_id))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_current_pid() -> u32 {
|
||||
unsafe { GetCurrentProcessId() }
|
||||
}
|
||||
|
@ -1242,9 +1242,3 @@ function refreshCurrentUser() {
|
||||
function getHttpHeaders() {
|
||||
return "Authorization: Bearer " + handler.get_local_option("access_token");
|
||||
}
|
||||
|
||||
$(body).timer(1000, function check_elevation(){
|
||||
if (is_win && handler.is_release() && !handler.is_installed() && !handler.is_root()) {
|
||||
msgbox("custom-elevation-nocancel", "Prompt", "elevation_prompt");
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user