Merge pull request #111 from speidy/fastpath

libxrdp: Fastpath input
ulab-next
jsorg71 10 years ago
commit 1ce75182af

@ -116,7 +116,8 @@ struct stream
(v) = *((unsigned char*)((s)->p)); \
(s)->p++; \
} while (0)
/******************************************************************************/
#define in_uint8_peek(s, v) do { v = *s->p; } while (0)
/******************************************************************************/
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
#define in_sint16_le(s, v) do \

@ -161,6 +161,7 @@
#define RDP_INPUT_VIRTKEY 2
#define RDP_INPUT_SCANCODE 4
#define RDP_INPUT_MOUSE 0x8001
#define RDP_INPUT_MOUSEX 0x8002
/* Device flags */
#define KBD_FLAG_RIGHT 0x0001
@ -560,6 +561,24 @@
#define RDP_CAPSET_LPOINTER 0x27
#define RDP_CAPLEN_LPOINTER 0x06
/* fastpath input */
#define FASTPATH_INPUT_SECURE_CHECKSUM 0x1
#define FASTPATH_INPUT_ENCRYPTED 0x2
#define FASTPATH_INPUT_ACTION_FASTPATH 0x0
#define FASTPATH_INPUT_ACTION_X224 0x3
#define FASTPATH_INPUT_EVENT_SCANCODE 0x0
#define FASTPATH_INPUT_EVENT_MOUSE 0x1
#define FASTPATH_INPUT_EVENT_MOUSEX 0x2
#define FASTPATH_INPUT_EVENT_SYNC 0x3
#define FASTPATH_INPUT_EVENT_UNICODE 0x4
#define FASTPATH_INPUT_KBDFLAGS_RELEASE 0x01
#define FASTPATH_INPUT_KBDFLAGS_EXTENDED 0x02
/* fastpath output */
#define FASTPATH_OUTPUT_ACTION_FASTPATH 0x0
#define FASTPATH_OUTPUT_ACTION_X224 0x3

@ -59,7 +59,8 @@ libxrdp_la_SOURCES = \
xrdp_bitmap32_compress.c \
xrdp_jpeg_compress.c \
xrdp_orders_rail.c \
xrdp_mppc_enc.c
xrdp_mppc_enc.c \
xrdp_fastpath.c
libxrdp_la_LDFLAGS = \
$(EXTRA_FLAGS)

@ -29,6 +29,7 @@ libxrdp_init(tbus id, struct trans *trans)
session = (struct xrdp_session *)g_malloc(sizeof(struct xrdp_session), 1);
session->id = id;
session->trans = trans;
session->rdp = xrdp_rdp_create(session, trans);
session->orders = xrdp_orders_create(session, (struct xrdp_rdp *)session->rdp);
session->client_info = &(((struct xrdp_rdp *)session->rdp)->client_info);
@ -143,17 +144,23 @@ libxrdp_process_data(struct xrdp_session *session, struct stream *s)
xrdp_rdp_process_confirm_active(rdp, s);
break;
case RDP_PDU_DATA: /* 7 */
if (xrdp_rdp_process_data(rdp, s) != 0)
{
DEBUG(("libxrdp_process_data returned non zero"));
cont = 0;
term = 1;
}
break;
case 2: /* FASTPATH_INPUT_EVENT */
if (xrdp_fastpath_process_input_event(rdp->sec_layer->fastpath_layer, s) != 0)
{
DEBUG(("libxrdp_process_data returned non zero"));
cont = 0;
term = 1;
}
break;
default:
g_writeln("unknown in libxrdp_process_data");
g_writeln("unknown in libxrdp_process_data: code= %d", code);
dead_lock_counter++;
break;
}

@ -37,6 +37,7 @@
#include "file_loc.h"
#include "xrdp_client_info.h"
/* iso */
struct xrdp_iso
{
@ -66,6 +67,16 @@ struct xrdp_mcs
struct list* channel_list;
};
/* fastpath */
struct xrdp_fastpath
{
struct xrdp_sec* sec_layer; /* owner */
struct trans* trans;
struct xrdp_session* session;
int numEvents;
int secFlags;
};
/* Encryption Methods */
#define CRYPT_METHOD_NONE 0x00000000
#define CRYPT_METHOD_40BIT 0x00000001
@ -80,11 +91,13 @@ struct xrdp_mcs
#define CRYPT_LEVEL_HIGH 0x00000003
#define CRYPT_LEVEL_FIPS 0x00000004
/* sec */
struct xrdp_sec
{
struct xrdp_rdp* rdp_layer; /* owner */
struct xrdp_mcs* mcs_layer;
struct xrdp_fastpath* fastpath_layer;
struct xrdp_channel* chan_layer;
char server_random[32];
char client_random[64];
@ -303,6 +316,8 @@ int APP_CC
xrdp_iso_send(struct xrdp_iso* self, struct stream* s);
int APP_CC
xrdp_iso_incoming(struct xrdp_iso* self);
int APP_CC
xrdp_iso_detect_tpkt(struct xrdp_iso *self, struct stream *s);
/* xrdp_mcs.c */
struct xrdp_mcs* APP_CC
@ -528,4 +543,13 @@ int APP_CC
xrdp_channel_process(struct xrdp_channel* self, struct stream* s,
int chanid);
/* xrdp_fastpath.c */
struct xrdp_fastpath *APP_CC
xrdp_fastpath_create(struct xrdp_sec *owner, struct trans *trans);
void APP_CC
xrdp_fastpath_delete(struct xrdp_fastpath *self);
int APP_CC
xrdp_fastpath_recv(struct xrdp_fastpath *self, struct stream *s);
int APP_CC
xrdp_fastpath_process_input_event(struct xrdp_fastpath *self, struct stream *s);
#endif

@ -2,7 +2,7 @@
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Jay Sorg 2012-2013
* Copyright (C) Kevin Zhou 2012
* Copyright (C) Idan Freiberg 2013-2014
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -21,16 +21,16 @@
/*****************************************************************************/
struct xrdp_fastpath *APP_CC
xrdp_fastpath_create(struct xrdp_session *session)
xrdp_fastpath_create(struct xrdp_sec *owner, struct trans *trans)
{
struct xrdp_fastpath *self;
DEBUG((" in xrdp_fastpath_create"));
self = (struct xrdp_fastpath *)g_malloc(sizeof(struct xrdp_fastpath), 1);
self->tcp_layer =
((struct xrdp_rdp *)session->rdp)->sec_layer->
mcs_layer->iso_layer->tcp_layer;
make_stream(self->out_s);
init_stream(self->out_s, FASTPATH_MAX_PACKET_SIZE);
self->sec_layer = owner;
self->trans = trans;
self->session = owner->rdp_layer->session;
DEBUG((" out xrdp_fastpath_create"));
return self;
}
@ -42,8 +42,6 @@ xrdp_fastpath_delete(struct xrdp_fastpath *self)
{
return;
}
free_stream(self->out_s);
g_free(self);
}
@ -54,7 +52,46 @@ xrdp_fastpath_reset(struct xrdp_fastpath *self)
{
return 0;
}
/*****************************************************************************/
int APP_CC
xrdp_fastpath_recv(struct xrdp_fastpath *self, struct stream *s)
{
int fp_hdr;
int len = 0;
int byte;
int hdr_len = 2; /* fastpath header length - can be 2 or 3 bytes long, depends on length */
DEBUG((" in xrdp_fastpath_recv"));
in_uint8(s, fp_hdr); /* fpInputHeader (1 byte) */
g_writeln("xrdp_fastpath_recv: header= 0x%8.8x", fp_hdr);
self->numEvents = (fp_hdr & 0x3C) >> 2;
self->secFlags = (fp_hdr & 0xC0) >> 6;
// receive fastpath first length packet
in_uint8(s, byte); /* length 1 */
if (byte & 0x80)
{
byte &= ~(0x80);
len = (byte << 8);
// receive fastpath second length packet
in_uint8(s, byte); /* length 2 */
hdr_len++;
len += byte;
}
else
{
len = byte;
}
// g_writeln("len= %d , numEvents= %d, secFlags= %d, bytesleft: %d", len, self->numEvents, self->secFlags, (s->p - s->data));
DEBUG((" out xrdp_fastpath_recv"));
return 0;
}
/*****************************************************************************/
int APP_CC
xrdp_fastpath_init(struct xrdp_fastpath *self)
{
@ -76,7 +113,7 @@ xrdp_fastpath_send_update_pdu(struct xrdp_fastpath *self, tui8 updateCode,
int i32;
compression = 0;
s_send = self->out_s;
// s_send = self->out_s;
maxLen = FASTPATH_MAX_PACKET_SIZE - 6; /* 6 bytes for header */
payloadLeft = (s->end - s->data);
@ -112,13 +149,13 @@ xrdp_fastpath_send_update_pdu(struct xrdp_fastpath *self, tui8 updateCode,
((compression & 0x03) << 6);
out_uint8(s_send, i32);
out_uint16_le(s_send, len);
s_copy(s_send, s, len);
// s_copy(s_send, s, len);
s_mark_end(s_send);
if (xrdp_tcp_send(self->tcp_layer, s_send) != 0)
{
return 1;
}
// if (xrdp_tcp_send(self->tcp_layer, s_send) != 0)
// {
// return 1;
// }
}
return 0;
@ -169,12 +206,12 @@ xrdp_fastpath_process_data(struct xrdp_fastpath *self, struct stream *s,
encryptionFlags = (header & 0xc0) >> 6;
numberEvents = (header & 0x3c) >> 2;
xrdp_tcp_recv(self->tcp_layer, s, 1);
// xrdp_tcp_recv(self->tcp_layer, s, 1);
in_uint8(s, length);
if (length & 0x80)
{
xrdp_tcp_recv(self->tcp_layer, s, 1);
// xrdp_tcp_recv(self->tcp_layer, s, 1);
in_uint8(s, length2);
length = (length & 0x7f) << 8 + length2 - 3;
}
@ -183,7 +220,7 @@ xrdp_fastpath_process_data(struct xrdp_fastpath *self, struct stream *s,
length -= 2;
}
xrdp_tcp_recv(self->tcp_layer, s, length);
// xrdp_tcp_recv(self->tcp_layer, s, length);
if (encryptionFlags != 0)
{
@ -207,3 +244,183 @@ xrdp_fastpath_process_data(struct xrdp_fastpath *self, struct stream *s,
in_uint16_le(s, size);
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;
}

@ -122,14 +122,13 @@ xrdp_mcs_recv(struct xrdp_mcs *self, struct stream *s, int *chan)
int len;
int userid;
int chanid;
DEBUG((" in xrdp_mcs_recv"));
while (1)
{
if (xrdp_iso_recv(self->iso_layer, s) != 0)
{
DEBUG((" out xrdp_mcs_recv xrdp_iso_recv returned non zero"));
DEBUG((" out xrdp_mcs_recv, xrdp_iso_recv return non zero"));
return 1;
}

@ -123,6 +123,31 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info)
{
client_info->require_credentials = g_text2bool(value);
}
else if (g_strcasecmp(item, "use_fastpath") == 0)
{
if (g_strcasecmp(value, "output") == 0)
{
client_info->use_fast_path = 1;
}
else if (g_strcasecmp(value, "input") == 0)
{
client_info->use_fast_path = 2;
}
else if (g_strcasecmp(value, "both") == 0)
{
client_info->use_fast_path = 3;
}
else if (g_strcasecmp(value, "none") == 0)
{
client_info->use_fast_path = 0;
}
else
{
log_message(LOG_LEVEL_ALWAYS,"Warning: Your configured fastpath level is"
"undefined, fastpath will not be used");
client_info->use_fast_path = 0;
}
}
}
list_delete(items);
@ -264,9 +289,8 @@ xrdp_rdp_init_data(struct xrdp_rdp *self, struct stream *s)
s_push_layer(s, rdp_hdr, 18);
return 0;
}
/*****************************************************************************/
/* returns erros */
/* returns error */
int APP_CC
xrdp_rdp_recv(struct xrdp_rdp *self, struct stream *s, int *code)
{
@ -274,11 +298,25 @@ xrdp_rdp_recv(struct xrdp_rdp *self, struct stream *s, int *code)
int len = 0;
int pdu_code = 0;
int chan = 0;
const tui8 *header;
header = (const tui8 *) (self->session->trans->in_s->p);
DEBUG(("in xrdp_rdp_recv"));
if (s->next_packet == 0 || s->next_packet >= s->end)
{
/* check for fastpath first */
if ((header[0] != 0x3) && (header[0] != 0x3c))
{
if (xrdp_sec_recv_fastpath(self->sec_layer, s) != 0)
{
return 1;
}
*code = 2; // special code for fastpath input
DEBUG(("out (fastpath) xrdp_rdp_recv"));
return 0;
}
/* not fastpath, do tpkt */
chan = 0;
error = xrdp_sec_recv(self->sec_layer, s, &chan);
@ -348,7 +386,6 @@ xrdp_rdp_recv(struct xrdp_rdp *self, struct stream *s, int *code)
return 0;
}
}
/*****************************************************************************/
int APP_CC
xrdp_rdp_send(struct xrdp_rdp *self, struct stream *s, int pdu_type)
@ -1694,7 +1731,6 @@ xrdp_rdp_process_data(struct xrdp_rdp *self, struct stream *s)
return 0;
}
/*****************************************************************************/
int APP_CC
xrdp_rdp_disconnect(struct xrdp_rdp *self)

@ -271,6 +271,7 @@ xrdp_sec_create(struct xrdp_rdp *owner, struct trans *trans, int crypt_level,
self->encrypt_rc4_info = ssl_rc4_info_create();
self->mcs_layer = xrdp_mcs_create(self, trans, &self->client_mcs_data,
&self->server_mcs_data);
self->fastpath_layer = xrdp_fastpath_create(self, trans);
self->chan_layer = xrdp_channel_create(self, self->mcs_layer);
DEBUG((" out xrdp_sec_create"));
return self;
@ -288,6 +289,7 @@ xrdp_sec_delete(struct xrdp_sec *self)
xrdp_channel_delete(self->chan_layer);
xrdp_mcs_delete(self->mcs_layer);
xrdp_fastpath_delete(self->fastpath_layer);
ssl_rc4_info_delete(self->decrypt_rc4_info); /* TODO clear all data */
ssl_rc4_info_delete(self->encrypt_rc4_info); /* TODO clear all data */
ssl_des3_info_delete(self->decrypt_fips_info);
@ -948,7 +950,37 @@ xrdp_sec_establish_keys(struct xrdp_sec *self)
ssl_rc4_set_key(self->decrypt_rc4_info, self->decrypt_key, self->rc4_key_len);
ssl_rc4_set_key(self->encrypt_rc4_info, self->encrypt_key, self->rc4_key_len);
}
/*****************************************************************************/
/* returns error */
int APP_CC
xrdp_sec_recv_fastpath(struct xrdp_sec *self, struct stream *s)
{
if (xrdp_fastpath_recv(self->fastpath_layer, s) != 0) {
return 1;
}
if (self->crypt_level == CRYPT_LEVEL_FIPS)
{
in_uint8s(s, 4); /* fipsInformation (4 bytes) */
}
in_uint8s(s, 8); /* dataSignature (8 bytes), skip for now */
if (self->fastpath_layer->secFlags & FASTPATH_INPUT_ENCRYPTED)
{
xrdp_sec_decrypt(self, s->p, (int)(s->end - s->p));
}
if (self->fastpath_layer->numEvents == 0) {
/**
* If numberEvents is not provided in fpInputHeader, it will be provided
* as one additional byte here.
*/
in_uint8(s, self->fastpath_layer->numEvents); /* numEvents (1 byte) (optional) */
}
return 0;
}
/*****************************************************************************/
/* returns error */
int APP_CC
@ -963,7 +995,7 @@ xrdp_sec_recv(struct xrdp_sec *self, struct stream *s, int *chan)
if (xrdp_mcs_recv(self->mcs_layer, s, chan) != 0)
{
DEBUG((" out xrdp_sec_recv error"));
DEBUG((" out xrdp_sec_recv : error"));
return 1;
}
@ -1181,7 +1213,6 @@ xrdp_sec_send(struct xrdp_sec *self, struct stream *s, int chan)
DEBUG((" out xrdp_sec_send"));
return 0;
}
/*****************************************************************************/
/* http://msdn.microsoft.com/en-us/library/cc240510.aspx
2.2.1.3.2 Client Core Data (TS_UD_CS_CORE) */

@ -27,7 +27,7 @@
#ifdef XRDP_DEBUG
#define LOG_LEVEL 99
#else
#define LOG_LEVEL 10
#define LOG_LEVEL 11
#endif
#define LLOG(_level, _args) \
@ -256,11 +256,13 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
case 107: /* wheel up */
flags = PTR_FLAGS_WHEEL | 0x0078;
mod->inst->input->MouseEvent(mod->inst->input, flags, 0, 0);
break;
case 108:
break;
case 109: /* wheel down */
flags = PTR_FLAGS_WHEEL | PTR_FLAGS_WHEEL_NEGATIVE | 0x0088;
mod->inst->input->MouseEvent(mod->inst->input, flags, 0, 0);
break;
case 110:
break;
case 200:
@ -277,8 +279,9 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
size = (int)param2;
data = (char *)param3;
total_size = (int)param4;
LLOGLN(12, ("lxrdp_event: client to server flags %d", flags));
LLOGLN(10, ("lxrdp_event: client to server ,chanid= %d flags= %d", chanid, flags));
g_hexdump(data, size); // for debugging
if ((chanid < 0) || (chanid >= mod->inst->settings->num_channels))
{
LLOGLN(0, ("lxrdp_event: error chanid %d", chanid));
@ -472,7 +475,7 @@ lfreerdp_begin_paint(rdpContext *context)
{
struct mod *mod;
LLOGLN(10, ("lfreerdp_begin_paint:"));
LLOGLN(12, ("lfreerdp_begin_paint:"));
mod = ((struct mod_context *)context)->modi;
mod->server_begin_update(mod);
}
@ -483,7 +486,7 @@ lfreerdp_end_paint(rdpContext *context)
{
struct mod *mod;
LLOGLN(10, ("lfreerdp_end_paint:"));
LLOGLN(12, ("lfreerdp_end_paint:"));
mod = ((struct mod_context *)context)->modi;
mod->server_end_update(mod);
}
@ -498,7 +501,7 @@ lfreerdp_set_bounds(rdpContext *context, rdpBounds *bounds)
int cx;
int cy;
LLOGLN(10, ("lfreerdp_set_bounds: %p", bounds));
LLOGLN(12, ("lfreerdp_set_bounds: %p", bounds));
mod = ((struct mod_context *)context)->modi;
if (bounds != 0)
@ -715,7 +718,7 @@ lfreerdp_mem_blt(rdpContext *context, MEMBLT_ORDER *memblt)
struct bitmap_item *bi;
mod = ((struct mod_context *)context)->modi;
LLOGLN(10, ("lfreerdp_mem_blt: cacheId %d cacheIndex %d",
LLOGLN(12, ("lfreerdp_mem_blt: cacheId %d cacheIndex %d",
memblt->cacheId, memblt->cacheIndex));
id = memblt->cacheId;
@ -1334,7 +1337,7 @@ static void DEFAULT_CC lfreerdp_syncronize(rdpContext* context)
{
struct mod *mod;
mod = ((struct mod_context *)context)->modi;
LLOGLN(0, ("lfreerdp_synchronize received - not handled"));
LLOGLN(12, ("lfreerdp_synchronize received - not handled"));
}
/******************************************************************************/
@ -1359,8 +1362,8 @@ lfreerdp_pre_connect(freerdp *instance)
while (error == 0)
{
num_chans++;
LLOGLN(10, ("lfreerdp_pre_connect: got channel [%s], flags [0x%8.8x]",
ch_name, ch_flags));
LLOGLN(10, ("lfreerdp_pre_connect: got channel [%s], id [%d], flags [0x%8.8x]",
ch_name, index, ch_flags));
dst_ch_name = instance->settings->channels[index].name;
g_memset(dst_ch_name, 0, 8);
g_snprintf(dst_ch_name, 8, "%s", ch_name);
@ -1389,24 +1392,25 @@ lfreerdp_pre_connect(freerdp *instance)
instance->settings->order_support[NEG_MEM3BLT_INDEX] = 0;
instance->settings->order_support[NEG_MEM3BLT_V2_INDEX] = 0;
instance->settings->bitmapCacheV2NumCells = 3; // 5;
instance->settings->bitmapCacheV2CellInfo[0].numEntries = 0x78; // 600;
instance->settings->bitmapCacheV2CellInfo[0].numEntries = 600; // 0x78;
instance->settings->bitmapCacheV2CellInfo[0].persistent = 0;
instance->settings->bitmapCacheV2CellInfo[1].numEntries = 0x78; // 600;
instance->settings->bitmapCacheV2CellInfo[1].numEntries = 600; //0x78; // 600;
instance->settings->bitmapCacheV2CellInfo[1].persistent = 0;
instance->settings->bitmapCacheV2CellInfo[2].numEntries = 0x150; // 2048;
instance->settings->bitmapCacheV2CellInfo[2].numEntries = 2048; //0x150; // 2048;
instance->settings->bitmapCacheV2CellInfo[2].persistent = 0;
instance->settings->bitmapCacheV2CellInfo[3].numEntries = 0; // 4096;
instance->settings->bitmapCacheV2CellInfo[3].numEntries = 4096; // 4096;
instance->settings->bitmapCacheV2CellInfo[3].persistent = 0;
instance->settings->bitmapCacheV2CellInfo[4].numEntries = 0; // 2048;
instance->settings->bitmapCacheV2CellInfo[4].numEntries = 2048; // 2048;
instance->settings->bitmapCacheV2CellInfo[4].persistent = 0;
// instance->settings->BitmapCacheV3Enabled = FALSE;
instance->settings->bitmap_cache_v3 = 1;
instance->settings->order_support[NEG_MULTIDSTBLT_INDEX] = 0;
instance->settings->order_support[NEG_MULTIPATBLT_INDEX] = 0;
instance->settings->order_support[NEG_MULTISCRBLT_INDEX] = 0;
instance->settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = 0;
instance->settings->order_support[NEG_POLYLINE_INDEX] = 0;
instance->settings->username = g_strdup(mod->username);
instance->settings->password = g_strdup(mod->password);
@ -1417,6 +1421,10 @@ lfreerdp_pre_connect(freerdp *instance)
instance->settings->rail_langbar_supported = 1;
instance->settings->workarea = 1;
instance->settings->performance_flags = PERF_DISABLE_WALLPAPER | PERF_DISABLE_FULLWINDOWDRAG;
instance->settings->num_icon_caches = mod->client_info.wnd_num_icon_caches;
instance->settings->num_icon_cache_entries = mod->client_info.wnd_num_icon_cache_entries;
}
else
{
@ -1429,8 +1437,16 @@ lfreerdp_pre_connect(freerdp *instance)
instance->settings->compression = 0;
instance->settings->ignore_certificate = 1;
// here
//instance->settings->RdpVersion = 4;
// Multi Monitor Settings
instance->settings->num_monitors = mod->client_info.monitorCount;
for (index = 0; index < mod->client_info.monitorCount; index++)
{
instance->settings->monitors[index].x = mod->client_info.minfo[index].left;
instance->settings->monitors[index].y = mod->client_info.minfo[index].top;
instance->settings->monitors[index].width = mod->client_info.minfo[index].right;
instance->settings->monitors[index].height = mod->client_info.minfo[index].bottom;
instance->settings->monitors[index].is_primary = mod->client_info.minfo[index].is_primary;
}
instance->update->BeginPaint = lfreerdp_begin_paint;
instance->update->EndPaint = lfreerdp_end_paint;
@ -1457,6 +1473,7 @@ lfreerdp_pre_connect(freerdp *instance)
instance->update->pointer->PointerNew = lfreerdp_pointer_new;
instance->update->pointer->PointerCached = lfreerdp_pointer_cached;
if ((mod->username[0] != 0) && (mod->password[0] != 0))
{
/* since we have username and password, we can try nla */
@ -1629,21 +1646,21 @@ lrail_NotifyIconCreate(rdpContext *context, WINDOW_ORDER_INFO *orderInfo,
rnso.version = notify_icon_state->version;
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_TIP)
{
rnso.tool_tip = freerdp_uniconv_in(uniconv,
notify_icon_state->toolTip.string, notify_icon_state->toolTip.length);
}
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_INFO_TIP)
{
rnso.infotip.timeout = notify_icon_state->infoTip.timeout;
rnso.infotip.flags = notify_icon_state->infoTip.flags;
rnso.infotip.text = freerdp_uniconv_in(uniconv,
notify_icon_state->infoTip.text.string,
notify_icon_state->infoTip.text.length);
rnso.infotip.title = freerdp_uniconv_in(uniconv,
notify_icon_state->infoTip.title.string,
notify_icon_state->infoTip.title.length);
}
{
rnso.tool_tip = freerdp_uniconv_in(uniconv,
notify_icon_state->toolTip.string, notify_icon_state->toolTip.length);
}
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_INFO_TIP)
{
rnso.infotip.timeout = notify_icon_state->infoTip.timeout;
rnso.infotip.flags = notify_icon_state->infoTip.flags;
rnso.infotip.text = freerdp_uniconv_in(uniconv,
notify_icon_state->infoTip.text.string,
notify_icon_state->infoTip.text.length);
rnso.infotip.title = freerdp_uniconv_in(uniconv,
notify_icon_state->infoTip.title.string,
notify_icon_state->infoTip.title.length);
}
rnso.state = notify_icon_state->state;
rnso.icon_cache_entry = notify_icon_state->icon.cacheEntry;
@ -1744,6 +1761,7 @@ lfreerdp_post_connect(freerdp *instance)
mod = ((struct mod_context *)(instance->context))->modi;
g_memset(mod->password, 0, sizeof(mod->password));
mod->inst->update->window->WindowCreate = lrail_WindowCreate;
mod->inst->update->window->WindowUpdate = lrail_WindowUpdate;
mod->inst->update->window->WindowDelete = lrail_WindowDelete;
@ -1755,6 +1773,7 @@ lfreerdp_post_connect(freerdp *instance)
mod->inst->update->window->MonitoredDesktop = lrail_MonitoredDesktop;
mod->inst->update->window->NonMonitoredDesktop = lrail_NonMonitoredDesktop;
return 1;
}
@ -1796,7 +1815,8 @@ lfreerdp_receive_channel_data(freerdp *instance, int channelId, uint8 *data,
if (lchid >= 0)
{
LLOGLN(10, ("lfreerdp_receive_channel_data: server to client"));
LLOGLN(10, ("lfreerdp_receive_channel_data: server to client, chanid: %d", lchid));
g_hexdump(data, size); // for debugging
error = mod->server_send_to_channel(mod, lchid, (char *)data, size,
total_size, flags);

@ -1,4 +1,3 @@
[globals]
# xrdp.ini file version number
ini_version=1
@ -50,6 +49,8 @@ grey=dedede
#nego_sec_layer=0
allow_multimon=true
# fastpath - can be set to input / output / both / none
use_fastpath=input
#
# configure login screen
#

@ -123,6 +123,7 @@ xrdp_process_get_pdu_bytes(const char *aheader)
rv = -1;
header = (const tui8 *) aheader;
if (header[0] == 0x03)
{
/* TPKT */

Loading…
Cancel
Save