|
|
@ -29,6 +29,7 @@ xrdp_fastpath_create(struct xrdp_sec *owner, struct trans *trans)
|
|
|
|
self = (struct xrdp_fastpath *)g_malloc(sizeof(struct xrdp_fastpath), 1);
|
|
|
|
self = (struct xrdp_fastpath *)g_malloc(sizeof(struct xrdp_fastpath), 1);
|
|
|
|
self->sec_layer = owner;
|
|
|
|
self->sec_layer = owner;
|
|
|
|
self->trans = trans;
|
|
|
|
self->trans = trans;
|
|
|
|
|
|
|
|
self->session = owner->rdp_layer->session;
|
|
|
|
DEBUG((" out xrdp_fastpath_create"));
|
|
|
|
DEBUG((" out xrdp_fastpath_create"));
|
|
|
|
return self;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -243,3 +244,183 @@ xrdp_fastpath_process_data(struct xrdp_fastpath *self, struct stream *s,
|
|
|
|
in_uint16_le(s, size);
|
|
|
|
in_uint16_le(s, size);
|
|
|
|
return xrdp_fastpath_process_update(self, updateCode, size, s);
|
|
|
|
return xrdp_fastpath_process_update(self, updateCode, size, s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
/* FASTPATH_INPUT_EVENT_SCANCODE */
|
|
|
|
|
|
|
|
int APP_CC
|
|
|
|
|
|
|
|
xrdp_fastpath_process_EVENT_SCANCODE(struct xrdp_fastpath *self, int eventFlags, struct stream *s)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int flags;
|
|
|
|
|
|
|
|
int code;
|
|
|
|
|
|
|
|
flags = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
in_uint8(s, code); /* keyCode (1 byte) */
|
|
|
|
|
|
|
|
//g_writeln("scan code detected: %d", code);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((eventFlags & FASTPATH_INPUT_KBDFLAGS_RELEASE))
|
|
|
|
|
|
|
|
flags |= KBD_FLAG_UP;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
flags |= KBD_FLAG_DOWN;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((eventFlags & FASTPATH_INPUT_KBDFLAGS_EXTENDED))
|
|
|
|
|
|
|
|
flags |= KBD_FLAG_EXT;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (self->session->callback != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* msg_type can be
|
|
|
|
|
|
|
|
RDP_INPUT_SYNCHRONIZE - 0
|
|
|
|
|
|
|
|
RDP_INPUT_SCANCODE - 4
|
|
|
|
|
|
|
|
RDP_INPUT_MOUSE - 0x8001
|
|
|
|
|
|
|
|
RDP_INPUT_MOUSEX - 0x8002 */
|
|
|
|
|
|
|
|
/* call to xrdp_wm.c : callback */
|
|
|
|
|
|
|
|
self->session->callback(self->session->id, RDP_INPUT_SCANCODE, code, 0,
|
|
|
|
|
|
|
|
flags, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
/* FASTPATH_INPUT_EVENT_MOUSE */
|
|
|
|
|
|
|
|
int APP_CC
|
|
|
|
|
|
|
|
xrdp_fastpath_process_EVENT_MOUSE(struct xrdp_fastpath *self, int eventFlags, struct stream *s)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int pointerFlags;
|
|
|
|
|
|
|
|
int xPos;
|
|
|
|
|
|
|
|
int yPos;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
in_uint16_le(s, pointerFlags); /* pointerFlags (2 bytes) */
|
|
|
|
|
|
|
|
in_uint16_le(s, xPos); /* xPos (2 bytes) */
|
|
|
|
|
|
|
|
in_uint16_le(s, yPos); /* yPos (2 bytes) */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (self->session->callback != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* msg_type can be
|
|
|
|
|
|
|
|
RDP_INPUT_SYNCHRONIZE - 0
|
|
|
|
|
|
|
|
RDP_INPUT_SCANCODE - 4
|
|
|
|
|
|
|
|
RDP_INPUT_MOUSE - 0x8001
|
|
|
|
|
|
|
|
RDP_INPUT_MOUSEX - 0x8002 */
|
|
|
|
|
|
|
|
/* call to xrdp_wm.c : callback */
|
|
|
|
|
|
|
|
self->session->callback(self->session->id, RDP_INPUT_MOUSE, xPos, yPos,
|
|
|
|
|
|
|
|
pointerFlags, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
/* FASTPATH_INPUT_EVENT_MOUSEX */
|
|
|
|
|
|
|
|
int APP_CC
|
|
|
|
|
|
|
|
xrdp_fastpath_process_EVENT_MOUSEX(struct xrdp_fastpath *self, int eventFlags, struct stream *s)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int pointerFlags;
|
|
|
|
|
|
|
|
int xPos;
|
|
|
|
|
|
|
|
int yPos;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
in_uint16_le(s, pointerFlags); /* pointerFlags (2 bytes) */
|
|
|
|
|
|
|
|
in_uint16_le(s, xPos); /* xPos (2 bytes) */
|
|
|
|
|
|
|
|
in_uint16_le(s, yPos); /* yPos (2 bytes) */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (self->session->callback != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* msg_type can be
|
|
|
|
|
|
|
|
RDP_INPUT_SYNCHRONIZE - 0
|
|
|
|
|
|
|
|
RDP_INPUT_SCANCODE - 4
|
|
|
|
|
|
|
|
RDP_INPUT_MOUSE - 0x8001
|
|
|
|
|
|
|
|
RDP_INPUT_MOUSEX - 0x8002 */
|
|
|
|
|
|
|
|
/* call to xrdp_wm.c : callback */
|
|
|
|
|
|
|
|
self->session->callback(self->session->id, RDP_INPUT_MOUSEX, xPos, yPos,
|
|
|
|
|
|
|
|
pointerFlags, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
/* FASTPATH_INPUT_EVENT_SYNC */
|
|
|
|
|
|
|
|
int APP_CC
|
|
|
|
|
|
|
|
xrdp_fastpath_process_EVENT_SYNC(struct xrdp_fastpath *self, int eventCode, int eventFlags, struct stream *s)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* The eventCode bitfield (3 bits in size) MUST be set to FASTPATH_INPUT_EVENT_SYNC (3).
|
|
|
|
|
|
|
|
* The eventFlags bitfield (5 bits in size) contains flags indicating the "on"
|
|
|
|
|
|
|
|
* status of the keyboard toggle keys.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (self->session->callback != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* msg_type can be
|
|
|
|
|
|
|
|
RDP_INPUT_SYNCHRONIZE - 0
|
|
|
|
|
|
|
|
RDP_INPUT_SCANCODE - 4
|
|
|
|
|
|
|
|
RDP_INPUT_MOUSE - 0x8001
|
|
|
|
|
|
|
|
RDP_INPUT_MOUSEX - 0x8002 */
|
|
|
|
|
|
|
|
/* call to xrdp_wm.c : callback */
|
|
|
|
|
|
|
|
self->session->callback(self->session->id, RDP_INPUT_SYNCHRONIZE, eventCode, 0,
|
|
|
|
|
|
|
|
eventFlags, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
/* FASTPATH_INPUT_EVENT_UNICODE */
|
|
|
|
|
|
|
|
int APP_CC
|
|
|
|
|
|
|
|
xrdp_fastpath_process_EVENT_UNICODE(struct xrdp_fastpath *self, int eventFlags, struct stream *s)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
in_uint8s(s, 2);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
/* FASTPATH_INPUT_EVENT */
|
|
|
|
|
|
|
|
int APP_CC
|
|
|
|
|
|
|
|
xrdp_fastpath_process_input_event(struct xrdp_fastpath *self, struct stream *s)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
int eventHeader;
|
|
|
|
|
|
|
|
int eventCode;
|
|
|
|
|
|
|
|
int eventFlags;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// process fastpath input events
|
|
|
|
|
|
|
|
for (i = 0 ; i < self->numEvents ; i++) {
|
|
|
|
|
|
|
|
in_uint8(s, eventHeader);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
eventFlags = (eventHeader & 0x1F);
|
|
|
|
|
|
|
|
eventCode = (eventHeader >> 5);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// g_writeln("eventCode= %d, eventFlags= %d, numEvents= %d",
|
|
|
|
|
|
|
|
// eventCode, eventFlags, self->sec_layer->fastpath_layer->numEvents);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (eventCode)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
case FASTPATH_INPUT_EVENT_SCANCODE:
|
|
|
|
|
|
|
|
if (xrdp_fastpath_process_EVENT_SCANCODE(self, eventFlags, s) != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case FASTPATH_INPUT_EVENT_MOUSE:
|
|
|
|
|
|
|
|
if (xrdp_fastpath_process_EVENT_MOUSE(self, eventFlags, s) != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FASTPATH_INPUT_EVENT_MOUSEX:
|
|
|
|
|
|
|
|
if (xrdp_fastpath_process_EVENT_MOUSEX(self, eventFlags, s) != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FASTPATH_INPUT_EVENT_SYNC:
|
|
|
|
|
|
|
|
if (xrdp_fastpath_process_EVENT_SYNC(self, eventCode, eventFlags, s) != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FASTPATH_INPUT_EVENT_UNICODE:
|
|
|
|
|
|
|
|
if (xrdp_fastpath_process_EVENT_UNICODE(self, eventFlags, s) != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
g_writeln("xrdp_rdp_process_fastpath_data_input: unknown eventCode %d", eventCode);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|