添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
含蓄的罐头  ·  Sort a list of ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am using a free application virtualization app - Winflector.

When I use GetSystemMetrics(SM_REMOTESESSION) the function correctly detects that application is running in a remote session, however, WTSQuerySessionInformationA() fails to detect and thus cannot get WTSClientInfo . I want to know, what is difference in the functionalities of these APIs. Also, I am interested in knowing how can I programmatically detect client Side information when running through these kind of applications.

if (GetSystemMetrics(SM_REMOTESESSION))  //passes
        printf("\n\n\tSM_REMOTESESSION says this application is running in a remote session \n");
if (WTSQuerySessionInformationA(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSIsRemoteSession, &pData, &bytesReturned)){   //fails

Also wanted to know if there is a possibility that these kind of applications may employ virtual channels (or dynamic virtual channels) infrastructure of windows?

From WTSQuerySessionInformationA: "If the function fails, the return value is zero. To get extended error information, call GetLastError." Unless you want to compile your code to run on Win9x, call the Unicode version of the API. – IInspectable May 19, 2020 at 11:22 @IInspectable I tried to look into the error code and it was 2250 that means "no connection". That becomes my question, why the same is not a problem for GetSystemMetrics(). Thanks – ultimate cause May 19, 2020 at 13:12 @ultimatecause See WTSIsRemoteSession always returns TRUE for how to use WTSIsRemoteSession. – Remy Lebeau May 19, 2020 at 16:39 @RemyLebeau Thanks for second help on same day. In the link you pasted, you emphasized on return value of the function rather than OUT parameter (plz correct me). So, do you mean to say that I should still be referring to OUT parameter, despite getting a failure as return value. I am getting different value only in the case of this application (Winflector). In the RDP sessions I get correct results. Little emphasis please. – ultimate cause May 19, 2020 at 18:33 @ultimatecause if you read the answer I had posted, I actually cover BOTH possibilities. You will have to test both ways to see which way is actually implemented by Windows. I didn't test it myself. "I am getting different value only in the case of this application (Winflector). In the RDP sessions I get correct results" - what do you mean? I don't understand what you are saying now. – Remy Lebeau May 19, 2020 at 18:44

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.