From 75521fe363a72e59894b36d8c9ae50cc33ec894b Mon Sep 17 00:00:00 2001 From: bovirus <1262554+bovirus@users.noreply.github.com> Date: Sat, 20 Apr 2024 05:30:38 +0200 Subject: [PATCH 01/11] Update Italian language (#7776) --- src/lang/it.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lang/it.rs b/src/lang/it.rs index 670853e4a1..a362e23481 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -601,6 +601,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Everyone", "Everyone"), ("ab_web_console_tip", "Altre info sulla console web"), ("allow-only-conn-window-open-tip", "Consenti la connessione solo se la finestra RustDesk è aperta"), - ("no_need_privacy_mode_no_physical_displays_tip", ""), + ("no_need_privacy_mode_no_physical_displays_tip", "Nessun display fisico, nessuna necessità di usare la modalità privacy."), ].iter().cloned().collect(); } From a8eefbc9f02a886d95aff5d5afb93ad94445fa03 Mon Sep 17 00:00:00 2001 From: Mr-Update <37781396+Mr-Update@users.noreply.github.com> Date: Sat, 20 Apr 2024 05:30:48 +0200 Subject: [PATCH 02/11] Update de.rs (#7778) --- src/lang/de.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lang/de.rs b/src/lang/de.rs index 1c88bdde5c..73262e267d 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -601,6 +601,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Everyone", "Jeder"), ("ab_web_console_tip", "Mehr über Webkonsole"), ("allow-only-conn-window-open-tip", "Verbindung nur zulassen, wenn das RustDesk-Fenster geöffnet ist"), - ("no_need_privacy_mode_no_physical_displays_tip", ""), + ("no_need_privacy_mode_no_physical_displays_tip", "Keine physischen Bildschirme; keine Notwendigkeit, den Datenschutzmodus zu verwenden."), ].iter().cloned().collect(); } From 8a6d9a1496bd9ae6424aca796779d7e79ac24564 Mon Sep 17 00:00:00 2001 From: jxdv Date: Sat, 20 Apr 2024 03:30:57 +0000 Subject: [PATCH 03/11] update sk.rs (#7779) --- src/lang/sk.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lang/sk.rs b/src/lang/sk.rs index 7492b59f2a..1abfe46a39 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -601,6 +601,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Everyone", "Každý"), ("ab_web_console_tip", "Viac na webovej konzole"), ("allow-only-conn-window-open-tip", "Povoliť pripojenie iba vtedy, ak je otvorené okno aplikácie RustDesk"), - ("no_need_privacy_mode_no_physical_displays_tip", ""), + ("no_need_privacy_mode_no_physical_displays_tip", "Žiadne fyzické displeje, nie je potrebné používať režim ochrany osobných údajov."), ].iter().cloned().collect(); } From d4a1d4cd7e3cb19b12d000bbf87a2ef5bc0c1191 Mon Sep 17 00:00:00 2001 From: jxdv Date: Sat, 20 Apr 2024 03:31:07 +0000 Subject: [PATCH 04/11] update cs.rs (#7780) --- src/lang/cs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lang/cs.rs b/src/lang/cs.rs index 4c3a4b3cce..23cb7442eb 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -601,6 +601,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Everyone", "Každý"), ("ab_web_console_tip", "Více na webové konzoli"), ("allow-only-conn-window-open-tip", "Povolit připojení pouze v případě, že je otevřené okno RustDesk"), - ("no_need_privacy_mode_no_physical_displays_tip", ""), + ("no_need_privacy_mode_no_physical_displays_tip", "Žádné fyzické displeje, není třeba používat režim soukromí."), ].iter().cloned().collect(); } From fb1aa9c0285fbbad10cb75c958e791b534fc021d Mon Sep 17 00:00:00 2001 From: fufesou Date: Sat, 20 Apr 2024 14:54:23 +0800 Subject: [PATCH 05/11] Fix. Multi-display connection, resolutions (#7782) * fix: multi-display, change resolution Signed-off-by: fufesou * fix: multi-displays, resolutions of displays Signed-off-by: fufesou * fix: build Signed-off-by: fufesou * refact: Function rename Signed-off-by: fufesou * refact. Function rename Signed-off-by: fufesou --------- Signed-off-by: fufesou --- flutter/lib/models/model.dart | 8 ++++- flutter/lib/web/bridge.dart | 5 +++ libs/hbb_common/protos/message.proto | 16 ++++++++++ src/flutter_ffi.rs | 6 ++++ src/server/connection.rs | 48 ++++++++++++++++++++-------- src/ui_session_interface.rs | 33 ++++++++++++++++--- src/virtual_display_manager.rs | 7 ++++ 7 files changed, 105 insertions(+), 18 deletions(-) diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index 046767be6f..4da7d54cd4 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -715,6 +715,8 @@ class FfiModel with ChangeNotifier { // Map clone is required here, otherwise "evt" may be changed by other threads through the reference. // Because this function is asynchronous, there's an "await" in this function. cachedPeerData.peerInfo = {...evt}; + // Do not cache resolutions, because a new display connection have different resolutions. + cachedPeerData.peerInfo.remove('resolutions'); // Recent peer is updated by handle_peer_info(ui_session_interface.rs) --> handle_peer_info(client.rs) --> save_config(client.rs) bind.mainLoadRecentPeers(); @@ -770,7 +772,9 @@ class FfiModel with ChangeNotifier { } Map features = json.decode(evt['features']); _pi.features.privacyMode = features['privacy_mode'] == 1; - handleResolutions(peerId, evt["resolutions"]); + if (!isCache) { + handleResolutions(peerId, evt["resolutions"]); + } parent.target?.elevationModel.onPeerInfo(_pi); } if (connType == ConnType.defaultConn) { @@ -2317,6 +2321,8 @@ class FFI { } await ffiModel.handleCachedPeerData(data, id); await sessionRefreshVideo(sessionId, ffiModel.pi); + await bind.sessionRequestNewDisplayInitMsgs( + sessionId: sessionId, display: ffiModel.pi.currentDisplay); }); isToNewWindowNotified.value = true; } diff --git a/flutter/lib/web/bridge.dart b/flutter/lib/web/bridge.dart index 9528933934..fd0d7189b3 100644 --- a/flutter/lib/web/bridge.dart +++ b/flutter/lib/web/bridge.dart @@ -1577,5 +1577,10 @@ class RustdeskImpl { throw UnimplementedError(); } + Future sessionRequestNewDisplayInitMsgs( + {required UuidValue sessionId, required int display, dynamic hint}) { + throw UnimplementedError(); + } + void dispose() {} } diff --git a/libs/hbb_common/protos/message.proto b/libs/hbb_common/protos/message.proto index b2001ba680..7ffa0e6def 100644 --- a/libs/hbb_common/protos/message.proto +++ b/libs/hbb_common/protos/message.proto @@ -504,6 +504,11 @@ message Resolution { int32 height = 2; } +message DisplayResolution { + int32 display = 1; + Resolution resolution = 2; +} + message SupportedResolutions { repeated Resolution resolutions = 1; } message SwitchDisplay { @@ -716,6 +721,13 @@ message WindowsSessions { uint32 current_sid = 2; } +// Query a message from peer. +message MessageQuery { + // The SwitchDisplay message of the target display. + // If the target display is not found, the message will be ignored. + int32 switch_display = 1; +} + message Misc { oneof union { ChatMessage chat_message = 4; @@ -736,6 +748,8 @@ message Misc { bool portable_service_running = 20; SwitchSidesRequest switch_sides_request = 21; SwitchBack switch_back = 22; + // Deprecated since 1.2.4, use `change_display_resolution` (36) instead. + // But we must keep it for compatibility when peer version < 1.2.4. Resolution change_resolution = 24; PluginRequest plugin_request = 25; PluginFailure plugin_failure = 26; @@ -748,6 +762,8 @@ message Misc { TogglePrivacyMode toggle_privacy_mode = 33; SupportedEncoding supported_encoding = 34; uint32 selected_sid = 35; + DisplayResolution change_display_resolution = 36; + MessageQuery message_query = 37; } } diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index 86235dc2fc..6ff9277968 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -2104,6 +2104,12 @@ pub fn main_check_hwcodec() { check_hwcodec() } +pub fn session_request_new_display_init_msgs(session_id: SessionID, display: usize) { + if let Some(session) = sessions::get_session_by_session_id(&session_id) { + session.request_init_msgs(display); + } +} + #[cfg(target_os = "android")] pub mod server_side { use hbb_common::{config, log}; diff --git a/src/server/connection.rs b/src/server/connection.rs index 8526a998d2..69aa52b508 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -2300,7 +2300,11 @@ impl Connection { } } #[cfg(not(any(target_os = "android", target_os = "ios")))] - Some(misc::Union::ChangeResolution(r)) => self.change_resolution(&r), + Some(misc::Union::ChangeResolution(r)) => self.change_resolution(None, &r), + #[cfg(not(any(target_os = "android", target_os = "ios")))] + Some(misc::Union::ChangeDisplayResolution(dr)) => { + self.change_resolution(Some(dr.display as _), &dr.resolution) + } #[cfg(all(feature = "flutter", feature = "plugin_framework"))] #[cfg(not(any(target_os = "android", target_os = "ios")))] Some(misc::Union::PluginRequest(p)) => { @@ -2343,6 +2347,13 @@ impl Connection { } } } + Some(misc::Union::MessageQuery(mq)) => { + if let Some(msg_out) = + video_service::make_display_changed_msg(mq.switch_display as _, None) + { + self.send(msg_out).await; + } + } _ => {} }, Some(message::Union::AudioFrame(frame)) => { @@ -2472,11 +2483,14 @@ impl Connection { #[cfg(not(any(target_os = "android", target_os = "ios")))] if s.width != 0 && s.height != 0 { - self.change_resolution(&Resolution { - width: s.width, - height: s.height, - ..Default::default() - }); + self.change_resolution( + None, + &Resolution { + width: s.width, + height: s.height, + ..Default::default() + }, + ); } } @@ -2623,10 +2637,11 @@ impl Connection { } #[cfg(not(any(target_os = "android", target_os = "ios")))] - fn change_resolution(&mut self, r: &Resolution) { + fn change_resolution(&mut self, d: Option, r: &Resolution) { if self.keyboard { if let Ok(displays) = display_service::try_get_displays() { - if let Some(display) = displays.get(self.display_idx) { + let display_idx = d.unwrap_or(self.display_idx); + if let Some(display) = displays.get(display_idx) { let name = display.name(); #[cfg(all(windows, feature = "virtual_display_driver"))] if let Some(_ok) = @@ -2638,11 +2653,18 @@ impl Connection { { return; } - display_service::set_last_changed_resolution( - &name, - (display.width() as _, display.height() as _), - (r.width, r.height), - ); + let mut record_changed = true; + #[cfg(all(windows, feature = "virtual_display_driver"))] + if virtual_display_manager::amyuni_idd::is_my_display(&name) { + record_changed = false; + } + if record_changed { + display_service::set_last_changed_resolution( + &name, + (display.width() as _, display.height() as _), + (r.width, r.height), + ); + } if let Err(e) = crate::platform::change_resolution(&name, r.width as _, r.height as _) { diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index 44aa6c6b62..61c11feb0b 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -1222,7 +1222,7 @@ impl Session { pub fn change_resolution(&self, display: i32, width: i32, height: i32) { *self.last_change_display.lock().unwrap() = ChangeDisplayRecord::new(display, width, height); - self.do_change_resolution(width, height); + self.do_change_resolution(display, width, height); } #[inline] @@ -1232,13 +1232,22 @@ impl Session { } } - fn do_change_resolution(&self, width: i32, height: i32) { + fn do_change_resolution(&self, display: i32, width: i32, height: i32) { let mut misc = Misc::new(); - misc.set_change_resolution(Resolution { + let resolution = Resolution { width, height, ..Default::default() - }); + }; + if crate::common::is_support_multi_ui_session_num(self.lc.read().unwrap().version) { + misc.set_change_display_resolution(DisplayResolution { + display, + resolution: Some(resolution).into(), + ..Default::default() + }); + } else { + misc.set_change_resolution(resolution); + } let mut msg = Message::new(); msg.set_misc(misc); self.send(Data::Message(msg)); @@ -1293,6 +1302,22 @@ impl Session { log::error!("selected invalid sid: {}", sid); } } + + #[inline] + pub fn request_init_msgs(&self, display: usize) { + self.send_message_query(display); + } + + fn send_message_query(&self, display: usize) { + let mut misc = Misc::new(); + misc.set_message_query(MessageQuery { + switch_display: display as _, + ..Default::default() + }); + let mut msg = Message::new(); + msg.set_misc(misc); + self.send(Data::Message(msg)); + } } pub trait InvokeUiSession: Send + Sync + Clone + 'static + Sized + Default { diff --git a/src/virtual_display_manager.rs b/src/virtual_display_manager.rs index 3188fc33ea..1a0a03b01c 100644 --- a/src/virtual_display_manager.rs +++ b/src/virtual_display_manager.rs @@ -536,6 +536,13 @@ pub mod amyuni_idd { pub fn get_monitor_count() -> usize { windows::get_device_names(Some(super::AMYUNI_IDD_DEVICE_STRING)).len() } + + #[inline] + pub fn is_my_display(name: &str) -> bool { + windows::get_device_names(Some(super::AMYUNI_IDD_DEVICE_STRING)) + .iter() + .any(|s| windows::is_device_name(s, name)) + } } mod windows { From f02a2e44d8f03bb978fba40ab24aa5df15b1f3c0 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sat, 20 Apr 2024 15:13:04 +0800 Subject: [PATCH 06/11] remove temp support_windows_specific_session --- libs/hbb_common/protos/message.proto | 3 ++- src/client.rs | 25 ++----------------------- src/server/connection.rs | 3 +-- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/libs/hbb_common/protos/message.proto b/libs/hbb_common/protos/message.proto index 7ffa0e6def..1eb6bd0787 100644 --- a/libs/hbb_common/protos/message.proto +++ b/libs/hbb_common/protos/message.proto @@ -601,7 +601,8 @@ message OptionMessage { BoolOption disable_keyboard = 12; // Position 13 is used for Resolution. Remove later. // Resolution custom_resolution = 13; - BoolOption support_windows_specific_session = 14; +// BoolOption support_windows_specific_session = 14; + // starting from 15 please, do not use removed fields } message TestDelay { diff --git a/src/client.rs b/src/client.rs index f55819a78a..5cf16c7ce1 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1564,22 +1564,13 @@ impl LoginConfigHandler { /// /// * `ignore_default` - If `true`, ignore the default value of the option. fn get_option_message(&self, ignore_default: bool) -> Option { - if self.conn_type.eq(&ConnType::PORT_FORWARD) || self.conn_type.eq(&ConnType::RDP) { + if self.conn_type.eq(&ConnType::PORT_FORWARD) || self.conn_type.eq(&ConnType::RDP) || self.conn_type.eq(&ConnType::FILE_TRANSFER) { return None; } - let mut n = 0; let mut msg = OptionMessage::new(); - // Version 1.2.5 can remove this, and OptionMessage is not needed for file transfer - msg.support_windows_specific_session = BoolOption::Yes.into(); - n += 1; - - if self.conn_type.eq(&ConnType::FILE_TRANSFER) { - return Some(msg); - } let q = self.image_quality.clone(); if let Some(q) = self.get_image_quality_enum(&q, ignore_default) { msg.image_quality = q.into(); - n += 1; } else if q == "custom" { let config = self.load_config(); let allow_more = !crate::using_public_server() || self.direct == Some(true); @@ -1602,32 +1593,25 @@ impl LoginConfigHandler { msg.custom_fps = custom_fps; *self.custom_fps.lock().unwrap() = Some(custom_fps as _); } - n += 1; } let view_only = self.get_toggle_option("view-only"); if view_only { msg.disable_keyboard = BoolOption::Yes.into(); - n += 1; } if view_only || self.get_toggle_option("show-remote-cursor") { msg.show_remote_cursor = BoolOption::Yes.into(); - n += 1; } if !view_only && self.get_toggle_option("lock-after-session-end") { msg.lock_after_session_end = BoolOption::Yes.into(); - n += 1; } if self.get_toggle_option("disable-audio") { msg.disable_audio = BoolOption::Yes.into(); - n += 1; } if !view_only && self.get_toggle_option("enable-file-transfer") { msg.enable_file_transfer = BoolOption::Yes.into(); - n += 1; } if view_only || self.get_toggle_option("disable-clipboard") { msg.disable_clipboard = BoolOption::Yes.into(); - n += 1; } msg.supported_decoding = hbb_common::protobuf::MessageField::some(Decoder::supported_decodings( @@ -1636,12 +1620,7 @@ impl LoginConfigHandler { self.adapter_luid, &self.mark_unsupported, )); - n += 1; - if n > 0 { - Some(msg) - } else { - None - } + Some(msg) } pub fn get_option_message_after_login(&self) -> Option { diff --git a/src/server/connection.rs b/src/server/connection.rs index 69aa52b508..9cd9221c9d 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -1337,8 +1337,7 @@ impl Connection { && raii::AuthedConnID::remote_and_file_conn_count() == 1 && sessions.len() > 1 && sessions.iter().any(|e| e.sid == current_sid) - && (get_version_number(&self.lr.version) > get_version_number("1.2.4") - || self.lr.option.support_windows_specific_session == BoolOption::Yes.into()) + && get_version_number(&self.lr.version) >= get_version_number("1.2.4") { pi.windows_sessions = Some(WindowsSessions { sessions, From d920953df1c781908bf9c1b6f5c8924ac30e9f9f Mon Sep 17 00:00:00 2001 From: fufesou Date: Sat, 20 Apr 2024 15:28:33 +0800 Subject: [PATCH 07/11] typo (#7783) Signed-off-by: fufesou --- libs/hbb_common/protos/message.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/hbb_common/protos/message.proto b/libs/hbb_common/protos/message.proto index 1eb6bd0787..555b1df43b 100644 --- a/libs/hbb_common/protos/message.proto +++ b/libs/hbb_common/protos/message.proto @@ -722,7 +722,7 @@ message WindowsSessions { uint32 current_sid = 2; } -// Query a message from peer. +// Query messages from peer. message MessageQuery { // The SwitchDisplay message of the target display. // If the target display is not found, the message will be ignored. From c81c4f9114dfcf6da07647706fb1f15e368d683c Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sat, 20 Apr 2024 18:19:19 +0800 Subject: [PATCH 08/11] visual studio 2019 -> 2022 --- .github/workflows/ci.yml | 6 +++--- .github/workflows/flutter-build.yml | 18 +++++++++--------- .github/workflows/history.yml | 2 +- .../third-party-RustDeskTempTopMostWindow.yml | 2 +- res/msi/CustomActions/CustomActions.vcxproj | 4 ++-- res/msi/README.md | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ccfc1bdf42..9a8ecf5cd0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,12 +71,12 @@ jobs: # - { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } # - { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true } # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } - # - { target: i686-pc-windows-msvc , os: windows-2019 } + # - { target: i686-pc-windows-msvc , os: windows-2022 } # - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } # - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } # - { target: x86_64-apple-darwin , os: macos-10.15 } - # - { target: x86_64-pc-windows-gnu , os: windows-2019 } - # - { target: x86_64-pc-windows-msvc , os: windows-2019 } + # - { target: x86_64-pc-windows-gnu , os: windows-2022 } + # - { target: x86_64-pc-windows-msvc , os: windows-2022 } - { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 } # - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } steps: diff --git a/.github/workflows/flutter-build.yml b/.github/workflows/flutter-build.yml index c865db73a8..f9281a6585 100644 --- a/.github/workflows/flutter-build.yml +++ b/.github/workflows/flutter-build.yml @@ -41,7 +41,7 @@ jobs: uses: ./.github/workflows/third-party-RustDeskTempTopMostWindow.yml with: upload-artifact: ${{ inputs.upload-artifact }} - target: windows-2019 + target: windows-2022 configuration: Release platform: x64 target_version: Windows10 @@ -56,10 +56,10 @@ jobs: fail-fast: false matrix: job: - # - { target: i686-pc-windows-msvc , os: windows-2019 } - # - { target: x86_64-pc-windows-gnu , os: windows-2019 } - - { target: x86_64-pc-windows-msvc, os: windows-2019, arch: x86_64 } - # - { target: aarch64-pc-windows-msvc, os: windows-2019, arch: aarch64 } + # - { target: i686-pc-windows-msvc , os: windows-2022 } + # - { target: x86_64-pc-windows-gnu , os: windows-2022 } + - { target: x86_64-pc-windows-msvc, os: windows-2022, arch: x86_64 } + # - { target: aarch64-pc-windows-msvc, os: windows-2022, arch: aarch64 } steps: - name: Export GitHub Actions cache environment variables uses: actions/github-script@v6 @@ -213,10 +213,10 @@ jobs: fail-fast: false matrix: job: - # - { target: i686-pc-windows-msvc , os: windows-2019 } - # - { target: x86_64-pc-windows-gnu , os: windows-2019 } - - { target: i686-pc-windows-msvc, os: windows-2019, arch: x86 } - # - { target: aarch64-pc-windows-msvc, os: windows-2019 } + # - { target: i686-pc-windows-msvc , os: windows-2022 } + # - { target: x86_64-pc-windows-gnu , os: windows-2022 } + - { target: i686-pc-windows-msvc, os: windows-2022, arch: x86 } + # - { target: aarch64-pc-windows-msvc, os: windows-2022 } steps: - name: Export GitHub Actions cache environment variables uses: actions/github-script@v6 diff --git a/.github/workflows/history.yml b/.github/workflows/history.yml index 91e695f8e6..a0c2294c00 100644 --- a/.github/workflows/history.yml +++ b/.github/workflows/history.yml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: job: - - { target: x86_64-pc-windows-msvc, os: windows-2019, arch: x86_64, date: 2023-08-04, ref: 72c198a1e94cc1e0242fce88f92b3f3caedcd0c3 } + - { target: x86_64-pc-windows-msvc, os: windows-2022, arch: x86_64, date: 2023-08-04, ref: 72c198a1e94cc1e0242fce88f92b3f3caedcd0c3 } steps: - name: Checkout source code uses: actions/checkout@v4 diff --git a/.github/workflows/third-party-RustDeskTempTopMostWindow.yml b/.github/workflows/third-party-RustDeskTempTopMostWindow.yml index 78f3ad2f11..2f89092b76 100644 --- a/.github/workflows/third-party-RustDeskTempTopMostWindow.yml +++ b/.github/workflows/third-party-RustDeskTempTopMostWindow.yml @@ -10,7 +10,7 @@ on: description: 'Target' required: true type: string - default: 'windows-2019' + default: 'windows-2022' configuration: description: 'Configuration' required: true diff --git a/res/msi/CustomActions/CustomActions.vcxproj b/res/msi/CustomActions/CustomActions.vcxproj index de16f10391..d2e5fb5700 100644 --- a/res/msi/CustomActions/CustomActions.vcxproj +++ b/res/msi/CustomActions/CustomActions.vcxproj @@ -12,7 +12,7 @@ Win32Proj {6b3647e0-b4a3-46ae-8757-a22ee51c1dac} CustomActions - v142 + v143 10.0 @@ -81,4 +81,4 @@ - \ No newline at end of file + diff --git a/res/msi/README.md b/res/msi/README.md index a4608467dd..5ff2a10800 100644 --- a/res/msi/README.md +++ b/res/msi/README.md @@ -1,6 +1,6 @@ # RustDesk msi project -Use Visual Studio 2019 to compile this project. +Use Visual Studio 2022 to compile this project. This project is mainly derived from . From 0365c944071572626872d32a75e9fe0909bc8d57 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sat, 20 Apr 2024 19:24:44 +0800 Subject: [PATCH 09/11] remove IsWow64Process2 --- src/platform/windows.cc | 17 +------------ src/platform/windows.rs | 56 ++++++----------------------------------- 2 files changed, 9 insertions(+), 64 deletions(-) diff --git a/src/platform/windows.cc b/src/platform/windows.cc index 0d328ac13a..4a9888ad35 100644 --- a/src/platform/windows.cc +++ b/src/platform/windows.cc @@ -698,19 +698,4 @@ extern "C" return isRunning; } -} // end of extern "C" - -extern "C" -{ - int get_native_machine() - { - USHORT processMachine = 0; - USHORT nativeMachine = 0; - BOOL res = IsWow64Process2(GetCurrentProcess(), &processMachine, &nativeMachine); - if (res == TRUE) { - return (int)nativeMachine; - } else { - return -1; - } - } -} +} // end of extern "C" \ No newline at end of file diff --git a/src/platform/windows.rs b/src/platform/windows.rs index a6dfd444fd..6542d1023b 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -460,7 +460,6 @@ extern "C" { fn is_win_down() -> BOOL; fn is_local_system() -> BOOL; fn alloc_console_and_redirect(); - fn get_native_machine() -> i32; fn is_service_running_w(svc_name: *const u16) -> bool; } @@ -2370,55 +2369,16 @@ impl Drop for WallPaperRemover { } } -// See winnt.h for more information. -#[derive(Clone, Copy)] -pub enum MachineArch { - Unknown = 0, - I386 = 0x014c, - ARM = 0x01c0, - AMD64 = 0x8664, - ARM64 = 0xAA64, -} - -pub fn get_machine_arch() -> Result { - let native_machine = unsafe { get_native_machine() }; - if native_machine != -1 { - let native_machine = native_machine as u16; - let check_types = [ - MachineArch::I386, - MachineArch::AMD64, - MachineArch::ARM, - MachineArch::ARM64, - ]; - for check_type in check_types.iter() { - if *check_type as u16 == native_machine { - return Ok(*check_type); - } - } - Ok(MachineArch::Unknown) - } else { - Err(io::Error::last_os_error()) - } -} - pub fn get_amyuni_exe_name() -> Option { - match get_machine_arch() { - Ok(arch) => { - let exe = match arch { - MachineArch::I386 => "deviceinstaller.exe", - MachineArch::AMD64 => "deviceinstaller64.exe", - _ => { - log::error!("Unsupported machine architecture"); - return None; - } - }; - Some(exe.to_string()) - } - Err(e) => { - log::warn!("Failed to get machine architecture: {}", e); - None + let exe = match std::env::consts::ARCH { + "x86" => "deviceinstaller.exe", + "x86_64" => "deviceinstaller64.exe", + _ => { + log::error!("Unsupported machine architecture"); + return None; } - } + }; + Some(exe.to_string()) } fn get_uninstall_amyuni_idd(path: &str) -> String { From 33c8bdfabfe5a927e8500c68567a48087f68b714 Mon Sep 17 00:00:00 2001 From: Kleofass <4000163+Kleofass@users.noreply.github.com> Date: Sun, 21 Apr 2024 09:53:22 +0300 Subject: [PATCH 10/11] Update lv.rs (#7784) --- src/lang/lv.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lang/lv.rs b/src/lang/lv.rs index cc0cf98ff0..9e0b496aba 100644 --- a/src/lang/lv.rs +++ b/src/lang/lv.rs @@ -601,6 +601,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Everyone", "Visi"), ("ab_web_console_tip", "Vairāk par tīmekļa konsoli"), ("allow-only-conn-window-open-tip", "Atļaut savienojumu tikai tad, ja ir atvērts RustDesk logs"), - ("no_need_privacy_mode_no_physical_displays_tip", ""), + ("no_need_privacy_mode_no_physical_displays_tip", "Nav fizisku displeju, nav jāizmanto privātuma režīms."), ].iter().cloned().collect(); } From ad062486ff21e650131bba0376ec44cf9afbbda1 Mon Sep 17 00:00:00 2001 From: fufesou Date: Sun, 21 Apr 2024 14:55:42 +0800 Subject: [PATCH 11/11] Fix/win query arch (#7786) * fix: win, query arch with GetNativeSystemInfo Signed-off-by: fufesou * refact: idd, ci Signed-off-by: fufesou --------- Signed-off-by: fufesou --- .github/workflows/flutter-build.yml | 20 +++++++------- res/msi/CustomActions/CustomActions.cpp | 36 +++++++++++-------------- src/platform/windows.rs | 14 +++++++--- 3 files changed, 36 insertions(+), 34 deletions(-) diff --git a/.github/workflows/flutter-build.yml b/.github/workflows/flutter-build.yml index f9281a6585..fde9ff6cbc 100644 --- a/.github/workflows/flutter-build.yml +++ b/.github/workflows/flutter-build.yml @@ -115,16 +115,11 @@ jobs: - name: Build rustdesk run: | Invoke-WebRequest -Uri https://github.com/rustdesk-org/rdev/releases/download/usbmmidd_v2/usbmmidd_v2.zip -OutFile usbmmidd_v2.zip - $SHA256_SUM = '629b51e9944762bae73948171c65d09a79595cf4c771a82ebc003fbba5b24f51' - if ((Get-FileHash -Path .\usbmmidd_v2.zip -Algorithm SHA256).Hash -ne $SHA256_SUM) { - Write-Error "SHA256 sum mismatch, falling back to the non-virtual-display version" - python3 .\build.py --portable --hwcodec --flutter --vram --skip-portable-pack - } else { - Write-Host "SHA256 sum matched, using the virtual-display version" - Expand-Archive usbmmidd_v2.zip -DestinationPath . - python3 .\build.py --portable --hwcodec --flutter --vram --skip-portable-pack --virtual-display - mv -Force .\usbmmidd_v2 ./flutter/build/windows/x64/runner/Release/ - } + Expand-Archive usbmmidd_v2.zip -DestinationPath . + python3 .\build.py --portable --hwcodec --flutter --vram --skip-portable-pack --virtual-display + Remove-Item -Path usbmmidd_v2\Win32 -Recurse + Remove-Item -Path usbmmidd_v2\deviceinstaller.exe + mv -Force .\usbmmidd_v2 ./flutter/build/windows/x64/runner/Release/ - name: find Runner.res # Windows: find Runner.res (compiled from ./flutter/windows/runner/Runner.rc), copy to ./Runner.res @@ -262,11 +257,14 @@ jobs: python3 res/inline-sciter.py # Patch sciter x86 sed -i 's/branch = "dyn"/branch = "dyn_x86"/g' ./Cargo.toml - cargo build --features inline,vram,hwcodec --release --bins + cargo build --features inline,vram,hwcodec,virtual_display_driver --release --bins mkdir -p ./Release mv ./target/release/rustdesk.exe ./Release/rustdesk.exe curl -LJ -o ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll echo "output_folder=./Release" >> $GITHUB_OUTPUT + curl -LJ -o ./usbmmidd_v2.zip https://github.com/rustdesk-org/rdev/releases/download/usbmmidd_v2/usbmmidd_v2.zip + unzip usbmmidd_v2.zip + mv ./usbmmidd_v2 ./Release || true - name: find Runner.res # Windows: find Runner.res (compiled from ./flutter/windows/runner/Runner.rc), copy to ./Runner.res diff --git a/res/msi/CustomActions/CustomActions.cpp b/res/msi/CustomActions/CustomActions.cpp index 3643ea9cea..9a019ea491 100644 --- a/res/msi/CustomActions/CustomActions.cpp +++ b/res/msi/CustomActions/CustomActions.cpp @@ -607,9 +607,7 @@ UINT __stdcall RemoveAmyuniIdd( DWORD fileAttributes = 0; HINSTANCE hi = 0; - USHORT processMachine = 0; - USHORT nativeMachine = 0; - BOOL isWow64Res = FALSE; + SYSTEM_INFO si; LPCWSTR exe = NULL; hr = WcaInitialize(hInstall, "RemoveAmyuniIdd"); @@ -630,24 +628,22 @@ UINT __stdcall RemoveAmyuniIdd( goto LExit; } - isWow64Res = IsWow64Process2(GetCurrentProcess(), &processMachine, &nativeMachine); - if (isWow64Res == TRUE) { - if (nativeMachine == IMAGE_FILE_MACHINE_AMD64) { - exe = L"deviceinstaller64.exe"; - } else { - exe = L"deviceinstaller.exe"; - } - WcaLog(LOGMSG_STANDARD, "Remove amyuni idd %ls in %ls", exe, workDir); - hi = ShellExecuteW(NULL, L"open", exe, L"remove usbmmidd", workDir, SW_HIDE); - // https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutew - if ((int)hi <= 32) { - WcaLog(LOGMSG_STANDARD, "Failed to remove amyuni idd : %d, last error: %d", (int)hi, GetLastError()); - } - else { - WcaLog(LOGMSG_STANDARD, "Amyuni idd is removed"); - } + GetNativeSystemInfo(&si); + if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { + exe = L"deviceinstaller64.exe"; } else { - WcaLog(LOGMSG_STANDARD, "Failed to call IsWow64Process2(): %d", GetLastError()); + // No need to check if is other architecture. + // Because the driver is only for x86 and x64. It will not work at on other architectures. + exe = L"deviceinstaller.exe"; + } + WcaLog(LOGMSG_STANDARD, "Remove amyuni idd %ls in %ls", exe, workDir); + hi = ShellExecuteW(NULL, L"open", exe, L"remove usbmmidd", workDir, SW_HIDE); + // https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutew + if ((int)hi <= 32) { + WcaLog(LOGMSG_STANDARD, "Failed to remove amyuni idd : %d, last error: %d", (int)hi, GetLastError()); + } + else { + WcaLog(LOGMSG_STANDARD, "Amyuni idd is removed"); } LExit: diff --git a/src/platform/windows.rs b/src/platform/windows.rs index 6542d1023b..4e213c5015 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -42,6 +42,7 @@ use winapi::{ }, securitybaseapi::GetTokenInformation, shellapi::ShellExecuteW, + sysinfoapi::{GetNativeSystemInfo, SYSTEM_INFO}, winbase::*, wingdi::*, winnt::{ @@ -2370,9 +2371,16 @@ impl Drop for WallPaperRemover { } pub fn get_amyuni_exe_name() -> Option { - let exe = match std::env::consts::ARCH { - "x86" => "deviceinstaller.exe", - "x86_64" => "deviceinstaller64.exe", + let mut sys_info = SYSTEM_INFO::default(); + unsafe { + GetNativeSystemInfo(&mut sys_info as _); + } + const PROCESSOR_ARCHITECTURE_INTEL: u16 = 0; + const PROCESSOR_ARCHITECTURE_AMD64: u16 = 9; + + let exe = match unsafe { sys_info.u.s().wProcessorArchitecture } { + PROCESSOR_ARCHITECTURE_INTEL => "deviceinstaller.exe", + PROCESSOR_ARCHITECTURE_AMD64 => "deviceinstaller64.exe", _ => { log::error!("Unsupported machine architecture"); return None;