From 21f90e3ca288bacb6d6c69bf9d3b0f0d1aca977e Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sun, 7 Apr 2019 17:56:05 -0700 Subject: [PATCH] work on suppress --- libxrdp/xrdp_rdp.c | 14 ++++++++------ xrdp/xrdp.h | 3 +++ xrdp/xrdp_mm.c | 19 +++++++++++++++++++ xrdp/xrdp_types.h | 4 +++- xrdp/xrdp_wm.c | 5 +++++ xup/xup.c | 40 ++++++++++++++++++++++++++++++++++++++++ xup/xup.h | 4 +++- 7 files changed, 81 insertions(+), 8 deletions(-) diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c index d598d89b..319bac23 100644 --- a/libxrdp/xrdp_rdp.c +++ b/libxrdp/xrdp_rdp.c @@ -1218,8 +1218,6 @@ xrdp_rdp_process_suppress(struct xrdp_rdp *self, struct stream *s) int top; int right; int bottom; - int cx; - int cy; if (!s_check_rem(s, 1)) { @@ -1234,6 +1232,11 @@ xrdp_rdp_process_suppress(struct xrdp_rdp *self, struct stream *s) self->client_info.suppress_output = 1; g_writeln("xrdp_rdp_process_suppress: suppress_output %d", self->client_info.suppress_output); + if (self->session->callback != 0) + { + self->session->callback(self->session->id, 0x5559, 1, + 0, 0, 0); + } break; case 1: /* ALLOW_DISPLAY_UPDATES */ self->client_info.suppress_output = 0; @@ -1250,12 +1253,11 @@ xrdp_rdp_process_suppress(struct xrdp_rdp *self, struct stream *s) "left %d top %d right %d bottom %d", self->client_info.suppress_output, left, top, right, bottom); - cx = right - left; - cy = bottom - top; if (self->session->callback != 0) { - self->session->callback(self->session->id, 0x4444, - left, top, cx, cy); + self->session->callback(self->session->id, 0x5559, 0, + MAKELONG(left, top), + MAKELONG(right, bottom), 0); } break; } diff --git a/xrdp/xrdp.h b/xrdp/xrdp.h index 5ed46a3a..498dc141 100644 --- a/xrdp/xrdp.h +++ b/xrdp/xrdp.h @@ -371,6 +371,9 @@ xrdp_bitmap_compress(char* in_data, int width, int height, /* xrdp_mm.c */ int xrdp_mm_drdynvc_up(struct xrdp_mm* self); +int +xrdp_mm_suppress_output(struct xrdp_mm* self, int suppress, + int left, int top, int right, int bottom); struct xrdp_mm* xrdp_mm_create(struct xrdp_wm* owner); void diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 757620ac..96c6945c 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -999,6 +999,25 @@ xrdp_mm_drdynvc_up(struct xrdp_mm* self) return 0; } +/******************************************************************************/ +int +xrdp_mm_suppress_output(struct xrdp_mm* self, int suppress, + int left, int top, int right, int bottom) +{ + LLOGLN(0, ("xrdp_mm_suppress_output: suppress %d " + "left %d top %d right %d bottom %d", + suppress, left, top, right, bottom)); + if (self->mod != NULL) + { + if (self->mod->mod_suppress_output != NULL) + { + self->mod->mod_suppress_output(self->mod, suppress, + left, top, right, bottom); + } + } + return 0; +} + /*****************************************************************************/ /* open response from client going to channel server */ static int diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h index 7e416125..dc6db4bc 100644 --- a/xrdp/xrdp_types.h +++ b/xrdp/xrdp_types.h @@ -48,7 +48,9 @@ struct xrdp_mod tbus* write_objs, int* wcount, int* timeout); int (*mod_check_wait_objs)(struct xrdp_mod* v); int (*mod_frame_ack)(struct xrdp_mod* v, int flags, int frame_id); - tintptr mod_dumby[100 - 10]; /* align, 100 minus the number of mod + int (*mod_suppress_output)(struct xrdp_mod* v, int suppress, + int left, int top, int right, int bottom); + tintptr mod_dumby[100 - 11]; /* align, 100 minus the number of mod functions above */ /* server functions */ int (*server_begin_update)(struct xrdp_mod* v); diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index fd7b13b8..f68b11e9 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -1916,6 +1916,11 @@ callback(intptr_t id, int msg, intptr_t param1, intptr_t param2, case 0x5558: xrdp_mm_drdynvc_up(wm->mm); break; + case 0x5559: + xrdp_mm_suppress_output(wm->mm, param1, + LOWORD(param2), HIWORD(param2), + LOWORD(param3), HIWORD(param3)); + break; } return rv; } diff --git a/xup/xup.c b/xup/xup.c index 91eb0563..23722456 100644 --- a/xup/xup.c +++ b/xup/xup.c @@ -1143,6 +1143,33 @@ send_paint_rect_ex_ack(struct mod *mod, int flags, int frame_id) return 0; } +/******************************************************************************/ +/* return error */ +static int +send_suppress_output(struct mod *mod, int suppress, + int left, int top, int right, int bottom) +{ + int len; + struct stream *s; + + make_stream(s); + init_stream(s, 8192); + s_push_layer(s, iso_hdr, 4); + out_uint16_le(s, 108); + out_uint32_le(s, suppress); + out_uint32_le(s, left); + out_uint32_le(s, top); + out_uint32_le(s, right); + out_uint32_le(s, bottom); + s_mark_end(s); + len = (int)(s->end - s->data); + s_pop_layer(s, iso_hdr); + out_uint32_le(s, len); + lib_send_copy(mod, s); + free_stream(s); + return 0; +} + /******************************************************************************/ /* return error */ static int @@ -1556,6 +1583,18 @@ lib_mod_frame_ack(struct mod *amod, int flags, int frame_id) return 0; } +/******************************************************************************/ +/* return error */ +int +lib_mod_suppress_output(struct mod *amod, int suppress, + int left, int top, int right, int bottom) +{ + LLOGLN(10, ("lib_mod_suppress_output: suppress 0x%8.8x left %d top %d " + "right %d bottom %d", suppress, left, top, right, bottom)); + send_suppress_output(amod, suppress, left, top, right, bottom); + return 0; +} + /******************************************************************************/ tintptr EXPORT_CC mod_init(void) @@ -1575,6 +1614,7 @@ mod_init(void) mod->mod_get_wait_objs = lib_mod_get_wait_objs; mod->mod_check_wait_objs = lib_mod_check_wait_objs; mod->mod_frame_ack = lib_mod_frame_ack; + mod->mod_suppress_output = lib_mod_suppress_output; return (tintptr) mod; } diff --git a/xup/xup.h b/xup/xup.h index 3e5c8e8d..2a355769 100644 --- a/xup/xup.h +++ b/xup/xup.h @@ -45,7 +45,9 @@ struct mod tbus* write_objs, int* wcount, int* timeout); int (*mod_check_wait_objs)(struct mod* v); int (*mod_frame_ack)(struct mod* v, int flags, int frame_id); - tintptr mod_dumby[100 - 10]; /* align, 100 minus the number of mod + int (*mod_suppress_output)(struct mod* v, int suppress, + int left, int top, int right, int bottom); + tintptr mod_dumby[100 - 11]; /* align, 100 minus the number of mod functions above */ /* server functions */ int (*server_begin_update)(struct mod* v);