We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
有一个 API 函数可让您确定特定的用户会话是显示在控制台上(本地)还是通过远程协议 Citrix ICA(现在称为 HDX)或 Microsoft RDP 之一显示。
调用 WTSQuerySessionInformation,并将第三个参数设置为 WTSClientProtocolType。该函数返回:
有趣的是,返回值 1 在 MSDN(上面的第二个链接)上不再记录为
WTS_PROTOCOL_TYPE_ICA
,而是记录为“此值是保留用于遗留目的。”。更新:
XenDesktop 无法使用
WTSQuerySessionInformation
检测会话(它返回 0,表示控制台)。如果您想要通用解决方案:WTSQuerySessionInformation
。如果返回 1 或 2(ICA 或 RDP),则您已完成。WTSQuerySessionInformation
返回0(控制台),则动态加载wfapi.dll
并获取WFGetActiveProtocol
的地址WFGetActiveProtocol
WF_CURRENT_SESSION 参数,定义为 ((DWORD)-1)我已经详细描述了该过程 此处以及 C++ 代码示例和返回当前会话的远程处理协议类型的工作编译工具。
There is an API function that lets you determine whether a specific user session is displayed on the console (locally) or via one the the remoting protocols Citrix ICA (nowadays called HDX) or Microsoft RDP.
Call WTSQuerySessionInformation with 3rd parameter set to WTSClientProtocolType. The function returns:
Interestingly the return value of 1 is not documented as
WTS_PROTOCOL_TYPE_ICA
on MSDN (second link above) any more, but as "This value is retained for legacy purposes.".Update:
XenDesktop sessions cannot be detected with
WTSQuerySessionInformation
(it returns 0, meaning Console). If you want a universal solution:WTSQuerySessionInformation
. If that returns 1 or 2 (ICA or RDP), you are done.WTSQuerySessionInformation
returns 0 (Console), dynamically loadwfapi.dll
and get the address ofWFGetActiveProtocol
WFGetActiveProtocol
with a parameter ofWF_CURRENT_SESSION
, which is defined as ((DWORD)-1)WFGetActiveProtocol
is the session type. It should be either 0 (Console) or 1 (ICA)I have described the process in detail here along with a C++ code sample and a working compiled tool that returns the current session's remoting protocol type.
根据: http://forums.citrix.com/message.jspa?messageID=1363711< /a> 您可以检查SESSIONNAME环境变量。
我用我的电脑测试了它,并在本地得到:
虽然远程我得到了
所以这似乎是一条简单的路线,否则听起来像检查注册表值或某些 dll 是否存在将是下一个最好的事情。
According to: http://forums.citrix.com/message.jspa?messageID=1363711 you can check the SESSIONNAME environment variable.
I tested it with my PC and locally I get:
While remotely I got
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.
按照@Josh的回答,代码将如下所示:
我还没有完全测试它,但看起来它会做我想要的事情。 PC 和终端服务器正确报告。
如果有人有办法在 Citrix 盒子上测试这一点,我们将不胜感激!
Following @Josh's answer, the code would look like this:
I haven't fully tested it out yet, but it looks like it will do what I want. PCs and Terminal Servers reports correctly.
If someone has a way to test this on a Citrix box, it would be much appreciated!
根据 Helge Klein 的修订答案(上面),我想我应该发布 VBA 代码来实现这一点,以帮助未来的 VBA 用户点击此页面。 Helge 已经在他自己的网站上有了 C++ 代码。如果您觉得这有帮助,请为 Helge Klein 的回答点赞。
我已经在 XenApp 和 XenDesktop 上对此进行了测试。
Based on Helge Klein's revised answer (above) I thought I'd post the VBA code to make this happen to help future VBA users hitting this page. Helge already has the C++ code on his own site. If you find this helpful, please upvote Helge Klein's answer.
I've tested this on XenApp and XenDesktop.