chansrv: work on dynamic channels

master
Jay Sorg 12 years ago
parent f43e0eb68f
commit 7539d7271e

@ -65,6 +65,7 @@ struct xrdp_api_data
{
int chan_id;
char header[64];
int flags;
};
/*****************************************************************************/
@ -535,16 +536,26 @@ my_api_trans_conn_in(struct trans* trans, struct trans* new_trans)
g_memcpy(ad->header, s->data, 64);
ad->flags = GGET_UINT32(ad->header, 16);
found = 0;
for (index = 0; index < g_num_chan_items; index++)
if (ad->flags | 1) /* WTS_CHANNEL_OPTION_DYNAMIC */
{
/* TODO */
found = 0;
}
else
{
LOG(10, (" %s %s", ad->header, g_chan_items[index].name));
if (g_strcasecmp(ad->header, g_chan_items[index].name) == 0)
for (index = 0; index < g_num_chan_items; index++)
{
LOG(10, ("my_api_trans_conn_in: found it at %d", index));
ad->chan_id = g_chan_items[index].id;
found = 1;
break;
LOG(10, (" %s %s", ad->header, g_chan_items[index].name));
if (g_strcasecmp(ad->header, g_chan_items[index].name) == 0)
{
LOG(10, ("my_api_trans_conn_in: found it at %d", index));
ad->chan_id = g_chan_items[index].id;
found = 1;
break;
}
}
}
LOG(10, ("my_api_trans_conn_in: found %d", found));

@ -54,4 +54,23 @@ main_cleanup(void);
#define LOGM(_args)
#endif
#ifndef GSET_UINT8
#define GSET_UINT8(_ptr, _offset, _data) \
*((unsigned char*) (((unsigned char*)(_ptr)) + (_offset))) = (unsigned char)(_data)
#define GGET_UINT8(_ptr, _offset) \
(*((unsigned char*) (((unsigned char*)(_ptr)) + (_offset))))
#define GSET_UINT16(_ptr, _offset, _data) \
GSET_UINT8(_ptr, _offset, _data); \
GSET_UINT8(_ptr, (_offset) + 1, (_data) >> 8)
#define GGET_UINT16(_ptr, _offset) \
(GGET_UINT8(_ptr, _offset)) | \
((GGET_UINT8(_ptr, (_offset) + 1)) << 8)
#define GSET_UINT32(_ptr, _offset, _data) \
GSET_UINT16(_ptr, _offset, _data); \
GSET_UINT16(_ptr, (_offset) + 2, (_data) >> 16)
#define GGET_UINT32(_ptr, _offset) \
(GGET_UINT16(_ptr, _offset)) | \
((GGET_UINT16(_ptr, (_offset) + 2)) << 16)
#endif
#endif

@ -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)
{

@ -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;
}
/*****************************************************************************/

@ -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
{

Loading…
Cancel
Save