Why Query with SM_REMOTESESSION succeeds but WTSIsRemoteSession fails?

665 Views Asked by At

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?

0

There are 0 best solutions below