An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
windows specific session, fix conn count (#7133)
21pages73d429d0643b
diff --git a/src/platform/windows.cc b/src/platform/windows.ccindex e674a2230..68d194c50 100644--- a/src/platform/windows.cc+++ b/src/platform/windows.cc@@ -464,7 +464,7 @@ extern "C"void get_available_session_ids(PWSTR buf, uint32_t bufSize, BOOL include_rdp) {std::vector<std::wstring> sessionIds;- PWTS_SESSION_INFOA pInfos;+ PWTS_SESSION_INFOA pInfos = NULL;DWORD count;if (WTSEnumerateSessionsA(WTS_CURRENT_SERVER_HANDLE, 0, 1, &pInfos, &count)) {@@ -498,7 +498,7 @@ extern "C"}if (buf && !tmpStr.empty() && tmpStr.size() < bufSize) {- memcpy(buf, tmpStr.c_str(), (tmpStr.size() + 1) * sizeof(wchar_t));+ wcsncpy_s(buf, bufSize, tmpStr.c_str(), tmpStr.size());}}diff --git a/src/server/connection.rs b/src/server/connection.rsindex 03c760872..4e8a86a50 100644--- a/src/server/connection.rs+++ b/src/server/connection.rs@@ -1826,7 +1826,7 @@ impl Connection {self.checked_multiple_session = true;if crate::platform::is_installed()&& crate::platform::is_share_rdp()- && !(*CONN_COUNT.lock().unwrap() > 1)+ && Self::alive_conns().len() == 1&& get_version_number(&self.lr.version) >= get_version_number("1.2.4"){if !self@@ -3487,6 +3487,10 @@ extern "C" fn connection_shutdown_hook() {}mod raii {+ // CONN_COUNT: remote connection count in fact+ // ALIVE_CONNS: all connections, including unauthorized connections+ // AUTHED_CONNS: all authorized connections+use super::*;pub struct ConnectionID(i32);