Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Terminal Services

4 views
Skip to first unread message

amdrit

unread,
Oct 3, 2007, 10:18:31 AM10/3/07
to
Hello,

I am seeking guidance on working with virtual channels through terminal
services. I hope this is a good spot to post.

I think what I really need to understand is the order of operation for
conversations on the channel.


I have been able to create a component and create a registry entry for the
channel in the terminal services add-on. I have successfully opened the
channel from the terminal server and pushed a message down to the client
machine.

What I have not been able to do is respond to the message from the client
box. Any attempt write to the channel from the client causes mstsc to
crash.


MSDN does not really expound on the api, certainly it describes each of the
api calls and structures. I am assuming that once the channel was opened
and I have a handle to the channel that I can simply
call WTSVirtualChannelWrite to write back to the session application. Even
if the session application wasn't listening for the message, it should be
that simple.

Now the next question is how do I poll for messages pending to be read by
the session application? Since I am not supposed to be blocking, I don't
know how to peek into a queue. I assume that I can use
WTSVirtualChannelRead, but I don't know how big to the pending message will
be.


Any help on the subject is greatly appreciated.

Thanks in advance.


Sam Hobbs

unread,
Oct 3, 2007, 11:38:57 AM10/3/07
to
I have made less progress than you. I know the documentation is vague and
that there are not articles .... wait I think there is an article I found
when I searched, but I forget where it is. I searched the MSDN and the
internet using relevant function names.

I assume the networking newsgroup is more likely to get answers.


"amdrit" <amd...@hotmail.com> wrote in message
news:%23JyHIhc...@TK2MSFTNGP05.phx.gbl...

amdrit

unread,
Oct 3, 2007, 12:45:42 PM10/3/07
to
Thanks Sam,

I have included the networking group in this post.

Currently I am working with documentation found:
http://www.microsoft.com/technet/archive/termsrv/maintain/featusability/tsrvapi.mspx?mfr=true
http://msdn2.microsoft.com/en-us/library/aa383580.aspx
http://msdn2.microsoft.com/en-us/library/aa383853.aspx
http://www.codeproject.com/cs/system/TSAddinInCS.asp?df=100&forumid=358838&exp=0&select=1961960

That is all I can really find about the topic.

I am still having problems with WTSVirtualChannelRead, at least I think I
am. Nothing seems to be writtin.

Here is a brief overview of What I have done:

I created a messagelib that will contain messages I am sending back and
forth.

Class MessageHeader
int MessageType
MessageBase Message

Abstract Class MessageBase

Class StatusMessage: MessageBase
String StatusText


Now on my session component I do:

1. Call WTSVirtualChannelOpen to get a handle on the channel
2. Create a StatusMessage
StatusText = "ACK"
3. Serialize the message
4. Send the message

Now on my client component I do:

1. VirtualChannelEntry waits to be called (This is what loads the
assembly), store the handle in mHandle
point my VirtualChannelInit to the function
VirtualChannelInitEventProc
2. Once the VirtualChannelInitEventProc determines that a complete
message was send over, I deserialize and process the message
3. Determine the type of message that was send (type == 1
//StatusMessage)
4. Determine what the StatusText is "ACK"
5. Generate a reply StatusMessage "NACK"
6. Serialize the message
7. Send the message
a. open the channel using the WTSVirtualChannelOpen(mHandle,-1,
"Impact"), store the new pointer in intTemp
b. write the data using WTSVirtualChannelWrite

at this point, I believe my data is waiting for the server to pick it
up. I get a true returned from WTSVirtualChannelWrite

Back to the session component

I have a background worker process that is monitoring for pending
messages.

1. Open the channel with WTSVirtualChannelOpen
2. Read until there is nothing left to read, add the read bytes into
list<byte> using WTSVirtualChannelRead
3. If anything was read
a. Deserialize the MessageHeader
b. Determine Message Type (type == 1//StatusMessage)
c. Report StatusText "NACK"

At this point, nothing is read by the WTSVirtualChannelRead. I don't
know where my message is.

Does anyone have any ideas of where to start?

BTW, I am using C# 2005. But the concept should be the same.

Thanks in advance.


"Sam Hobbs" <sam...@social.rr.com_change_social_to_socal> wrote in message
news:OKM2HOdB...@TK2MSFTNGP06.phx.gbl...

amdrit

unread,
Oct 4, 2007, 1:26:54 PM10/4/07
to
Is there nobody that knows how to work with RDP or is everyone just ignoring
me? I don't know where else to post my questions and my need is still real,
I am just looking for the formula to have two way communications via RDP.


"amdrit" <amd...@hotmail.com> wrote in message

news:%23yLeXzd...@TK2MSFTNGP02.phx.gbl...

0 new messages