This commit is contained in:
rustdesk
2025-06-16 18:36:15 +09:00
parent 181b3afc2d
commit d84b26a9cd

View File

@@ -41,7 +41,7 @@ use winapi::{
um::{ um::{
errhandlingapi::GetLastError, errhandlingapi::GetLastError,
handleapi::CloseHandle, handleapi::CloseHandle,
libloaderapi::{GetProcAddress, LoadLibraryExA, LOAD_LIBRARY_SEARCH_SYSTEM32}, libloaderapi::{GetProcAddress, LoadLibraryA, LoadLibraryExA, LOAD_LIBRARY_SEARCH_SYSTEM32},
minwinbase::STILL_ACTIVE, minwinbase::STILL_ACTIVE,
processthreadsapi::{ processthreadsapi::{
GetCurrentProcess, GetCurrentProcessId, GetExitCodeProcess, OpenProcess, GetCurrentProcess, GetCurrentProcessId, GetExitCodeProcess, OpenProcess,
@@ -1351,7 +1351,7 @@ copy /Y \"{tmp_path}\\Uninstall {app_name}.lnk\" \"{start_menu}\\\"
); );
reg_value_start_menu_shortcuts = "1".to_owned(); reg_value_start_menu_shortcuts = "1".to_owned();
} }
let install_printer = options.contains("printer") && crate::platform::is_win_10_or_greater(); let install_printer = options.contains("printer") && is_win_10_or_greater();
if install_printer { if install_printer {
reg_value_printer = "1".to_owned(); reg_value_printer = "1".to_owned();
} }
@@ -1394,7 +1394,7 @@ copy /Y \"{tmp_path}\\{app_name} Tray.lnk\" \"%PROGRAMDATA%\\Microsoft\\Windows\
// No need to use `|| true` here. // No need to use `|| true` here.
// The script will not exit even if `--install-remote-printer` panics. // The script will not exit even if `--install-remote-printer` panics.
format!("\"{}\" --install-remote-printer", &src_exe) format!("\"{}\" --install-remote-printer", &src_exe)
} else if crate::platform::is_win_10_or_greater() { } else if is_win_10_or_greater() {
format!("\"{}\" --uninstall-remote-printer", &src_exe) format!("\"{}\" --uninstall-remote-printer", &src_exe)
} else { } else {
"".to_owned() "".to_owned()
@@ -1715,7 +1715,12 @@ pub fn bootstrap() -> bool {
#[cfg(not(debug_assertions))] #[cfg(not(debug_assertions))]
{ {
// This function will cause `'sciter.dll' was not found neither in PATH nor near the current executable.` when debugging RustDesk. // This function will cause `'sciter.dll' was not found neither in PATH nor near the current executable.` when debugging RustDesk.
set_safe_load_dll() // Only call set_safe_load_dll() on Windows 10 or greater
if is_win_10_or_greater() {
set_safe_load_dll()
} else {
true
}
} }
} }
@@ -2896,11 +2901,15 @@ pub fn try_kill_rustdesk_main_window_process() -> ResultType<()> {
fn nt_terminate_process(process_id: DWORD) -> ResultType<()> { fn nt_terminate_process(process_id: DWORD) -> ResultType<()> {
type NtTerminateProcess = unsafe extern "system" fn(HANDLE, DWORD) -> DWORD; type NtTerminateProcess = unsafe extern "system" fn(HANDLE, DWORD) -> DWORD;
unsafe { unsafe {
let h_module = LoadLibraryExA( let h_module = if is_win_10_or_greater() {
CString::new("ntdll.dll")?.as_ptr(), LoadLibraryExA(
std::ptr::null_mut(), CString::new("ntdll.dll")?.as_ptr(),
LOAD_LIBRARY_SEARCH_SYSTEM32, std::ptr::null_mut(),
); LOAD_LIBRARY_SEARCH_SYSTEM32,
)
} else {
LoadLibraryA(CString::new("ntdll.dll")?.as_ptr())
};
if !h_module.is_null() { if !h_module.is_null() {
let f_nt_terminate_process: NtTerminateProcess = std::mem::transmute(GetProcAddress( let f_nt_terminate_process: NtTerminateProcess = std::mem::transmute(GetProcAddress(
h_module, h_module,