简体   繁体   English

检测Citrix XenDesktop会话

[英]Detecting a Citrix XenDesktop Session

I'm looking to determine if our application is running on a XenDesktop session rather than locally. 我想确定我们的应用程序是在XenDesktop会话上运行而不是在本地运行。 Here is what I have found so far: 这是我到目前为止所发现的:


We currently have code to detect a Citrix XenApp session similar to the solution mentioned by Helge Klein in " API for Determining if App is Running on Citrix or Terminal Services ". 我们目前有代码来检测Citrix XenApp会话,类似于Helge Klein在“ 用于确定应用程序是否在Citrix或终端服务上运行的API ”中提到的解决方案。

Sadly that solution in a XenDesktop environment is returning back a WTSClientProtocolType of 0 which signifies a local console session. 遗憾的是,XenDesktop环境中的解决方案是返回WTSClientProtocolType0 ,表示本地控制台会话。

In response to the same question Josh Weatherly mentioned checking the sessionname environment variable. 在回答同样的问题时,Josh Weatherly提到检查sessionname环境变量。

However a quick console check with echo %sessionname% on the XenDesktop environment returns back 'Console'. 但是,在XenDesktop环境中使用echo %sessionname%进行快速控制台检查会返回“控制台”。

From " Detect citrix “application mode”? " John Sibly suggested a solution for detecting a remote session (not Citrix in particular): 从“ Detect citrix”应用程序模式“? ”John Sibly建议用于检测远程会话的解决方案(特别是Citrix):

GetSystemMetrics(SM_REMOTESESSION) however returns 0 which also means that it is a local session. 然而, GetSystemMetrics(SM_REMOTESESSION)返回0,这也意味着它是本地会话。


Does anyone know of a way to detect that it is a XenDesktop session? 有谁知道检测它是XenDesktop会话的方法? So far as you can see all my attempts are returning that the session is a local console session. 到目前为止,您可以看到我的所有尝试都返回,该会话是本地控制台会话。

I'm using XenDesktop Express 5.5, accessing the desktop using the Citrix Receiver Web Plug-In. 我正在使用XenDesktop Express 5.5,使用Citrix Receiver Web插件访问桌面。

If you are using XenDesktop for VDI, then as far as the application is concerned, the application is executing locally. 如果您使用XenDesktop进行VDI,那么就应用程序而言,应用程序正在本地执行。 VDI, or virtual desktop infrastructure, consists of delivering the GUI from a full featured desktop operating system to a remote device. VDI或虚拟桌面基础架构包括将GUI从全功能桌面操作系统提供给远程设备。 Typically, the desktop O/S executes in a virtual machine on a hypervisor in a data center, and the GUI is transmitted to the remote device using Citrix' ICA stack. 通常,桌面O / S在数据中心中的管理程序上的虚拟机中执行,并且使用Citrix的ICA堆栈将GUI发送到远程设备。 For example, this happens in the pooled desktops scenario. 例如,这发生在池桌面方案中。

XenApp offers virtual desktops, which is a slightly different concept. XenApp提供虚拟桌面,这是一个略有不同的概念。 Again, the desktop is delivered to a remote device using the ICA stack. 同样,桌面使用ICA堆栈传送到远程设备。 However, the desktop is no longer running on a dedicated O/S. 但是,桌面不再在专用操作系统上运行。 Rather, it is one of a number of user sessions on a single Windows Server. 相反,它是单个Windows Server上的许多用户会话之一。 There may be any number of users logged on to that server. 可能有任意数量的用户登录到该服务器。 This places limits on the applications that can be run, which is why applications might want to know that they are on a multi-user O/S. 这限制了可以运行的应用程序,这就是应用程序可能想知道它们在多用户操作系统上的原因。

What you might try to do is determine whether the GUI is being delivered remotely using the ICA stack. 您可能尝试做的是确定是否使用ICA堆栈远程传递GUI。 A simple check would involve looking for the "ProticaService", which is responsible for implementing the ICA stack. 一个简单的检查将涉及寻找“ProticaService”,它负责实现ICA堆栈。

Alternatively, you may be trying to determine if your machine is running in a VM or native to a machine. 或者,您可能正在尝试确定您的计算机是在VM中运行还是在机器上运行。 Besides the pooled scenario described in the first paragraph, XenDesktop can deliver desktop running native. 除了第一段中描述的池化场景外,XenDesktop还可以提供桌面运行本机。 This overcomes limits on virtualision I/O devices such as graphics cards used by CAD applications. 这克服了虚拟化I / O设备的限制,例如CAD应用程序使用的图形卡。 In this case, you need to rule out the presence of a VMM, or hypervisor. 在这种情况下,您需要排除VMM或虚拟机管理程序的存在。

I have updated my answer linked to in the question with a description of how to determine the remoting protocol type in XenDesktop sessions. 我已经更新了我在问题中链接的答案 ,并说明了如何在XenDesktop会话中确定远程处理协议类型。

You need the (not really well documented) function WFGetActiveProtocol from Citrix' WFAPI SDK. 您需要Citrix的WFAPI SDK中的( WFGetActiveProtocol )功能WFGetActiveProtocol Proceed as follows: 请按以下步骤操作:

  1. Download the SDK ( link ) 下载SDK( 链接
  2. Install WFApiSDK64-65.msi 安装WFApiSDK64-65.msi
  3. In your C++ project include wfapi.h and link to wfapi[64].lib 在您的C ++项目中包括wfapi.h并链接到wfapi[64].lib
  4. Use the undocumented function WFGetActiveProtocol 使用未记录的函数WFGetActiveProtocol

More detail and sample code here . 这里有更多细节和示例代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM