Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Philippe Auphelle 2012-01-14 16:35:33 +01:00
commit 49796d385f
13 changed files with 271 additions and 166 deletions

View File

@ -421,7 +421,7 @@ void xf_gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
} }
} }
gdi_InvalidateRegion(xfi->hdc, scrblt->nXSrc, scrblt->nYSrc, scrblt->nWidth, scrblt->nHeight); gdi_InvalidateRegion(xfi->hdc, scrblt->nLeftRect, scrblt->nTopRect, scrblt->nWidth, scrblt->nHeight);
} }
XSetFunction(xfi->display, xfi->gc, GXcopy); XSetFunction(xfi->display, xfi->gc, GXcopy);
@ -504,13 +504,14 @@ void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
line_to->nXStart, line_to->nYStart, line_to->nXEnd, line_to->nYEnd); line_to->nXStart, line_to->nYStart, line_to->nXEnd, line_to->nYEnd);
if (xfi->drawing == xfi->primary) if (xfi->drawing == xfi->primary)
{
if (xfi->remote_app != true)
{ {
int width, height; int width, height;
if (xfi->remote_app != true)
{
XDrawLine(xfi->display, xfi->drawable, xfi->gc, XDrawLine(xfi->display, xfi->drawable, xfi->gc,
line_to->nXStart, line_to->nYStart, line_to->nXEnd, line_to->nYEnd); line_to->nXStart, line_to->nYStart, line_to->nXEnd, line_to->nYEnd);
}
width = line_to->nXStart - line_to->nXEnd; width = line_to->nXStart - line_to->nXEnd;
height = line_to->nYStart - line_to->nYEnd; height = line_to->nYStart - line_to->nYEnd;
@ -522,7 +523,7 @@ void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
height *= (-1); height *= (-1);
gdi_InvalidateRegion(xfi->hdc, line_to->nXStart, line_to->nYStart, width, height); gdi_InvalidateRegion(xfi->hdc, line_to->nXStart, line_to->nYStart, width, height);
}
} }
XSetFunction(xfi->display, xfi->gc, GXcopy); XSetFunction(xfi->display, xfi->gc, GXcopy);

View File

@ -57,6 +57,13 @@ void xf_rail_paint(xfInfo* xfi, rdpRail* rail, sint32 uleft, sint32 utop, uint32
window = window_list_get_next(rail->list); window = window_list_get_next(rail->list);
xfw = (xfWindow*) window->extra; xfw = (xfWindow*) window->extra;
// RDP can have zero width or height windows. X cannot, so we ignore these.
if (window->windowWidth == 0 || window->windowHeight == 0)
{
continue;
}
wleft = window->windowOffsetX; wleft = window->windowOffsetX;
wtop = window->windowOffsetY; wtop = window->windowOffsetY;
wright = window->windowOffsetX + window->windowWidth - 1; wright = window->windowOffsetX + window->windowWidth - 1;
@ -333,6 +340,15 @@ void xf_rail_end_local_move(xfInfo* xfi, rdpWindow *window)
y = xfw->top + xfw->local_move.window_y; y = xfw->top + xfw->local_move.window_y;
input->MouseEvent(input, PTR_FLAGS_BUTTON1, x, y); input->MouseEvent(input, PTR_FLAGS_BUTTON1, x, y);
// Proactively update the RAIL window dimensions. There is a race condition where
// we can start to receive GDI orders for the new window dimensions before we
// receive the RAIL ORDER for the new window size. This avoids that race condition.
window->windowOffsetX = xfw->left;
window->windowOffsetY = xfw->top;
window->windowWidth = xfw->width;
window->windowHeight = xfw->height;
xfw->local_move.state = LMS_TERMINATING; xfw->local_move.state = LMS_TERMINATING;
} }

View File

@ -293,17 +293,16 @@ void xf_create_window(xfInfo* xfi)
if (xfi->instance->settings->window_title != NULL) if (xfi->instance->settings->window_title != NULL)
{ {
win_title = xmalloc(sizeof(xfi->instance->settings->window_title)); win_title = xstrdup(xfi->instance->settings->window_title);
sprintf(win_title, "%s", xfi->instance->settings->window_title);
} }
else if (xfi->instance->settings->port == 3389) else if (xfi->instance->settings->port == 3389)
{ {
win_title = xmalloc(sizeof("FreeRDP: ") + strlen(xfi->instance->settings->hostname)); win_title = xmalloc(1 + sizeof("FreeRDP: ") + strlen(xfi->instance->settings->hostname));
sprintf(win_title, "FreeRDP: %s", xfi->instance->settings->hostname); sprintf(win_title, "FreeRDP: %s", xfi->instance->settings->hostname);
} }
else else
{ {
win_title = xmalloc(sizeof("FreeRDP: ") + strlen(xfi->instance->settings->hostname) + sizeof(":00000")); win_title = xmalloc(1 + sizeof("FreeRDP: ") + strlen(xfi->instance->settings->hostname) + sizeof(":00000"));
sprintf(win_title, "FreeRDP: %s:%i", xfi->instance->settings->hostname, xfi->instance->settings->port); sprintf(win_title, "FreeRDP: %s:%i", xfi->instance->settings->hostname, xfi->instance->settings->port);
} }

View File

@ -46,14 +46,13 @@ int add_license_suite(void)
add_test_suite(license); add_test_suite(license);
add_test_function(license); add_test_function(license);
add_test_function(license_generate_keys); //add_test_function(license_generate_keys);
add_test_function(license_encrypt_premaster_secret); //add_test_function(license_encrypt_premaster_secret);
add_test_function(license_decrypt_platform_challenge); add_test_function(license_decrypt_platform_challenge);
return 0; return 0;
} }
/* Server License Request (2200 bytes) */ /* Server License Request (2200 bytes) */
uint8 server_license_request[2200] = uint8 server_license_request[2200] =
@ -314,10 +313,9 @@ uint8 platform_challenge[10] = "\x54\x00\x45\x00\x53\x00\x54\x00\x00\x00";
void test_license(void) void test_license(void)
{ {
STREAM* s; STREAM _s, *s;
s = stream_new(0);
s = &_s;
memcpy(license->client_random, client_random, sizeof(client_random)); memcpy(license->client_random, client_random, sizeof(client_random));
memcpy(license->premaster_secret, premaster_secret, sizeof(premaster_secret)); memcpy(license->premaster_secret, premaster_secret, sizeof(premaster_secret));
@ -421,9 +419,9 @@ uint8 test_encrypted_premaster_secret[64] =
void test_license_generate_keys(void) void test_license_generate_keys(void)
{ {
STREAM* s; STREAM _s, *s;
s = stream_new(0);
s = &_s;
memcpy(license->client_random, client_random, sizeof(client_random)); memcpy(license->client_random, client_random, sizeof(client_random));
memcpy(license->server_random, test_server_random, sizeof(test_server_random)); memcpy(license->server_random, test_server_random, sizeof(test_server_random));
memcpy(license->premaster_secret, premaster_secret, sizeof(premaster_secret)); memcpy(license->premaster_secret, premaster_secret, sizeof(premaster_secret));
@ -457,9 +455,9 @@ void test_license_generate_keys(void)
void test_license_encrypt_premaster_secret(void) void test_license_encrypt_premaster_secret(void)
{ {
STREAM* s; STREAM _s, *s;
s = stream_new(0);
s = &_s;
memcpy(license->premaster_secret, premaster_secret, sizeof(premaster_secret)); memcpy(license->premaster_secret, premaster_secret, sizeof(premaster_secret));
memcpy(license->certificate->cert_info.exponent, test_exponent, sizeof(test_exponent)); memcpy(license->certificate->cert_info.exponent, test_exponent, sizeof(test_exponent));
memcpy(license->certificate->cert_info.modulus.data, test_modulus, sizeof(test_modulus)); memcpy(license->certificate->cert_info.modulus.data, test_modulus, sizeof(test_modulus));
@ -478,9 +476,9 @@ uint8 test_platform_challenge[10] =
void test_license_decrypt_platform_challenge(void) void test_license_decrypt_platform_challenge(void)
{ {
STREAM* s; STREAM _s, *s;
s = stream_new(0);
s = &_s;
memcpy(license->licensing_encryption_key, test_licensing_encryption_key, memcpy(license->licensing_encryption_key, test_licensing_encryption_key,
sizeof(test_licensing_encryption_key)); sizeof(test_licensing_encryption_key));
@ -496,5 +494,6 @@ void test_license_decrypt_platform_challenge(void)
s->data = license->platform_challenge->data; s->data = license->platform_challenge->data;
s->p = s->data + sizeof(test_platform_challenge); s->p = s->data + sizeof(test_platform_challenge);
ASSERT_STREAM(s, test_platform_challenge, sizeof(test_platform_challenge)); ASSERT_STREAM(s, test_platform_challenge, sizeof(test_platform_challenge));
} }

View File

@ -98,11 +98,11 @@ void test_mcs_write_connect_initial(void)
{ {
STREAM* s; STREAM* s;
rdpMcs* mcs; rdpMcs* mcs;
STREAM* user_data; STREAM _user_data, *user_data;
mcs = mcs_new((rdpTransport*) NULL); mcs = mcs_new((rdpTransport*) NULL);
user_data = stream_new(0); user_data = &_user_data;
user_data->data = gcc_CCrq; user_data->data = gcc_CCrq;
user_data->p = user_data->data + sizeof(gcc_CCrq); user_data->p = user_data->data + sizeof(gcc_CCrq);
@ -110,4 +110,6 @@ void test_mcs_write_connect_initial(void)
mcs_write_connect_initial(s, mcs, user_data); mcs_write_connect_initial(s, mcs, user_data);
ASSERT_STREAM(s, (uint8*) mcs_connect_initial_expected, sizeof(mcs_connect_initial_expected)); ASSERT_STREAM(s, (uint8*) mcs_connect_initial_expected, sizeof(mcs_connect_initial_expected));
stream_free(s);
} }

View File

@ -645,7 +645,7 @@ void test_mppc(void)
struct timeval end_time; struct timeval end_time;
rdp.mppc = &rmppc; rdp.mppc = &rmppc;
rdp.mppc->history_buf = calloc(1, RDP5_HISTORY_BUF_SIZE); rdp.mppc->history_buf = calloc(1, RDP6_HISTORY_BUF_SIZE);
CU_ASSERT(rdp.mppc->history_buf != NULL) CU_ASSERT(rdp.mppc->history_buf != NULL)
rdp.mppc->history_ptr = rdp.mppc->history_buf; rdp.mppc->history_ptr = rdp.mppc->history_buf;
@ -665,6 +665,6 @@ void test_mppc(void)
/* print time taken */ /* print time taken */
dur = ((end_time.tv_sec - start_time.tv_sec) * 1000000) + (end_time.tv_usec - start_time.tv_usec); dur = ((end_time.tv_sec - start_time.tv_sec) * 1000000) + (end_time.tv_usec - start_time.tv_usec);
printf("test_mppc: decompressed data in %ld micro seconds\n", dur); //printf("test_mppc: decompressed data in %ld micro seconds\n", dur);
} }

View File

@ -29,7 +29,7 @@ ORDER_INFO* orderInfo;
int init_orders_suite(void) int init_orders_suite(void)
{ {
orderInfo = (ORDER_INFO*) malloc(sizeof(orderInfo)); orderInfo = (ORDER_INFO*) malloc(sizeof(ORDER_INFO));
return 0; return 0;
} }
@ -73,10 +73,10 @@ uint8 dstblt_order[] = "\x48\x00\x37\x01";
void test_read_dstblt_order(void) void test_read_dstblt_order(void)
{ {
STREAM* s; STREAM _s, *s;
DSTBLT_ORDER dstblt; DSTBLT_ORDER dstblt;
s = stream_new(0); s = &_s;
s->p = s->data = dstblt_order; s->p = s->data = dstblt_order;
memset(orderInfo, 0, sizeof(ORDER_INFO)); memset(orderInfo, 0, sizeof(ORDER_INFO));
@ -98,10 +98,10 @@ uint8 patblt_order[] = "\x1a\x00\xc3\x01\x0d\x00\x0d\x00\xf0\xff\xff\x00\x5b\xef
void test_read_patblt_order(void) void test_read_patblt_order(void)
{ {
STREAM* s; STREAM _s, *s;
PATBLT_ORDER patblt; PATBLT_ORDER patblt;
s = stream_new(0); s = &_s;
s->p = s->data = patblt_order; s->p = s->data = patblt_order;
memset(orderInfo, 0, sizeof(ORDER_INFO)); memset(orderInfo, 0, sizeof(ORDER_INFO));
@ -128,10 +128,10 @@ uint8 scrblt_order[] = "\x07\x00\xa1\x01\xf1\x00\xcc\x2f\x01\x8e\x00";
void test_read_scrblt_order(void) void test_read_scrblt_order(void)
{ {
STREAM* s; STREAM _s, *s;
SCRBLT_ORDER scrblt; SCRBLT_ORDER scrblt;
s = stream_new(0); s = &_s;
s->p = s->data = scrblt_order; s->p = s->data = scrblt_order;
memset(orderInfo, 0, sizeof(ORDER_INFO)); memset(orderInfo, 0, sizeof(ORDER_INFO));
@ -155,10 +155,10 @@ uint8 opaque_rect_order[] = "\x00\x04\x00\x03\x73\x02\x06";
void test_read_opaque_rect_order(void) void test_read_opaque_rect_order(void)
{ {
STREAM* s; STREAM _s, *s;
OPAQUE_RECT_ORDER opaque_rect; OPAQUE_RECT_ORDER opaque_rect;
s = stream_new(0); s = &_s;
s->p = s->data = opaque_rect_order; s->p = s->data = opaque_rect_order;
memset(orderInfo, 0, sizeof(ORDER_INFO)); memset(orderInfo, 0, sizeof(ORDER_INFO));
@ -180,10 +180,10 @@ uint8 draw_nine_grid_order[] = "\xfb\xf9\x0d\x00";
void test_read_draw_nine_grid_order(void) void test_read_draw_nine_grid_order(void)
{ {
STREAM* s; STREAM _s, *s;
DRAW_NINE_GRID_ORDER draw_nine_grid; DRAW_NINE_GRID_ORDER draw_nine_grid;
s = stream_new(0); s = &_s;
s->p = s->data = draw_nine_grid_order; s->p = s->data = draw_nine_grid_order;
memset(orderInfo, 0, sizeof(ORDER_INFO)); memset(orderInfo, 0, sizeof(ORDER_INFO));
@ -213,10 +213,10 @@ uint8 multi_opaque_rect_order[] =
void test_read_multi_opaque_rect_order(void) void test_read_multi_opaque_rect_order(void)
{ {
STREAM* s; STREAM _s, *s;
MULTI_OPAQUE_RECT_ORDER multi_opaque_rect; MULTI_OPAQUE_RECT_ORDER multi_opaque_rect;
s = stream_new(0); s = &_s;
s->p = s->data = multi_opaque_rect_order; s->p = s->data = multi_opaque_rect_order;
memset(orderInfo, 0, sizeof(ORDER_INFO)); memset(orderInfo, 0, sizeof(ORDER_INFO));
@ -260,10 +260,10 @@ uint8 line_to_order[] = "\x03\xb1\x0e\xa6\x5b\xef\x00";
void test_read_line_to_order(void) void test_read_line_to_order(void)
{ {
STREAM* s; STREAM _s, *s;
LINE_TO_ORDER line_to; LINE_TO_ORDER line_to;
s = stream_new(0); s = &_s;
s->p = s->data = line_to_order; s->p = s->data = line_to_order;
memset(orderInfo, 0, sizeof(ORDER_INFO)); memset(orderInfo, 0, sizeof(ORDER_INFO));
@ -303,10 +303,10 @@ uint8 polyline_order[] =
void test_read_polyline_order(void) void test_read_polyline_order(void)
{ {
STREAM* s; STREAM _s, *s;
POLYLINE_ORDER polyline; POLYLINE_ORDER polyline;
s = stream_new(0); s = &_s;
s->p = s->data = polyline_order; s->p = s->data = polyline_order;
memset(orderInfo, 0, sizeof(ORDER_INFO)); memset(orderInfo, 0, sizeof(ORDER_INFO));
@ -323,70 +323,39 @@ void test_read_polyline_order(void)
CU_ASSERT(polyline.numPoints == 32); CU_ASSERT(polyline.numPoints == 32);
CU_ASSERT(polyline.cbData == 108); CU_ASSERT(polyline.cbData == 108);
CU_ASSERT(polyline.points[1].x == 374); CU_ASSERT(polyline.points[0].x == -130);
CU_ASSERT(polyline.points[1].y == 686); CU_ASSERT(polyline.points[1].x == -191);
CU_ASSERT(polyline.points[2].x == 183); CU_ASSERT(polyline.points[2].x == -220);
CU_ASSERT(polyline.points[2].y == 666); CU_ASSERT(polyline.points[3].x == -213);
CU_ASSERT(polyline.points[3].x == -37); CU_ASSERT(polyline.points[4].x == -171);
CU_ASSERT(polyline.points[3].y == 636); CU_ASSERT(polyline.points[5].x == -100);
CU_ASSERT(polyline.points[4].x == -250); CU_ASSERT(polyline.points[6].x == -13);
CU_ASSERT(polyline.points[4].y == 597); CU_ASSERT(polyline.points[7].x == 77);
CU_ASSERT(polyline.points[5].x == -421); CU_ASSERT(polyline.points[8].x == 153);
CU_ASSERT(polyline.points[5].y == 550); CU_ASSERT(polyline.points[9].x == 205);
CU_ASSERT(polyline.points[6].x == -521); CU_ASSERT(polyline.points[10].x == 222);
CU_ASSERT(polyline.points[6].y == 495); CU_ASSERT(polyline.points[11].x == 202);
CU_ASSERT(polyline.points[7].x == -534); CU_ASSERT(polyline.points[12].x == 150);
CU_ASSERT(polyline.points[7].y == 434); CU_ASSERT(polyline.points[13].x == 72);
CU_ASSERT(polyline.points[8].x == -457); CU_ASSERT(polyline.points[14].x == -17);
CU_ASSERT(polyline.points[8].y == 368); CU_ASSERT(polyline.points[15].x == -105);
CU_ASSERT(polyline.points[9].x == -304); CU_ASSERT(polyline.points[16].x == -174);
CU_ASSERT(polyline.points[9].y == 298); CU_ASSERT(polyline.points[17].x == -213);
CU_ASSERT(polyline.points[10].x == -99); CU_ASSERT(polyline.points[18].x == -220);
CU_ASSERT(polyline.points[10].y == 225); CU_ASSERT(polyline.points[19].x == -188);
CU_ASSERT(polyline.points[11].x == 123); CU_ASSERT(polyline.points[20].x == -127);
CU_ASSERT(polyline.points[11].y == 151); CU_ASSERT(polyline.points[21].x == -42);
CU_ASSERT(polyline.points[12].x == 325); CU_ASSERT(polyline.points[22].x == 47);
CU_ASSERT(polyline.points[12].y == 77); CU_ASSERT(polyline.points[23].x == 130);
CU_ASSERT(polyline.points[13].x == 475); CU_ASSERT(polyline.points[24].x == 191);
CU_ASSERT(polyline.points[13].y == 4); CU_ASSERT(polyline.points[25].x == 221);
CU_ASSERT(polyline.points[14].x == 547); CU_ASSERT(polyline.points[26].x == 212);
CU_ASSERT(polyline.points[14].y == -66); CU_ASSERT(polyline.points[27].x == 171);
CU_ASSERT(polyline.points[15].x == 530); CU_ASSERT(polyline.points[28].x == 100);
CU_ASSERT(polyline.points[15].y == -132); CU_ASSERT(polyline.points[29].x == 13);
CU_ASSERT(polyline.points[16].x == 425); CU_ASSERT(polyline.points[30].x == -77);
CU_ASSERT(polyline.points[16].y == -193); CU_ASSERT(polyline.points[31].x == -153);
CU_ASSERT(polyline.points[17].x == 251); CU_ASSERT(polyline.points[32].x == 0);
CU_ASSERT(polyline.points[17].y == -247);
CU_ASSERT(polyline.points[18].x == 38);
CU_ASSERT(polyline.points[18].y == -294);
CU_ASSERT(polyline.points[19].x == -182);
CU_ASSERT(polyline.points[19].y == -333);
CU_ASSERT(polyline.points[20].x == -370);
CU_ASSERT(polyline.points[20].y == -362);
CU_ASSERT(polyline.points[21].x == -497);
CU_ASSERT(polyline.points[21].y == -382);
CU_ASSERT(polyline.points[22].x == -539);
CU_ASSERT(polyline.points[22].y == -392);
CU_ASSERT(polyline.points[23].x == -492);
CU_ASSERT(polyline.points[23].y == -392);
CU_ASSERT(polyline.points[24].x == -362);
CU_ASSERT(polyline.points[24].y == -382);
CU_ASSERT(polyline.points[25].x == -171);
CU_ASSERT(polyline.points[25].y == -362);
CU_ASSERT(polyline.points[26].x == 50);
CU_ASSERT(polyline.points[26].y == -332);
CU_ASSERT(polyline.points[27].x == 262);
CU_ASSERT(polyline.points[27].y == -293);
CU_ASSERT(polyline.points[28].x == 433);
CU_ASSERT(polyline.points[28].y == -246);
CU_ASSERT(polyline.points[29].x == 533);
CU_ASSERT(polyline.points[29].y == -191);
CU_ASSERT(polyline.points[30].x == 546);
CU_ASSERT(polyline.points[30].y == -130);
CU_ASSERT(polyline.points[31].x == 469);
CU_ASSERT(polyline.points[31].y == -64);
CU_ASSERT(polyline.points[32].x == 316);
CU_ASSERT(polyline.points[32].y == 6);
CU_ASSERT(stream_get_length(s) == (sizeof(polyline_order) - 1)); CU_ASSERT(stream_get_length(s) == (sizeof(polyline_order) - 1));
} }
@ -402,10 +371,10 @@ uint8 glyph_index_order_2[] =
void test_read_glyph_index_order(void) void test_read_glyph_index_order(void)
{ {
STREAM* s; STREAM _s, *s;
GLYPH_INDEX_ORDER glyph_index; GLYPH_INDEX_ORDER glyph_index;
s = stream_new(0); s = &_s;
s->p = s->data = glyph_index_order_1; s->p = s->data = glyph_index_order_1;
memset(orderInfo, 0, sizeof(ORDER_INFO)); memset(orderInfo, 0, sizeof(ORDER_INFO));
@ -453,10 +422,10 @@ uint8 fast_index_order[] =
void test_read_fast_index_order(void) void test_read_fast_index_order(void)
{ {
STREAM* s; STREAM _s, *s;
FAST_INDEX_ORDER fast_index; FAST_INDEX_ORDER fast_index;
s = stream_new(0); s = &_s;
s->p = s->data = fast_index_order; s->p = s->data = fast_index_order;
memset(orderInfo, 0, sizeof(ORDER_INFO)); memset(orderInfo, 0, sizeof(ORDER_INFO));
@ -476,7 +445,7 @@ void test_read_fast_index_order(void)
CU_ASSERT(fast_index.opLeft == 0); CU_ASSERT(fast_index.opLeft == 0);
CU_ASSERT(fast_index.opTop == 0); CU_ASSERT(fast_index.opTop == 0);
CU_ASSERT(fast_index.opRight == 0); CU_ASSERT(fast_index.opRight == 0);
CU_ASSERT(fast_index.opBottom == 0); CU_ASSERT(fast_index.opBottom == 524);
CU_ASSERT(fast_index.x == -32768); CU_ASSERT(fast_index.x == -32768);
CU_ASSERT(fast_index.y == 124); CU_ASSERT(fast_index.y == 124);
@ -490,10 +459,10 @@ uint8 fast_glyph_order[] =
void test_read_fast_glyph_order(void) void test_read_fast_glyph_order(void)
{ {
STREAM* s; STREAM _s, *s;
FAST_GLYPH_ORDER fast_glyph; FAST_GLYPH_ORDER fast_glyph;
s = stream_new(0); s = &_s;
s->p = s->data = fast_glyph_order; s->p = s->data = fast_glyph_order;
memset(orderInfo, 0, sizeof(ORDER_INFO)); memset(orderInfo, 0, sizeof(ORDER_INFO));
@ -525,10 +494,10 @@ uint8 polygon_cb_order[] =
void test_read_polygon_cb_order(void) void test_read_polygon_cb_order(void)
{ {
STREAM* s; STREAM _s, *s;
POLYGON_CB_ORDER polygon_cb; POLYGON_CB_ORDER polygon_cb;
s = stream_new(0); s = &_s;
s->p = s->data = polygon_cb_order; s->p = s->data = polygon_cb_order;
memset(orderInfo, 0, sizeof(ORDER_INFO)); memset(orderInfo, 0, sizeof(ORDER_INFO));
@ -557,11 +526,11 @@ uint8 cache_bitmap_order[] = "\x00\x00\x10\x01\x08\x01\x00\x00\x00\x10";
void test_read_cache_bitmap_order(void) void test_read_cache_bitmap_order(void)
{ {
STREAM* s; STREAM _s, *s;
uint16 extraFlags; uint16 extraFlags;
CACHE_BITMAP_ORDER cache_bitmap; CACHE_BITMAP_ORDER cache_bitmap;
s = stream_new(0); s = &_s;
extraFlags = 0x0400; extraFlags = 0x0400;
s->p = s->data = cache_bitmap_order; s->p = s->data = cache_bitmap_order;
@ -598,11 +567,11 @@ uint8 cache_bitmap_v2_order[] =
void test_read_cache_bitmap_v2_order(void) void test_read_cache_bitmap_v2_order(void)
{ {
STREAM* s; STREAM _s, *s;
uint16 extraFlags; uint16 extraFlags;
CACHE_BITMAP_V2_ORDER cache_bitmap_v2; CACHE_BITMAP_V2_ORDER cache_bitmap_v2;
s = stream_new(0); s = &_s;
extraFlags = 0x0CA1; extraFlags = 0x0CA1;
s->p = s->data = cache_bitmap_v2_order; s->p = s->data = cache_bitmap_v2_order;
@ -629,11 +598,11 @@ uint8 cache_bitmap_v3_order[] =
void test_read_cache_bitmap_v3_order(void) void test_read_cache_bitmap_v3_order(void)
{ {
STREAM* s; STREAM _s, *s;
uint16 extraFlags; uint16 extraFlags;
CACHE_BITMAP_V3_ORDER cache_bitmap_v3; CACHE_BITMAP_V3_ORDER cache_bitmap_v3;
s = stream_new(0); s = &_s;
extraFlags = 0x0C30; extraFlags = 0x0C30;
s->p = s->data = cache_bitmap_v3_order; s->p = s->data = cache_bitmap_v3_order;
@ -659,10 +628,10 @@ uint8 cache_brush_order[] = "\x00\x01\x08\x08\x81\x08\xaa\x55\xaa\x55\xaa\x55\xa
void test_read_cache_brush_order(void) void test_read_cache_brush_order(void)
{ {
STREAM* s; STREAM _s, *s;
CACHE_BRUSH_ORDER cache_brush; CACHE_BRUSH_ORDER cache_brush;
s = stream_new(0); s = &_s;
s->p = s->data = cache_brush_order; s->p = s->data = cache_brush_order;
memset(&cache_brush, 0, sizeof(CACHE_BRUSH_ORDER)); memset(&cache_brush, 0, sizeof(CACHE_BRUSH_ORDER));
@ -683,14 +652,20 @@ uint8 create_offscreen_bitmap_order[] = "\x00\x80\x60\x01\x10\x00\x01\x00\x02\x0
void test_read_create_offscreen_bitmap_order(void) void test_read_create_offscreen_bitmap_order(void)
{ {
STREAM* s; STREAM _s, *s;
OFFSCREEN_DELETE_LIST* deleteList;
CREATE_OFFSCREEN_BITMAP_ORDER create_offscreen_bitmap; CREATE_OFFSCREEN_BITMAP_ORDER create_offscreen_bitmap;
s = stream_new(0); s = &_s;
s->p = s->data = create_offscreen_bitmap_order; s->p = s->data = create_offscreen_bitmap_order;
memset(&create_offscreen_bitmap, 0, sizeof(CREATE_OFFSCREEN_BITMAP_ORDER)); memset(&create_offscreen_bitmap, 0, sizeof(CREATE_OFFSCREEN_BITMAP_ORDER));
deleteList = &(create_offscreen_bitmap.deleteList);
deleteList->cIndices = 0;
deleteList->sIndices = 16;
deleteList->indices = malloc(sizeof(uint16) * deleteList->sIndices);
update_read_create_offscreen_bitmap_order(s, &create_offscreen_bitmap); update_read_create_offscreen_bitmap_order(s, &create_offscreen_bitmap);
CU_ASSERT(create_offscreen_bitmap.id == 0); CU_ASSERT(create_offscreen_bitmap.id == 0);
@ -705,10 +680,10 @@ uint8 switch_surface_order[] = "\xff\xff";
void test_read_switch_surface_order(void) void test_read_switch_surface_order(void)
{ {
STREAM* s; STREAM _s, *s;
SWITCH_SURFACE_ORDER switch_surface; SWITCH_SURFACE_ORDER switch_surface;
s = stream_new(0); s = &_s;
s->p = s->data = switch_surface_order; s->p = s->data = switch_surface_order;
memset(&switch_surface, 0, sizeof(SWITCH_SURFACE_ORDER)); memset(&switch_surface, 0, sizeof(SWITCH_SURFACE_ORDER));
@ -756,11 +731,16 @@ void test_patblt(rdpContext* context, PATBLT_ORDER* patblt)
void test_update_recv_orders(void) void test_update_recv_orders(void)
{ {
STREAM* s; rdpRdp* rdp;
STREAM _s, *s;
rdpUpdate* update; rdpUpdate* update;
s = stream_new(0); s = &_s;
update = update_new(NULL); rdp = rdp_new(NULL);
update = update_new(rdp);
update->context = malloc(sizeof(rdpContext));
update->context->rdp = rdp;
opaque_rect_count = 0; opaque_rect_count = 0;
polyline_count = 0; polyline_count = 0;
@ -771,6 +751,7 @@ void test_update_recv_orders(void)
update->primary->PatBlt = test_patblt; update->primary->PatBlt = test_patblt;
s->p = s->data = orders_update_1; s->p = s->data = orders_update_1;
s->size = sizeof(orders_update_1);
update_recv(update, s); update_recv(update, s);
@ -779,9 +760,12 @@ void test_update_recv_orders(void)
update->primary->order_info.orderType = ORDER_TYPE_PATBLT; update->primary->order_info.orderType = ORDER_TYPE_PATBLT;
s->p = s->data = orders_update_2; s->p = s->data = orders_update_2;
s->size = sizeof(orders_update_2);
update_recv(update, s); update_recv(update, s);
CU_ASSERT(patblt_count == 3); CU_ASSERT(patblt_count == 3);
free(update->context);
} }

View File

@ -17,9 +17,11 @@
* limitations under the License. * limitations under the License.
*/ */
#include "connection.h"
#include "info.h"
#include "per.h" #include "per.h"
#include "info.h"
#include "input.h"
#include "connection.h"
/** /**
* Connection Sequence * Connection Sequence
@ -388,6 +390,8 @@ boolean rdp_client_connect_demand_active(rdpRdp* rdp, STREAM* s)
if (!rdp_send_confirm_active(rdp)) if (!rdp_send_confirm_active(rdp))
return false; return false;
input_register_client_callbacks(rdp->input);
/** /**
* The server may request a different desktop size during Deactivation-Reactivation sequence. * The server may request a different desktop size during Deactivation-Reactivation sequence.
* In this case, the UI should be informed and do actual window resizing at this point. * In this case, the UI should be informed and do actual window resizing at this point.
@ -419,6 +423,9 @@ boolean rdp_client_connect_finalize(rdpRdp* rdp)
return false; return false;
if (!rdp_send_client_control_pdu(rdp, CTRLACTION_REQUEST_CONTROL)) if (!rdp_send_client_control_pdu(rdp, CTRLACTION_REQUEST_CONTROL))
return false; return false;
rdp->input->SynchronizeEvent(rdp->input, 0);
if (!rdp_send_client_persistent_key_list_pdu(rdp)) if (!rdp_send_client_persistent_key_list_pdu(rdp))
return false; return false;
if (!rdp_send_client_font_list_pdu(rdp, FONTLIST_FIRST | FONTLIST_LAST)) if (!rdp_send_client_font_list_pdu(rdp, FONTLIST_FIRST | FONTLIST_LAST))

View File

@ -58,8 +58,6 @@ boolean freerdp_connect(freerdp* instance)
extension_post_connect(rdp->extension); extension_post_connect(rdp->extension);
input_register_client_callbacks(rdp->input);
IFCALLRET(instance->PostConnect, status, instance); IFCALLRET(instance->PostConnect, status, instance);
if (status != true) if (status != true)

View File

@ -19,33 +19,114 @@
#include "rdp.h" #include "rdp.h"
static uint8 HuffLengthLEC[] = { #if 0
0x6, 0x6, 0x6, 0x6, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x9, 0x8, 0x9, 0x9, 0x9, 0x9, 0x8, 0x8, 0x9, 0x9, 0x9, 0x9, 0x9, 0x8, 0x9, 0x9, 0xa, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0x9, 0x9, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0x9, 0xa, 0xa, 0x9, 0xa, 0x9, 0x9, 0x8, 0x9, 0x9, 0x9, 0x9, 0xa, 0xa, 0xa, 0x9, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x8, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0x7, 0x9, 0x9, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xd, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xb, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0x8, 0x9, 0x9, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0x9, 0x8, 0x7, 0xd, 0xd, 0x7, 0x7, 0xa, 0x7, 0x7, 0x6, 0x6, 0x6, 0x6, 0x5, 0x6, 0x6, 0x6, 0x5, 0x6, 0x5, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x8, 0x5, 0x6, 0x7, 0x7 }; static uint8 HuffLengthLEC[] =
{
0x6, 0x6, 0x6, 0x6, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x8, 0x8, 0x8, 0x8,
0x8, 0x8, 0x8, 0x9, 0x8, 0x9, 0x9, 0x9, 0x9, 0x8, 0x8, 0x9, 0x9, 0x9, 0x9, 0x9,
0x8, 0x9, 0x9, 0xa, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0xa, 0x9, 0xa, 0xa, 0xa,
0x9, 0x9, 0x9, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0x9, 0xa, 0xa, 0x9, 0xa, 0x9, 0x9,
0x8, 0x9, 0x9, 0x9, 0x9, 0xa, 0xa, 0xa, 0x9, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa,
0x9, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa,
0x8, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa,
0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9,
0x7, 0x9, 0x9, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa,
0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa,
0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xd, 0xa, 0xa, 0xa, 0xa,
0xa, 0xa, 0xb, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa,
0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa,
0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa,
0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa,
0x8, 0x9, 0x9, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0x9, 0x8, 0x7,
0xd, 0xd, 0x7, 0x7, 0xa, 0x7, 0x7, 0x6, 0x6, 0x6, 0x6, 0x5, 0x6, 0x6, 0x6, 0x5,
0x6, 0x5, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6,
0x8, 0x5, 0x6, 0x7, 0x7
};
#endif
static uint16 HuffIndexLEC[512] = { static uint16 HuffIndexLEC[512] =
0x007b, 0xff1f, 0xff0d, 0xfe27, 0xfe00, 0xff05, 0xff17, 0xfe68, 0x00c5, 0xfe07, 0xff13, 0xfec0, 0xff08, 0xfe18, 0xff1b, 0xfeb3, 0xfe03, 0x00a2, 0xfe42, 0xff10, 0xfe0b, 0xfe02, 0xfe91, 0xff19, 0xfe80, 0x00e9, 0xfe3a, 0xff15, 0xfe12, 0x0057, 0xfed7, 0xff1d, 0xff0e, 0xfe35, 0xfe69, 0xff22, 0xff18, 0xfe7a, 0xfe01, 0xff23, 0xff14, 0xfef4, 0xfeb4, 0xfe09, 0xff1c, 0xfec4, 0xff09, 0xfe60, 0xfe70, 0xff12, 0xfe05, 0xfe92, 0xfea1, 0xff1a, 0xfe0f, 0xff07, 0xfe56, 0xff16, 0xff02, 0xfed8, 0xfee8, 0xff1e, 0xfe1d, 0x003b, 0xffff, 0xff06, 0xffff, 0xfe71, 0xfe89, 0xffff, 0xffff, 0xfe2c, 0xfe2b, 0xfe20, 0xffff, 0xfebb, 0xfecf, 0xfe08, 0xffff, 0xfee0, 0xfe0d, 0xffff, 0xfe99, 0xffff, 0xfe04, 0xfeaa, 0xfe49, 0xffff, 0xfe17, 0xfe61, 0xfedf, 0xffff, 0xfeff, 0xfef6, 0xfe4c, 0xffff, 0xffff, 0xfe87, 0xffff, 0xff24, 0xffff, 0xfe3c, 0xfe72, 0xffff, 0xffff, 0xfece, 0xffff, 0xfefe, 0xffff, 0xfe23, 0xfebc, 0xfe0a, 0xfea9, 0xffff, 0xfe11, 0xffff, 0xfe82, 0xffff, 0xfe06, 0xfe9a, 0xfef5, 0xffff, 0xfe22, 0xfe4d, 0xfe5f, 0xffff, 0xff03, 0xfee1, 0xffff, 0xfeca, 0xfecc, 0xffff, 0xfe19, 0xffff, 0xfeb7, 0xffff, 0xffff, 0xfe83, 0xfe29, 0xffff, 0xffff, 0xffff, 0xfe6c, 0xffff, 0xfeed, 0xffff, 0xffff, 0xfe46, 0xfe5c, 0xfe15, 0xffff, 0xfedb, 0xfea6, 0xffff, 0xffff, 0xfe44, 0xffff, 0xfe0c, 0xffff, 0xfe95, 0xfefc, 0xffff, 0xffff, 0xfeb8, 0x16c9, 0xffff, 0xfef0, 0xffff, 0xfe38, 0xffff, 0xffff, 0xfe6d, 0xfe7e, 0xffff, 0xffff, 0xffff, 0xffff, 0xfe5b, 0xfedc, 0xffff, 0xffff, 0xfeec, 0xfe47, 0xfe1f, 0xffff, 0xfe7f, 0xfe96, 0xffff, 0xffff, 0xfea5, 0xffff, 0xfe10, 0xfe40, 0xfe32, 0xfebf, 0xffff, 0xffff, 0xfed4, 0xfef1, 0xffff, 0xffff, 0xffff, 0xfe75, 0xffff, 0xffff, 0xfe8d, 0xfe31, 0xffff, 0xfe65, 0xfe1b, 0xffff, 0xfee4, 0xfefb, 0xffff, 0xffff, 0xfe52, 0xffff, 0xfe0e, 0xffff, 0xfe9d, 0xfeaf, 0xffff, 0xffff, 0xfe51, 0xfed3, 0xffff, 0xff20, 0xffff, 0xfe2f, 0xffff, 0xffff, 0xfec1, 0xfe8c, 0xffff, 0xffff, 0xffff, 0xfe3f, 0xffff, 0xffff, 0xfe76, 0xffff, 0xfefa, 0xfe53, 0xfe25, 0xffff, 0xfe64, 0xfee5, 0xffff, 0xffff, 0xfeae, 0xffff, 0xfe13, 0xffff, 0xfe88, 0xfe9e, 0xffff, 0xfe43, 0xffff, 0xffff, 0xfea4, 0xfe93, 0xffff, 0xffff, 0xffff, 0xfe3d, 0xffff, 0xffff, 0xfeeb, 0xfed9, 0xffff, 0xfe14, 0xfe5a, 0xffff, 0xfe28, 0xfe7d, 0xffff, 0xffff, 0xfe6a, 0xffff, 0xffff, 0xff01, 0xfec6, 0xfec8, 0xffff, 0xffff, 0xfeb5, 0xffff, 0xffff, 0xffff, 0xfe94, 0xfe78, 0xffff, 0xffff, 0xffff, 0xfea3, 0xffff, 0xffff, 0xfeda, 0xfe58, 0xffff, 0xfe1e, 0xfe45, 0xfeea, 0xffff, 0xfe6b, 0xffff, 0xffff, 0xfe37, 0xffff, 0xffff, 0xffff, 0xfe7c, 0xfeb6, 0xffff, 0xffff, 0xfef8, 0xffff, 0xffff, 0xffff, 0xfec7, 0xfe9b, 0xffff, 0xffff, 0xffff, 0xfe50, 0xffff, 0xffff, 0xfead, 0xfee2, 0xffff, 0xfe1a, 0xfe63, 0xfe4e, 0xffff, 0xffff, 0xfef9, 0xffff, 0xfe73, 0xffff, 0xffff, 0xffff, 0xfe30, 0xfe8b, 0xffff, 0xffff, 0xfebd, 0xfe2e, 0x0100, 0xffff, 0xfeee, 0xfed2, 0xffff, 0xffff, 0xffff, 0xfeac, 0xffff, 0xffff, 0xfe9c, 0xfe84, 0xffff, 0xfe24, 0xfe4f, 0xfef7, 0xffff, 0xffff, 0xfee3, 0xfe62, 0xffff, 0xffff, 0xffff, 0xffff, 0xfe8a, 0xfe74, 0xffff, 0xffff, 0xfe3e, 0xffff, 0xffff, 0xffff, 0xfed1, 0xfebe, 0xffff, 0xffff, 0xfe2d, 0xffff, 0xfe4a, 0xfef3, 0xffff, 0xffff, 0xfedd, 0xfe5e, 0xfe16, 0xffff, 0xfe48, 0xfea8, 0xffff, 0xfeab, 0xfe97, 0xffff, 0xffff, 0xfed0, 0xffff, 0xffff, 0xfecd, 0xfeb9, 0xffff, 0xffff, 0xffff, 0xfe2a, 0xffff, 0xffff, 0xfe86, 0xfe6e, 0xffff, 0xffff, 0xffff, 0xfede, 0xffff, 0xffff, 0xfe5d, 0xfe4b, 0xfe21, 0xffff, 0xfeef, 0xfe98, 0xffff, 0xffff, 0xfe81, 0xffff, 0xffff, 0xffff, 0xfea7, 0xffff, 0xfeba, 0xfefd, 0xffff, 0xffff, 0xffff, 0xfecb, 0xffff, 0xffff, 0xfe6f, 0xfe39, 0xffff, 0xffff, 0xffff, 0xfe85, 0xffff, 0x010c, 0xfee6, 0xfe67, 0xfe1c, 0xffff, 0xfe54, 0xfeb2, 0xffff, 0xffff, 0xfe9f, 0xffff, 0xffff, 0xffff, 0xfe59, 0xfeb1, 0xffff, 0xfec2, 0xffff, 0xffff, 0xfe36, 0xfef2, 0xffff, 0xffff, 0xfed6, 0xfe77, 0xffff, 0xffff, 0xffff, 0xfe33, 0xffff, 0xffff, 0xfe8f, 0xfe55, 0xfe26, 0x010a, 0xff04, 0xfee7, 0xffff, 0x0121, 0xfe66, 0xffff, 0xffff, 0xffff, 0xfeb0, 0xfea0, 0xffff, 0x010f, 0xfe90, 0xffff, 0xffff, 0xfed5, 0xffff, 0xffff, 0xfec3, 0xfe34, 0xffff, 0xffff, 0xffff, 0xfe8e, 0xffff, 0x0111, 0xfe79, 0xfe41, 0x010b }; {
0x007b, 0xff1f, 0xff0d, 0xfe27, 0xfe00, 0xff05, 0xff17, 0xfe68, 0x00c5, 0xfe07, 0xff13, 0xfec0, 0xff08, 0xfe18, 0xff1b, 0xfeb3,
0xfe03, 0x00a2, 0xfe42, 0xff10, 0xfe0b, 0xfe02, 0xfe91, 0xff19, 0xfe80, 0x00e9, 0xfe3a, 0xff15, 0xfe12, 0x0057, 0xfed7, 0xff1d,
0xff0e, 0xfe35, 0xfe69, 0xff22, 0xff18, 0xfe7a, 0xfe01, 0xff23, 0xff14, 0xfef4, 0xfeb4, 0xfe09, 0xff1c, 0xfec4, 0xff09, 0xfe60,
0xfe70, 0xff12, 0xfe05, 0xfe92, 0xfea1, 0xff1a, 0xfe0f, 0xff07, 0xfe56, 0xff16, 0xff02, 0xfed8, 0xfee8, 0xff1e, 0xfe1d, 0x003b,
0xffff, 0xff06, 0xffff, 0xfe71, 0xfe89, 0xffff, 0xffff, 0xfe2c, 0xfe2b, 0xfe20, 0xffff, 0xfebb, 0xfecf, 0xfe08, 0xffff, 0xfee0,
0xfe0d, 0xffff, 0xfe99, 0xffff, 0xfe04, 0xfeaa, 0xfe49, 0xffff, 0xfe17, 0xfe61, 0xfedf, 0xffff, 0xfeff, 0xfef6, 0xfe4c, 0xffff,
0xffff, 0xfe87, 0xffff, 0xff24, 0xffff, 0xfe3c, 0xfe72, 0xffff, 0xffff, 0xfece, 0xffff, 0xfefe, 0xffff, 0xfe23, 0xfebc, 0xfe0a,
0xfea9, 0xffff, 0xfe11, 0xffff, 0xfe82, 0xffff, 0xfe06, 0xfe9a, 0xfef5, 0xffff, 0xfe22, 0xfe4d, 0xfe5f, 0xffff, 0xff03, 0xfee1,
0xffff, 0xfeca, 0xfecc, 0xffff, 0xfe19, 0xffff, 0xfeb7, 0xffff, 0xffff, 0xfe83, 0xfe29, 0xffff, 0xffff, 0xffff, 0xfe6c, 0xffff,
0xfeed, 0xffff, 0xffff, 0xfe46, 0xfe5c, 0xfe15, 0xffff, 0xfedb, 0xfea6, 0xffff, 0xffff, 0xfe44, 0xffff, 0xfe0c, 0xffff, 0xfe95,
0xfefc, 0xffff, 0xffff, 0xfeb8, 0x16c9, 0xffff, 0xfef0, 0xffff, 0xfe38, 0xffff, 0xffff, 0xfe6d, 0xfe7e, 0xffff, 0xffff, 0xffff,
0xffff, 0xfe5b, 0xfedc, 0xffff, 0xffff, 0xfeec, 0xfe47, 0xfe1f, 0xffff, 0xfe7f, 0xfe96, 0xffff, 0xffff, 0xfea5, 0xffff, 0xfe10,
0xfe40, 0xfe32, 0xfebf, 0xffff, 0xffff, 0xfed4, 0xfef1, 0xffff, 0xffff, 0xffff, 0xfe75, 0xffff, 0xffff, 0xfe8d, 0xfe31, 0xffff,
0xfe65, 0xfe1b, 0xffff, 0xfee4, 0xfefb, 0xffff, 0xffff, 0xfe52, 0xffff, 0xfe0e, 0xffff, 0xfe9d, 0xfeaf, 0xffff, 0xffff, 0xfe51,
0xfed3, 0xffff, 0xff20, 0xffff, 0xfe2f, 0xffff, 0xffff, 0xfec1, 0xfe8c, 0xffff, 0xffff, 0xffff, 0xfe3f, 0xffff, 0xffff, 0xfe76,
0xffff, 0xfefa, 0xfe53, 0xfe25, 0xffff, 0xfe64, 0xfee5, 0xffff, 0xffff, 0xfeae, 0xffff, 0xfe13, 0xffff, 0xfe88, 0xfe9e, 0xffff,
0xfe43, 0xffff, 0xffff, 0xfea4, 0xfe93, 0xffff, 0xffff, 0xffff, 0xfe3d, 0xffff, 0xffff, 0xfeeb, 0xfed9, 0xffff, 0xfe14, 0xfe5a,
0xffff, 0xfe28, 0xfe7d, 0xffff, 0xffff, 0xfe6a, 0xffff, 0xffff, 0xff01, 0xfec6, 0xfec8, 0xffff, 0xffff, 0xfeb5, 0xffff, 0xffff,
0xffff, 0xfe94, 0xfe78, 0xffff, 0xffff, 0xffff, 0xfea3, 0xffff, 0xffff, 0xfeda, 0xfe58, 0xffff, 0xfe1e, 0xfe45, 0xfeea, 0xffff,
0xfe6b, 0xffff, 0xffff, 0xfe37, 0xffff, 0xffff, 0xffff, 0xfe7c, 0xfeb6, 0xffff, 0xffff, 0xfef8, 0xffff, 0xffff, 0xffff, 0xfec7,
0xfe9b, 0xffff, 0xffff, 0xffff, 0xfe50, 0xffff, 0xffff, 0xfead, 0xfee2, 0xffff, 0xfe1a, 0xfe63, 0xfe4e, 0xffff, 0xffff, 0xfef9,
0xffff, 0xfe73, 0xffff, 0xffff, 0xffff, 0xfe30, 0xfe8b, 0xffff, 0xffff, 0xfebd, 0xfe2e, 0x0100, 0xffff, 0xfeee, 0xfed2, 0xffff,
0xffff, 0xffff, 0xfeac, 0xffff, 0xffff, 0xfe9c, 0xfe84, 0xffff, 0xfe24, 0xfe4f, 0xfef7, 0xffff, 0xffff, 0xfee3, 0xfe62, 0xffff,
0xffff, 0xffff, 0xffff, 0xfe8a, 0xfe74, 0xffff, 0xffff, 0xfe3e, 0xffff, 0xffff, 0xffff, 0xfed1, 0xfebe, 0xffff, 0xffff, 0xfe2d,
0xffff, 0xfe4a, 0xfef3, 0xffff, 0xffff, 0xfedd, 0xfe5e, 0xfe16, 0xffff, 0xfe48, 0xfea8, 0xffff, 0xfeab, 0xfe97, 0xffff, 0xffff,
0xfed0, 0xffff, 0xffff, 0xfecd, 0xfeb9, 0xffff, 0xffff, 0xffff, 0xfe2a, 0xffff, 0xffff, 0xfe86, 0xfe6e, 0xffff, 0xffff, 0xffff,
0xfede, 0xffff, 0xffff, 0xfe5d, 0xfe4b, 0xfe21, 0xffff, 0xfeef, 0xfe98, 0xffff, 0xffff, 0xfe81, 0xffff, 0xffff, 0xffff, 0xfea7,
0xffff, 0xfeba, 0xfefd, 0xffff, 0xffff, 0xffff, 0xfecb, 0xffff, 0xffff, 0xfe6f, 0xfe39, 0xffff, 0xffff, 0xffff, 0xfe85, 0xffff,
0x010c, 0xfee6, 0xfe67, 0xfe1c, 0xffff, 0xfe54, 0xfeb2, 0xffff, 0xffff, 0xfe9f, 0xffff, 0xffff, 0xffff, 0xfe59, 0xfeb1, 0xffff,
0xfec2, 0xffff, 0xffff, 0xfe36, 0xfef2, 0xffff, 0xffff, 0xfed6, 0xfe77, 0xffff, 0xffff, 0xffff, 0xfe33, 0xffff, 0xffff, 0xfe8f,
0xfe55, 0xfe26, 0x010a, 0xff04, 0xfee7, 0xffff, 0x0121, 0xfe66, 0xffff, 0xffff, 0xffff, 0xfeb0, 0xfea0, 0xffff, 0x010f, 0xfe90,
0xffff, 0xffff, 0xfed5, 0xffff, 0xffff, 0xfec3, 0xfe34, 0xffff, 0xffff, 0xffff, 0xfe8e, 0xffff, 0x0111, 0xfe79, 0xfe41, 0x010b
};
static uint16 LECHTab[] = {511, 0, 508, 448, 494, 347, 486, 482}; static uint16 LECHTab[] =
{
511, 0, 508, 448, 494, 347, 486, 482
};
static uint8 HuffLenLOM[] = { #if 0
0x4, 0x2, 0x3, 0x4, 0x3, 0x4, 0x4, 0x5, 0x4, 0x5, 0x5, 0x6, 0x6, 0x7, 0x7, 0x8, 0x7, 0x8, 0x8, 0x9, 0x9, 0x8, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9 }; static uint8 HuffLenLOM[] =
{
0x4, 0x2, 0x3, 0x4, 0x3, 0x4, 0x4, 0x5, 0x4, 0x5, 0x5, 0x6, 0x6, 0x7, 0x7, 0x8,
0x7, 0x8, 0x8, 0x9, 0x9, 0x8, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9
};
#endif
static uint16 HuffIndexLOM[] = { static uint16 HuffIndexLOM[] =
0xfe1, 0xfe0, 0xfe2, 0xfe8, 0xe, 0xfe5, 0xfe4, 0xfea, 0xff1, 0xfe3, 0x15, 0xfe7, 0xfef, 0x46, 0xff0, 0xfed, 0xfff, 0xff7, 0xffb, 0x19, 0xffd, 0xff4, 0x12c, 0xfeb, 0xffe, 0xff6, 0xffa, 0x89, 0xffc, 0xff3, 0xff8, 0xff2 }; {
0x0fe1, 0x0fe0, 0x0fe2, 0x0fe8, 0x000e, 0x0fe5, 0x0fe4, 0x0fea, 0x0ff1, 0x0fe3, 0x0015, 0x0fe7, 0x0fef, 0x0046, 0x0ff0, 0x0fed,
0x0fff, 0x0ff7, 0x0ffb, 0x0019, 0x0ffd, 0x0ff4, 0x012c, 0x0feb, 0x0ffe, 0x0ff6, 0x0ffa, 0x0089, 0x0ffc, 0x0ff3, 0x0ff8, 0x0ff2
};
static uint8 LOMHTab[] = {0, 4, 10, 19}; static uint8 LOMHTab[] =
{
0, 4, 10, 19
};
static uint8 CopyOffsetBitsLUT[] = { #if 0
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15 }; static uint8 CopyOffsetBitsLUT[] =
{
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15
};
static uint32 CopyOffsetBaseLUT[] = { static uint32 CopyOffsetBaseLUT[] =
13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153, 65537 }; {
13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537,
2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153, 65537
};
static uint8 LoMBitsLUT[] = { static uint8 LoMBitsLUT[] =
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 6, 6, 8, 8, 14, 14 }; {
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 6, 6, 8, 8, 14, 14
};
static uint16 LoMBaseLUT[] = { static uint16 LoMBaseLUT[] =
2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 22, 26, 30, 34, 42, 50, 58, 66, 82, 98, 114, 130, 194, 258, 514, 2, 2 }; {
2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 22, 26, 30,
34, 42, 50, 58, 66, 82, 98, 114, 130, 194, 258, 514, 2, 2
};
#endif
uint16 LEChash(uint16 key) uint16 LEChash(uint16 key)
{ {

View File

@ -1488,6 +1488,7 @@ void update_read_create_offscreen_bitmap_order(STREAM* s, CREATE_OFFSCREEN_BITMA
{ {
uint16 flags; uint16 flags;
boolean deleteListPresent; boolean deleteListPresent;
OFFSCREEN_DELETE_LIST* deleteList;
stream_read_uint16(s, flags); /* flags (2 bytes) */ stream_read_uint16(s, flags); /* flags (2 bytes) */
create_offscreen_bitmap->id = flags & 0x7FFF; create_offscreen_bitmap->id = flags & 0x7FFF;
@ -1496,12 +1497,10 @@ void update_read_create_offscreen_bitmap_order(STREAM* s, CREATE_OFFSCREEN_BITMA
stream_read_uint16(s, create_offscreen_bitmap->cx); /* cx (2 bytes) */ stream_read_uint16(s, create_offscreen_bitmap->cx); /* cx (2 bytes) */
stream_read_uint16(s, create_offscreen_bitmap->cy); /* cy (2 bytes) */ stream_read_uint16(s, create_offscreen_bitmap->cy); /* cy (2 bytes) */
deleteList = &(create_offscreen_bitmap->deleteList);
if (deleteListPresent) if (deleteListPresent)
{ {
int i; int i;
OFFSCREEN_DELETE_LIST* deleteList;
deleteList = &(create_offscreen_bitmap->deleteList);
stream_read_uint16(s, deleteList->cIndices); stream_read_uint16(s, deleteList->cIndices);
@ -1516,6 +1515,10 @@ void update_read_create_offscreen_bitmap_order(STREAM* s, CREATE_OFFSCREEN_BITMA
stream_read_uint16(s, deleteList->indices[i]); stream_read_uint16(s, deleteList->indices[i]);
} }
} }
else
{
deleteList->cIndices = 0;
}
} }
void update_read_switch_surface_order(STREAM* s, SWITCH_SURFACE_ORDER* switch_surface) void update_read_switch_surface_order(STREAM* s, SWITCH_SURFACE_ORDER* switch_surface)

View File

@ -105,7 +105,7 @@ boolean rdp_read_share_control_header(STREAM* s, uint16* length, uint16* type, u
void rdp_write_share_control_header(STREAM* s, uint16 length, uint16 type, uint16 channel_id) void rdp_write_share_control_header(STREAM* s, uint16 length, uint16 type, uint16 channel_id)
{ {
length -= RDP_PACKET_HEADER_LENGTH; length -= (s->p - s->data);
/* Share Control Header */ /* Share Control Header */
stream_write_uint16(s, length); /* totalLength */ stream_write_uint16(s, length); /* totalLength */
@ -280,9 +280,11 @@ static uint32 rdp_security_stream_out(rdpRdp* rdp, STREAM* s, int length)
uint32 pad = 0; uint32 pad = 0;
sec_flags = rdp->sec_flags; sec_flags = rdp->sec_flags;
if (sec_flags != 0) if (sec_flags != 0)
{ {
rdp_write_security_header(s, sec_flags); rdp_write_security_header(s, sec_flags);
if (sec_flags & SEC_ENCRYPT) if (sec_flags & SEC_ENCRYPT)
{ {
if (rdp->settings->encryption_method == ENCRYPTION_METHOD_FIPS) if (rdp->settings->encryption_method == ENCRYPTION_METHOD_FIPS)
@ -292,12 +294,15 @@ static uint32 rdp_security_stream_out(rdpRdp* rdp, STREAM* s, int length)
length = length - (data - s->data); length = length - (data - s->data);
stream_write_uint16(s, 0x10); /* length */ stream_write_uint16(s, 0x10); /* length */
stream_write_uint8(s, 0x1); /* TSFIPS_VERSION 1*/ stream_write_uint8(s, 0x1); /* TSFIPS_VERSION 1*/
/* handle padding */ /* handle padding */
pad = 8 - (length % 8); pad = 8 - (length % 8);
if (pad == 8) if (pad == 8)
pad = 0; pad = 0;
if (pad) if (pad)
memset(data+length, 0, pad); memset(data+length, 0, pad);
stream_write_uint8(s, pad); stream_write_uint8(s, pad);
security_hmac_signature(data, length, s->p, rdp); security_hmac_signature(data, length, s->p, rdp);
@ -316,8 +321,10 @@ static uint32 rdp_security_stream_out(rdpRdp* rdp, STREAM* s, int length)
security_encrypt(s->p, length, rdp); security_encrypt(s->p, length, rdp);
} }
} }
rdp->sec_flags = 0; rdp->sec_flags = 0;
} }
return pad; return pad;
} }
@ -328,13 +335,19 @@ static uint32 rdp_get_sec_bytes(rdpRdp* rdp)
if (rdp->sec_flags & SEC_ENCRYPT) if (rdp->sec_flags & SEC_ENCRYPT)
{ {
sec_bytes = 12; sec_bytes = 12;
if (rdp->settings->encryption_method == ENCRYPTION_METHOD_FIPS) if (rdp->settings->encryption_method == ENCRYPTION_METHOD_FIPS)
sec_bytes += 4; sec_bytes += 4;
} }
else if (rdp->sec_flags != 0) else if (rdp->sec_flags != 0)
{
sec_bytes = 4; sec_bytes = 4;
}
else else
{
sec_bytes = 0; sec_bytes = 0;
}
return sec_bytes; return sec_bytes;
} }

View File

@ -48,7 +48,9 @@ void stream_free(STREAM* stream)
{ {
if (stream != NULL) if (stream != NULL)
{ {
if (stream->data != NULL)
xfree(stream->data); xfree(stream->data);
xfree(stream); xfree(stream);
} }
} }