chansrv: work on dynamic channels

This commit is contained in:
Jay Sorg
2012-08-08 22:21:32 -07:00
parent f43e0eb68f
commit 7539d7271e
5 changed files with 58 additions and 11 deletions
+8 -3
View File
@@ -16,20 +16,25 @@ int main()
{
// Initialize the data for send/receive
void* hFile;
char* data;
char* data1;
data = (char*)malloc(DSIZE);
data1 = (char*)malloc(DSIZE);
int ret;
void* vcFileHandlePtr = NULL;
memset(data, 0xca, DSIZE);
memset(data1, 0, DSIZE);
unsigned int written = 0;
// Open the skel channel in current session
void* channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "skel", 0);
//void* channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "skel", 0);
void* channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "TSMF", WTS_CHANNEL_OPTION_DYNAMIC);
ret = WTSVirtualChannelQuery(channel, WTSVirtualFileHandle, vcFileHandlePtr, &written);
unsigned int written = 0;
// Write the data to the channel
int ret = WTSVirtualChannelWrite(channel, data, DSIZE, &written);
ret = WTSVirtualChannelWrite(channel, data, DSIZE, &written);
if (!ret)
{
+7 -1
View File
@@ -45,6 +45,7 @@ struct wts_obj
char name[8];
char dname[128];
int display_num;
int flags;
};
/*****************************************************************************/
@@ -158,6 +159,10 @@ send_init(struct wts_obj* wts)
memset(initmsg, 0, 64);
strncpy(initmsg, wts->name, 8);
initmsg[16] = (wts->flags >> 0) & 0xff;
initmsg[17] = (wts->flags >> 8) & 0xff;
initmsg[18] = (wts->flags >> 16) & 0xff;
initmsg[19] = (wts->flags >> 24) & 0xff;
LLOGLN(10, ("send_init: sending %s", initmsg));
if (!can_send(wts->fd, 500))
{
@@ -191,6 +196,7 @@ WTSVirtualChannelOpenEx(unsigned int SessionId,
wts = (struct wts_obj*)malloc(sizeof(struct wts_obj));
memset(wts, 0, sizeof(struct wts_obj));
wts->fd = -1;
wts->flags = flags;
display_text = getenv("DISPLAY");
if (display_text != 0)
{
@@ -363,7 +369,7 @@ WTSVirtualChannelQuery(void* hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass,
*ppBuffer = malloc(4);
memcpy(*ppBuffer, &(wts->fd), 4);
}
return 0;
return 1;
}
/*****************************************************************************/
+6
View File
@@ -30,6 +30,12 @@ extern "C" {
#define WTS_CURRENT_SERVER_HANDLE 0
#define WTS_CURRENT_SESSION 0xffffffff
#define WTS_CHANNEL_OPTION_DYNAMIC 0x00000001
#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_LOW 0x00000000
#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_MED 0x00000002
#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_HIGH 0x00000004
#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_REAL 0x00000006
#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_COMPRESS 0x00000008
typedef enum _WTS_VIRTUAL_CLASS
{