Hello, i have 2 projects:
1. client - which is a DLL that is integrated to the remote desktop product.
client can send using VirtualChannelWrite, inside CHANNEL_ENTRY_POINTS struct.
it also receives data through a delegate that we register on.
2. Server - which inits the channel, using: WTSVirtualChannelOpen
then, there's a
while (true)
{
BOOL code = WTSVirtualChannelRead(... PULONG pBytesRead);
if (code == 0)
{
int lastError = GetLastError();
}
else if (pBytesRead > 0)
{
}
}
when i open the mstsc, and then lunch the server, everything works fine.
data is sent and received from client to server.
when i close the remote desktop window (press on X), the server is still running (inside the loop).
but when i open the mstsc again, then even when i send data, the receiving side is not getting it.
i assume that, because when you terminate the client session, it is said that the virtual channel is closed.
BUT, the server side has no idea about it.
i keep getting the same code from the call (0), and same lasterror - 667, which is 667 also when i get a correct data.
i'm in the dark here,
how can i know when a new session started? (when i connected to the mstsc again), i'd like to free the virtual channel handle at the server side, and then reconnect using WTSVirtualChannelOpen.
please help :|
Ariel.