From 8f2b4512cfb57dc1f9a719675ac15ecb3ad17a0c Mon Sep 17 00:00:00 2001 From: jsorg71 Date: Fri, 11 Feb 2005 02:54:26 +0000 Subject: [PATCH] fix some crashes and added some debug messages --- xrdp/Makefile | 1 + xrdp/xrdp_login_wnd.c | 4 ++-- xrdp/xrdp_orders.c | 5 +++-- xrdp/xrdp_painter.c | 40 +++++++++++++++++++++++++++++++--------- xrdp/xrdp_wm.c | 11 +++++++---- 5 files changed, 44 insertions(+), 17 deletions(-) diff --git a/xrdp/Makefile b/xrdp/Makefile index b37570cc..d3f4d5c0 100644 --- a/xrdp/Makefile +++ b/xrdp/Makefile @@ -11,6 +11,7 @@ XRDPOBJ = ../common/os_calls.o \ CFLAGS = -Wall -O2 -I../common LDFLAGS = -L /usr/gnu/lib LIBS = -lpthread -lcrypto +#CC = g++ CC = gcc all: xrdp diff --git a/xrdp/xrdp_login_wnd.c b/xrdp/xrdp_login_wnd.c index e2320dfa..aecc77fe 100644 --- a/xrdp/xrdp_login_wnd.c +++ b/xrdp/xrdp_login_wnd.c @@ -403,7 +403,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self) but->id = 4; but->pointer = 1; but->tab_stop = 1; - but->caption1 = g_malloc(256, 1); + but->caption1 = (char*)g_malloc(256, 1); self->login_window->focused_control = but; /* label */ @@ -425,7 +425,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self) but->id = 5; but->pointer = 1; but->tab_stop = 1; - but->caption1 = g_malloc(256, 1); + but->caption1 = (char*)g_malloc(256, 1); but->password_char = '*'; /* label */ diff --git a/xrdp/xrdp_orders.c b/xrdp/xrdp_orders.c index 85c7c9ee..185ec9a7 100644 --- a/xrdp/xrdp_orders.c +++ b/xrdp/xrdp_orders.c @@ -75,9 +75,10 @@ int xrdp_orders_send(struct xrdp_orders* self) if (self->order_level > 0) { self->order_level--; - if (self->order_level == 0) + if (self->order_level == 0 && self->order_count > 0) { s_mark_end(self->out_s); + DEBUG(("xrdp_orders_send sending %d orders\n\r", self->order_count)); self->order_count_ptr[0] = self->order_count; self->order_count_ptr[1] = self->order_count >> 8; if (xrdp_rdp_send_data(self->rdp_layer, self->out_s, @@ -97,6 +98,7 @@ int xrdp_orders_force_send(struct xrdp_orders* self) if (self->order_count > 0) { s_mark_end(self->out_s); + DEBUG(("xrdp_orders_force_send sending %d orders\n\r", self->order_count)); self->order_count_ptr[0] = self->order_count; self->order_count_ptr[1] = self->order_count >> 8; if (xrdp_rdp_send_data(self->rdp_layer, self->out_s, @@ -1469,7 +1471,6 @@ int xrdp_orders_send_bitmap(struct xrdp_orders* self, return 1; } bufsize = s->p - p; - //g_printf("bufsize %d\n", bufsize); Bpp = (bitmap->bpp + 7) / 8; xrdp_orders_check(self, bufsize + 16); self->order_count++; diff --git a/xrdp/xrdp_painter.c b/xrdp/xrdp_painter.c index 1863db4c..f5f9dcff 100644 --- a/xrdp/xrdp_painter.c +++ b/xrdp/xrdp_painter.c @@ -381,6 +381,20 @@ int xrdp_painter_draw_bitmap(struct xrdp_painter* self, y1 = 0; } //g_printf("%d %d %d %d %d %d\n", x1, y1, w, h, srcx, srcy); + DEBUG(("sending memblt order \n\r\ + cache_id %d\n\r\ + palette_id %d\n\r\ + x %d\n\r\ + y %d\n\r\ + cx %d\n\r\ + cy %d\n\r\ + rop %d\n\r\ + srcx %d\n\r\ + srcy %d\n\r\ + cache_idx %d\n\r", + cache_id, palette_id, + x1, y1, w, h, self->rop, srcx, srcy, + cache_idx)); xrdp_orders_mem_blt(self->orders, cache_id, palette_id, x1, y1, w, h, self->rop, srcx, srcy, cache_idx, &rect1); @@ -554,19 +568,27 @@ int xrdp_painter_draw_text(struct xrdp_painter* self, y1 = y + total_height; draw_rect.right--; draw_rect.bottom--; - flags = 0x03; /* 0x73; TEXT2_IMPLICIT_X and something else */ - DEBUG(("sending text order \ -font %d flags %d mixmode %d color1 %d color2 %d \ -clip left %d clip top %d clip right %d clip bottom %d \ -box left %d box top %d box right %d box bottom %d \ -x %d y %d len %d rect %d %d %d %d\n\r", - f, flags, 0, font->color, 0, x, y, x + total_width, - y + total_height, 0, 0, 0, 0, x1, y1, len, + flags = 0x03; /* 0x03 0x73; TEXT2_IMPLICIT_X and something else */ + DEBUG(("sending text order\n\r\ + font %d\n\r\ + flags %d\n\r\ + mixmode %d\n\r\ + color1 %d\n\r\ + color2 %d\n\r\ + clip box %d %d %d %d\n\r\ + box box %d %d %d %d\n\r\ + x %d\n\r\ + y %d\n\r\ + len %d\n\r\ + rect %d %d %d %d\n\r", + f, flags, 0, font->color, 0, x, y, + x + total_width, y + total_height, + 0, 0, 0, 0, x1, y1, len, draw_rect.left, draw_rect.top, draw_rect.right, draw_rect.bottom)); xrdp_orders_text(self->orders, f, flags, 0, font->color, 0, - x, y, x + total_width, y + total_height, + x - 1, y - 1, x + total_width, y + total_height, 0, 0, 0, 0, x1, y1, data, len * 2, &draw_rect); } diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index bd6e9e7e..efaa5a8d 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -546,6 +546,13 @@ int xrdp_wm_init(struct xrdp_wm* self) self->red = COLOR24(0xff, 0x00, 0x00); self->green = COLOR24(0x00, 0xff, 0x00); } + DEBUG(("sending cursor\n\r")); + xrdp_wm_load_pointer(self, "cursor1.cur", data, mask, &x, &y); + xrdp_wm_send_pointer(self, 1, data, mask, x, y); + DEBUG(("sending cursor\n\r")); + xrdp_wm_load_pointer(self, "cursor0.cur", data, mask, &x, &y); + xrdp_wm_send_pointer(self, 0, data, mask, x, y); + xrdp_login_wnd_create(self); /* clear screen */ self->screen->bg_color = self->black; @@ -553,10 +560,6 @@ int xrdp_wm_init(struct xrdp_wm* self) xrdp_wm_set_focused(self, self->login_window); - xrdp_wm_load_pointer(self, "cursor1.cur", data, mask, &x, &y); - xrdp_wm_send_pointer(self, 1, data, mask, x, y); - xrdp_wm_load_pointer(self, "cursor0.cur", data, mask, &x, &y); - xrdp_wm_send_pointer(self, 0, data, mask, x, y); #endif return 0; }