Skip to content

Commit

Permalink
rustdesk#937 (reply in thread) try to support citrix session
Browse files Browse the repository at this point in the history
  • Loading branch information
rustdesk committed Mar 3, 2025
1 parent 6600c8c commit 7305b6b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/platform/windows.cc
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,9 @@ extern "C"
DWORD count;
auto rdp = "rdp";
auto nrdp = strlen(rdp);
// https://github.com/rustdesk/rustdesk/discussions/937#discussioncomment-12373814 citrix session
auto ica = "ica";
auto nica = strlen(ica);
if (WTSEnumerateSessionsA(WTS_CURRENT_SERVER_HANDLE, NULL, 1, &pInfos, &count))
{
for (DWORD i = 0; i < count; i++)
Expand All @@ -558,7 +561,7 @@ extern "C"
WTSFreeMemory(pInfos);
return id;
}
if (!strnicmp(info.pWinStationName, rdp, nrdp))
if (!strnicmp(info.pWinStationName, rdp, nrdp) || !strnicmp(info.pWinStationName, ica, nica))
{
rdp_or_console = info.SessionId;
}
Expand Down Expand Up @@ -614,6 +617,8 @@ extern "C"
auto info = pInfos[i];
auto rdp = "rdp";
auto nrdp = strlen(rdp);
auto ica = "ica";
auto nica = strlen(ica);
if (info.State == WTSActive) {
if (info.pWinStationName == NULL)
continue;
Expand All @@ -626,6 +631,9 @@ extern "C"
else if (include_rdp && !strnicmp(info.pWinStationName, rdp, nrdp)) {
sessionIds.push_back(std::wstring(L"RDP:") + std::to_wstring(info.SessionId));
}
else if (include_rdp && !strnicmp(info.pWinStationName, ica, nica)) {
sessionIds.push_back(std::wstring(L"ICA:") + std::to_wstring(info.SessionId));
}
}
}
WTSFreeMemory(pInfos);
Expand Down

0 comments on commit 7305b6b

Please sign in to comment.