用于确定应用程序是在 Citrix 还是终端服务上运行的 API [英] API for Determining if App is Running on Citrix or Terminal Services

查看:26
本文介绍了用于确定应用程序是在 Citrix 还是终端服务上运行的 API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找可以调用的 API/函数,以确定软件是在 Citrix、终端服务还是独立 PC 上运行.最佳情况下,它会像这样工作:

I'm looking for an API/function I can call to determine if software is running on Citrix, Terminal Services, or a stand-alone PC. Optimally, it would work something like this:

Select Case APIWhatSystem.Type.ToString
   Case "Citrix"
      bCitrix = True
   Case "TS"
      bTerminalServices = True
   Case "PC"
      bPC = True
End Select

我更喜欢通过 API 调用工作的东西,而不是查看注册表中的东西,因为我们有越来越多的客户锁定注册表.

I would prefer something that worked from an API call as opposed to looking at something in the registry as we're having more and more customers that are locking down the registry.

谢谢.

推荐答案

根据:http://forums.citrix.com/message.jspa?messageID=1363711 可以查看 SESSIONNAME 环境变量.

According to: http://forums.citrix.com/message.jspa?messageID=1363711 you can check the SESSIONNAME environment variable.

另一种更简单的方法是读取系统环境变量SESSIONNAME".如果它存在并以ICA"开头,那么您正在 Citrix 会话中运行.如果它以RDP"开头,那么您正在 RDP 会话中运行.

Another simpler way is to read the system environment variable "SESSIONNAME". If it exists and starts with "ICA" then you're running within a Citrix session. If it starts with "RDP" then you're running within an RDP session.

我用我的电脑测试了它,我在本地得到:

I tested it with my PC and locally I get:

C:\>echo %SESSIONNAME%
Console

虽然我得到了远程

C:\>echo %SESSIONNAME%
RDP-tcp1

所以看起来这可能是一条简单的路线,否则听起来像检查注册表值或是否存在某些 dll 将是下一个最好的事情.

So it seems like it might be an easy route to go, otherwise it sounds like checking for registry values or if certain dlls exist will be the next best thing.

这篇关于用于确定应用程序是在 Citrix 还是终端服务上运行的 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆