From: Sergey Voinov Sergey on
Hi All,

I use WTSQuerySessionInformation function to get information about a
terminal session (WTSSessionInfo info class). The problem is that
WTSQuerySessionInformation always fails with error code 0x000003e5
(Overlapped I/O operation is in progress). I call WTSQuerySessionInformation
from a terminal session and I am an administrator on that machine.

Here is my code:

PWTSCLIENTW pclnt = NULL;
DWORD dwRetLen = 0;
bRes = ::WTSQuerySessionInformationW(
hServer, WTS_CURRENT_SESSION, WTSClientInfo, (LPWSTR*)(&pclnt),
&dwRetLen);
DWORD dwErr = ::GetLastError();
if (bRes)
{
wprintf(L"%s\n", pclnt->UserName);
::WTSFreeMemory(pclnt);
}

Anyone have an answer?
Thanks.

From: Soo Kuan Teo [MSFT] on
What is the Windows version of Terminal Services are you running?
how do you initialize hServer?


--
This posting is provided "AS IS" with no warranties, and confers no rights.

"Sergey Voinov" <Sergey Voinov(a)discussions.microsoft.com> wrote in message
news:AB727A3D-27C4-4C79-AFD7-E2B1D1A1743F(a)microsoft.com...
> Hi All,
>
> I use WTSQuerySessionInformation function to get information about a
> terminal session (WTSSessionInfo info class). The problem is that
> WTSQuerySessionInformation always fails with error code 0x000003e5
> (Overlapped I/O operation is in progress). I call
> WTSQuerySessionInformation
> from a terminal session and I am an administrator on that machine.
>
> Here is my code:
>
> PWTSCLIENTW pclnt = NULL;
> DWORD dwRetLen = 0;
> bRes = ::WTSQuerySessionInformationW(
> hServer, WTS_CURRENT_SESSION, WTSClientInfo, (LPWSTR*)(&pclnt),
> &dwRetLen);
> DWORD dwErr = ::GetLastError();
> if (bRes)
> {
> wprintf(L"%s\n", pclnt->UserName);
> ::WTSFreeMemory(pclnt);
> }
>
> Anyone have an answer?
> Thanks.
>