diff options
38 files changed, 353 insertions, 202 deletions
diff --git a/common/os_calls.c b/common/os_calls.c index c8044cba..07f378e5 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -1751,6 +1751,19 @@ g_strlen(const char *text) } /*****************************************************************************/ +/* locates char in text */ +char* APP_CC +g_strchr(const char* text, int c) +{ + if (text == NULL) + { + return 0; + } + + return strchr(text,c); +} + +/*****************************************************************************/ /* returns dest */ char *APP_CC g_strcpy(char *dest, const char *src) diff --git a/common/os_calls.h b/common/os_calls.h index 7ecc4699..d4b86365 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -172,6 +172,8 @@ g_file_get_size(const char* filename); int APP_CC g_strlen(const char* text); char* APP_CC +g_strchr(const char* text, int c); +char* APP_CC g_strcpy(char* dest, const char* src); char* APP_CC g_strncpy(char* dest, const char* src, int len); diff --git a/freerdp1/Makefile.am b/freerdp1/Makefile.am index 494e5c04..d1d49440 100644 --- a/freerdp1/Makefile.am +++ b/freerdp1/Makefile.am @@ -1,10 +1,18 @@ EXTRA_DIST = xrdp-freerdp.h +EXTRA_DEFINES = + +if XRDP_DEBUG +EXTRA_DEFINES += -DXRDP_DEBUG +else +EXTRA_DEFINES += -DXRDP_NODEBUG +endif AM_CFLAGS = \ -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \ -DXRDP_SBIN_PATH=\"${sbindir}\" \ -DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \ - -DXRDP_PID_PATH=\"${localstatedir}/run\" + -DXRDP_PID_PATH=\"${localstatedir}/run\" \ + $(EXTRA_DEFINES) INCLUDES = \ -I$(top_srcdir)/common \ diff --git a/freerdp1/xrdp-freerdp.c b/freerdp1/xrdp-freerdp.c index 25206f8e..f50e22fa 100644 --- a/freerdp1/xrdp-freerdp.c +++ b/freerdp1/xrdp-freerdp.c @@ -21,7 +21,12 @@ #include "xrdp-color.h" #include "xrdp_rail.h" -#define LOG_LEVEL 1 +#ifdef XRDP_DEBUG +#define LOG_LEVEL 99 +#else +#define LOG_LEVEL 0 +#endif + #define LLOG(_level, _args) \ do { if (_level < LOG_LEVEL) { g_write _args ; } } while (0) #define LLOGLN(_level, _args) \ @@ -43,15 +48,15 @@ lxrdp_start(struct mod *mod, int w, int h, int bpp) LLOGLN(10, ("lxrdp_start: w %d h %d bpp %d", w, h, bpp)); settings = mod->inst->settings; - settings->width = w; - settings->height = h; - settings->color_depth = bpp; + settings->DesktopWidth = w; + settings->DesktopHeight = h; + settings->ColorDepth = bpp; mod->bpp = bpp; - - settings->encryption = 1; - settings->tls_security = 1; - settings->nla_security = 0; - settings->rdp_security = 1; + // TODO what does this really become + settings->DisableEncryption = 1; // settings->encryption = 1; + settings->TlsSecurity = 1; + settings->NlaSecurity = 0; + settings->RdpSecurity = 1; return 0; } @@ -61,7 +66,7 @@ lxrdp_start(struct mod *mod, int w, int h, int bpp) static int DEFAULT_CC lxrdp_connect(struct mod *mod) { - boolean ok; + BOOL ok; LLOGLN(10, ("lxrdp_connect:")); @@ -81,7 +86,7 @@ lxrdp_connect(struct mod *mod) { if (strerror_r(connectErrorCode, buf, 128) != 0) { - snprintf(buf, 128, "Errorcode from connect : %d", connectErrorCode); + g_snprintf(buf, 128, "Errorcode from connect : %d", connectErrorCode); } } else @@ -89,40 +94,40 @@ lxrdp_connect(struct mod *mod) switch (connectErrorCode) { case PREECONNECTERROR: - snprintf(buf, 128, "The error code from connect is " + g_snprintf(buf, 128, "The error code from connect is " "PREECONNECTERROR"); break; case UNDEFINEDCONNECTERROR: - snprintf(buf, 128, "The error code from connect is " + g_snprintf(buf, 128, "The error code from connect is " "UNDEFINEDCONNECTERROR"); break; case POSTCONNECTERROR: - snprintf(buf, 128, "The error code from connect is " + g_snprintf(buf, 128, "The error code from connect is " "POSTCONNECTERROR"); break; case DNSERROR: - snprintf(buf, 128, "The DNS system generated an error"); + g_snprintf(buf, 128, "The DNS system generated an error"); break; case DNSNAMENOTFOUND: - snprintf(buf, 128, "The DNS system could not find the " + g_snprintf(buf, 128, "The DNS system could not find the " "specified name"); break; case CONNECTERROR: - snprintf(buf, 128, "A general connect error was returned"); + g_snprintf(buf, 128, "A general connect error was returned"); break; case MCSCONNECTINITIALERROR: - snprintf(buf, 128, "The error code from connect is " + g_snprintf(buf, 128, "The error code from connect is " "MCSCONNECTINITIALERROR"); break; case TLSCONNECTERROR: - snprintf(buf, 128, "Error in TLS handshake"); + g_snprintf(buf, 128, "Error in TLS handshake"); break; case AUTHENTICATIONERROR: - snprintf(buf, 128, "Authentication error check your password " + g_snprintf(buf, 128, "Authentication error check your password " "and username"); break; default: - snprintf(buf, 128, "Unhandled Errorcode from connect : %d", + g_snprintf(buf, 128, "Unhandled Errorcode from connect : %d", connectErrorCode); break; } @@ -237,7 +242,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2, rectangle->right = (((param2 >> 16) & 0xffff) + rectangle->left) - 1; rectangle->bottom = ((param2 & 0xffff) + rectangle->top) - 1; - if (mod->inst->settings->refresh_rect) + if (mod->inst->settings->RefreshRect) { if (mod->inst->update != NULL) { @@ -279,13 +284,13 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2, total_size = (int)param4; LLOGLN(10, ("lxrdp_event: client to server flags %d", flags)); - if ((chanid < 0) || (chanid >= mod->inst->settings->num_channels)) + if ((chanid < 0) || (chanid >= mod->inst->settings->ChannelDefArraySize)) { LLOGLN(0, ("lxrdp_event: error chanid %d", chanid)); break; } - lchid = mod->inst->settings->channels[chanid].channel_id; + lchid = mod->inst->settings->ChannelDefArray[chanid].ChannelId; switch (flags & 3) { @@ -375,18 +380,18 @@ lxrdp_set_param(struct mod *mod, char *name, char *value) LLOGLN(10, ("lxrdp_set_param: name [%s] value [%s]", name, value)); settings = mod->inst->settings; - LLOGLN(10, ("%p %d", settings->hostname, settings->encryption)); + LLOGLN(10, ("%p %d", settings->ServerHostname, settings->DisableEncryption)); if (g_strcmp(name, "hostname") == 0) { } else if (g_strcmp(name, "ip") == 0) { - settings->hostname = g_strdup(value); + settings->ServerHostname = g_strdup(value); } else if (g_strcmp(name, "port") == 0) { - settings->port = g_atoi(value); + settings->ServerPort = g_atoi(value); } else if (g_strcmp(name, "keylayout") == 0) { @@ -434,7 +439,7 @@ lxrdp_get_wait_objs(struct mod *mod, tbus *read_objs, int *rcount, { void **rfds; void **wfds; - boolean ok; + BOOL ok; LLOGLN(10, ("lxrdp_get_wait_objs:")); rfds = (void **)read_objs; @@ -454,7 +459,7 @@ lxrdp_get_wait_objs(struct mod *mod, tbus *read_objs, int *rcount, static int DEFAULT_CC lxrdp_check_wait_objs(struct mod *mod) { - boolean ok; + BOOL ok; LLOGLN(10, ("lxrdp_check_wait_objs:")); ok = freerdp_check_fds(mod->inst); @@ -539,7 +544,7 @@ lfreerdp_bitmap_update(rdpContext *context, BITMAP_UPDATE *bitmap) mod = ((struct mod_context *)context)->modi; LLOGLN(10, ("lfreerdp_bitmap_update: %d %d", bitmap->number, bitmap->count)); - server_bpp = mod->inst->settings->color_depth; + server_bpp = mod->inst->settings->ColorDepth; server_Bpp = (server_bpp + 7) / 8; client_bpp = mod->bpp; @@ -613,7 +618,7 @@ lfreerdp_pat_blt(rdpContext *context, PATBLT_ORDER *patblt) mod = ((struct mod_context *)context)->modi; LLOGLN(10, ("lfreerdp_pat_blt:")); - server_bpp = mod->inst->settings->color_depth; + server_bpp = mod->inst->settings->ColorDepth; client_bpp = mod->bpp; LLOGLN(0, ("lfreerdp_pat_blt: bpp %d %d", server_bpp, client_bpp)); @@ -681,7 +686,7 @@ lfreerdp_opaque_rect(rdpContext *context, OPAQUE_RECT_ORDER *opaque_rect) mod = ((struct mod_context *)context)->modi; LLOGLN(10, ("lfreerdp_opaque_rect:")); - server_bpp = mod->inst->settings->color_depth; + server_bpp = mod->inst->settings->ColorDepth; client_bpp = mod->bpp; fgcolor = convert_color(server_bpp, client_bpp, opaque_rect->color, mod->colormap); @@ -746,7 +751,7 @@ lfreerdp_glyph_index(rdpContext *context, GLYPH_INDEX_ORDER *glyph_index) mod = ((struct mod_context *)context)->modi; LLOGLN(10, ("lfreerdp_glyph_index:")); - server_bpp = mod->inst->settings->color_depth; + server_bpp = mod->inst->settings->ColorDepth; client_bpp = mod->bpp; fgcolor = convert_color(server_bpp, client_bpp, glyph_index->foreColor, mod->colormap); @@ -777,7 +782,7 @@ lfreerdp_line_to(rdpContext *context, LINE_TO_ORDER *line_to) mod = ((struct mod_context *)context)->modi; LLOGLN(10, ("lfreerdp_line_to:")); mod->server_set_opcode(mod, line_to->bRop2); - server_bpp = mod->inst->settings->color_depth; + server_bpp = mod->inst->settings->ColorDepth; client_bpp = mod->bpp; fgcolor = convert_color(server_bpp, client_bpp, line_to->penColor, mod->colormap); @@ -801,7 +806,7 @@ lfreerdp_cache_bitmap(rdpContext *context, CACHE_BITMAP_ORDER *cache_bitmap_orde /******************************************************************************/ /* Turn the bitmap upside down*/ static void DEFAULT_CC -lfreerdp_upsidedown(uint8 *destination, CACHE_BITMAP_V2_ORDER *cache_bitmap_v2_order, int server_Bpp) +lfreerdp_upsidedown(UINT8 *destination, CACHE_BITMAP_V2_ORDER *cache_bitmap_v2_order, int server_Bpp) { tui8 *src; tui8 *dst; @@ -872,7 +877,7 @@ lfreerdp_cache_bitmapV2(rdpContext *context, return; } - server_bpp = mod->inst->settings->color_depth; + server_bpp = mod->inst->settings->ColorDepth; server_Bpp = (server_bpp + 7) / 8; client_bpp = mod->bpp; @@ -926,13 +931,13 @@ lfreerdp_cache_glyph(rdpContext *context, CACHE_GLYPH_ORDER *cache_glyph_order) gd->cx, gd->cy)); mod->server_add_char(mod, cache_glyph_order->cacheId, gd->cacheIndex, gd->x, gd->y, gd->cx, gd->cy, (char *)(gd->aj)); - xfree(gd->aj); + free(gd->aj); gd->aj = 0; - xfree(gd); + free(gd); cache_glyph_order->glyphData[index] = 0; } - xfree(cache_glyph_order->unicodeCharacters); + free(cache_glyph_order->unicodeCharacters); cache_glyph_order->unicodeCharacters = 0; } @@ -995,7 +1000,7 @@ lfreerdp_cache_brush(rdpContext *context, CACHE_BRUSH_ORDER *cache_brush_order) LLOGLN(10, ("lfreerdp_cache_brush: out bpp %d cx %d cy %d idx %d bytes %d", bpp, cx, cy, idx, bytes)); - xfree(cache_brush_order->data); + free(cache_brush_order->data); cache_brush_order->data = 0; } @@ -1171,9 +1176,9 @@ lfreerdp_pointer_new(rdpContext *context, pointer_new->colorPtrAttr.height)); } - xfree(pointer_new->colorPtrAttr.xorMaskData); + free(pointer_new->colorPtrAttr.xorMaskData); pointer_new->colorPtrAttr.xorMaskData = 0; - xfree(pointer_new->colorPtrAttr.andMaskData); + free(pointer_new->colorPtrAttr.andMaskData); pointer_new->colorPtrAttr.andMaskData = 0; } @@ -1195,7 +1200,7 @@ lfreerdp_pointer_cached(rdpContext *context, } /******************************************************************************/ -static boolean DEFAULT_CC +static BOOL DEFAULT_CC lfreerdp_pre_connect(freerdp *instance) { struct mod *mod; @@ -1217,58 +1222,61 @@ lfreerdp_pre_connect(freerdp *instance) num_chans++; LLOGLN(10, ("lfreerdp_pre_connect: got channel [%s], flags [0x%8.8x]", ch_name, ch_flags)); - dst_ch_name = instance->settings->channels[index].name; + dst_ch_name = instance->settings->ChannelDefArray[index].Name; g_memset(dst_ch_name, 0, 8); g_snprintf(dst_ch_name, 8, "%s", ch_name); - instance->settings->channels[index].options = ch_flags; + instance->settings->ChannelDefArray[index].options = ch_flags; index++; error = mod->server_query_channel(mod, index, ch_name, &ch_flags); } - instance->settings->num_channels = num_chans; - - instance->settings->offscreen_bitmap_cache = false; - - instance->settings->glyph_cache = true; - instance->settings->glyphSupportLevel = GLYPH_SUPPORT_FULL; - instance->settings->order_support[NEG_GLYPH_INDEX_INDEX] = true; - instance->settings->order_support[NEG_FAST_GLYPH_INDEX] = false; - instance->settings->order_support[NEG_FAST_INDEX_INDEX] = false; - instance->settings->order_support[NEG_SCRBLT_INDEX] = true; - instance->settings->order_support[NEG_SAVEBITMAP_INDEX] = false; - - instance->settings->bitmap_cache = true; - instance->settings->order_support[NEG_MEMBLT_INDEX] = true; - instance->settings->order_support[NEG_MEMBLT_V2_INDEX] = true; - instance->settings->order_support[NEG_MEM3BLT_INDEX] = false; - instance->settings->order_support[NEG_MEM3BLT_V2_INDEX] = false; - instance->settings->bitmapCacheV2NumCells = 3; // 5; - instance->settings->bitmapCacheV2CellInfo[0].numEntries = 0x78; // 600; - instance->settings->bitmapCacheV2CellInfo[0].persistent = false; - instance->settings->bitmapCacheV2CellInfo[1].numEntries = 0x78; // 600; - instance->settings->bitmapCacheV2CellInfo[1].persistent = false; - instance->settings->bitmapCacheV2CellInfo[2].numEntries = 0x150; // 2048; - instance->settings->bitmapCacheV2CellInfo[2].persistent = false; - instance->settings->bitmapCacheV2CellInfo[3].numEntries = 0; // 4096; - instance->settings->bitmapCacheV2CellInfo[3].persistent = false; - instance->settings->bitmapCacheV2CellInfo[4].numEntries = 0; // 2048; - instance->settings->bitmapCacheV2CellInfo[4].persistent = false; - - instance->settings->order_support[NEG_MULTIDSTBLT_INDEX] = false; - instance->settings->order_support[NEG_MULTIPATBLT_INDEX] = false; - instance->settings->order_support[NEG_MULTISCRBLT_INDEX] = false; - instance->settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = false; - instance->settings->order_support[NEG_POLYLINE_INDEX] = false; - - instance->settings->username = g_strdup(mod->username); - instance->settings->password = g_strdup(mod->password); + instance->settings->ChannelCount = num_chans; + + // TODO + // instance->settings->offscreen_bitmap_cache = false; + instance->settings->OffscreenSupportLevel = 0; + + // TODO + //instance->settings->glyph_cache = true; + instance->settings->GlyphSupportLevel = GLYPH_SUPPORT_FULL; + instance->settings->OrderSupport[NEG_GLYPH_INDEX_INDEX] = TRUE; + instance->settings->OrderSupport[NEG_FAST_GLYPH_INDEX] = FALSE; + instance->settings->OrderSupport[NEG_FAST_INDEX_INDEX] = FALSE; + instance->settings->OrderSupport[NEG_SCRBLT_INDEX] = TRUE; + instance->settings->OrderSupport[NEG_SAVEBITMAP_INDEX] = FALSE; + + instance->settings->BitmapCacheEnabled = TRUE; + instance->settings->OrderSupport[NEG_MEMBLT_INDEX] = TRUE; + instance->settings->OrderSupport[NEG_MEMBLT_V2_INDEX] = TRUE; + instance->settings->OrderSupport[NEG_MEM3BLT_INDEX] = FALSE; + instance->settings->OrderSupport[NEG_MEM3BLT_V2_INDEX] = FALSE; + instance->settings->BitmapCacheV2NumCells = 3; // 5; + instance->settings->BitmapCacheV2CellInfo[0].numEntries = 0x78; // 600; + instance->settings->BitmapCacheV2CellInfo[0].persistent = FALSE; + instance->settings->BitmapCacheV2CellInfo[1].numEntries = 0x78; // 600; + instance->settings->BitmapCacheV2CellInfo[1].persistent = FALSE; + instance->settings->BitmapCacheV2CellInfo[2].numEntries = 0x150; // 2048; + instance->settings->BitmapCacheV2CellInfo[2].persistent = FALSE; + instance->settings->BitmapCacheV2CellInfo[3].numEntries = 0; // 4096; + instance->settings->BitmapCacheV2CellInfo[3].persistent = FALSE; + instance->settings->BitmapCacheV2CellInfo[4].numEntries = 0; // 2048; + instance->settings->BitmapCacheV2CellInfo[4].persistent = FALSE; + + instance->settings->OrderSupport[NEG_MULTIDSTBLT_INDEX] = FALSE; + instance->settings->OrderSupport[NEG_MULTIPATBLT_INDEX] = FALSE; + instance->settings->OrderSupport[NEG_MULTISCRBLT_INDEX] = FALSE; + instance->settings->OrderSupport[NEG_MULTIOPAQUERECT_INDEX] = FALSE; + instance->settings->OrderSupport[NEG_POLYLINE_INDEX] = FALSE; + + instance->settings->Username = g_strdup(mod->username); + instance->settings->Password = g_strdup(mod->password); if (mod->client_info.rail_support_level > 0) { - instance->settings->remote_app = true; - instance->settings->rail_langbar_supported = true; - instance->settings->workarea = true; - instance->settings->performance_flags = PERF_DISABLE_WALLPAPER | PERF_DISABLE_FULLWINDOWDRAG; + instance->settings->RemoteApplicationMode = TRUE; + instance->settings->RemoteAppLanguageBarSupported = TRUE; + instance->settings->Workarea = TRUE; + instance->settings->PerformanceFlags = PERF_DISABLE_WALLPAPER | PERF_DISABLE_FULLWINDOWDRAG; } // here @@ -1301,14 +1309,14 @@ lfreerdp_pre_connect(freerdp *instance) if ((mod->username[0] != 0) && (mod->password[0] != 0)) { /* since we have username and password, we can try nla */ - instance->settings->nla_security = 1; + instance->settings->NlaSecurity = 1; } else { - instance->settings->nla_security = 0; + instance->settings->NlaSecurity = 0; } - return true; + return TRUE; } /*****************************************************************************/ @@ -1319,10 +1327,8 @@ lrail_WindowCreate(rdpContext *context, WINDOW_ORDER_INFO *orderInfo, int index; struct mod *mod; struct rail_window_state_order wso; - UNICONV *uniconv; LLOGLN(0, ("llrail_WindowCreate:")); - uniconv = freerdp_uniconv_new(); mod = ((struct mod_context *)context)->modi; memset(&wso, 0, sizeof(wso)); /* copy the window state order */ @@ -1333,8 +1339,7 @@ lrail_WindowCreate(rdpContext *context, WINDOW_ORDER_INFO *orderInfo, if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TITLE) { - wso.title_info = freerdp_uniconv_in(uniconv, - window_state->titleInfo.string, window_state->titleInfo.length); + freerdp_UnicodeToAsciiAlloc(window_state->titleInfo.string, &wso.title_info, window_state->titleInfo.length / 2); } LLOGLN(0, ("lrail_WindowCreate: %s", wso.title_info)); @@ -1387,10 +1392,9 @@ lrail_WindowCreate(rdpContext *context, WINDOW_ORDER_INFO *orderInfo, mod->server_window_new_update(mod, orderInfo->windowId, &wso, orderInfo->fieldFlags); - xfree(wso.title_info); + free(wso.title_info); g_free(wso.window_rects); g_free(wso.visibility_rects); - freerdp_uniconv_free(uniconv); } /*****************************************************************************/ @@ -1461,11 +1465,8 @@ lrail_NotifyIconCreate(rdpContext *context, WINDOW_ORDER_INFO *orderInfo, { struct mod *mod; struct rail_notify_state_order rnso; - UNICONV *uniconv; - LLOGLN(0, ("lrail_NotifyIconCreate:")); - uniconv = freerdp_uniconv_new(); mod = ((struct mod_context *)context)->modi; @@ -1474,20 +1475,18 @@ lrail_NotifyIconCreate(rdpContext *context, WINDOW_ORDER_INFO *orderInfo, 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); + freerdp_UnicodeToAsciiAlloc(notify_icon_state->toolTip.string, + &rnso.tool_tip, notify_icon_state->toolTip.length / 2); } 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); + freerdp_UnicodeToAsciiAlloc(notify_icon_state->infoTip.text.string, + &rnso.infotip.text, notify_icon_state->infoTip.text.length / 2); + freerdp_UnicodeToAsciiAlloc(notify_icon_state->infoTip.title.string, + &rnso.infotip.title, notify_icon_state->infoTip.title.length / 2); } rnso.state = notify_icon_state->state; @@ -1508,11 +1507,9 @@ lrail_NotifyIconCreate(rdpContext *context, WINDOW_ORDER_INFO *orderInfo, orderInfo->notifyIconId, &rnso, orderInfo->fieldFlags); - xfree(rnso.tool_tip); - xfree(rnso.infotip.text); - xfree(rnso.infotip.title); - freerdp_uniconv_free(uniconv); - + free(rnso.tool_tip); + free(rnso.infotip.text); + free(rnso.infotip.title); } /*****************************************************************************/ @@ -1582,7 +1579,7 @@ lrail_NonMonitoredDesktop(rdpContext *context, WINDOW_ORDER_INFO *orderInfo) } /******************************************************************************/ -static boolean DEFAULT_CC +static BOOL DEFAULT_CC lfreerdp_post_connect(freerdp *instance) { struct mod *mod; @@ -1602,7 +1599,7 @@ lfreerdp_post_connect(freerdp *instance) mod->inst->update->window->MonitoredDesktop = lrail_MonitoredDesktop; mod->inst->update->window->NonMonitoredDesktop = lrail_NonMonitoredDesktop; - return true; + return TRUE; } /******************************************************************************/ @@ -1621,7 +1618,7 @@ lfreerdp_context_free(freerdp *instance, rdpContext *context) /******************************************************************************/ static int DEFAULT_CC -lfreerdp_receive_channel_data(freerdp *instance, int channelId, uint8 *data, +lfreerdp_receive_channel_data(freerdp *instance, int channelId, UINT8 *data, int size, int flags, int total_size) { struct mod *mod; @@ -1632,9 +1629,9 @@ lfreerdp_receive_channel_data(freerdp *instance, int channelId, uint8 *data, mod = ((struct mod_context *)(instance->context))->modi; lchid = -1; - for (index = 0; index < instance->settings->num_channels; index++) + for (index = 0; index < instance->settings->ChannelDefArraySize; index++) { - if (instance->settings->channels[index].channel_id == channelId) + if (instance->settings->ChannelDefArray[index].ChannelId == channelId) { lchid = index; break; @@ -1661,21 +1658,21 @@ lfreerdp_receive_channel_data(freerdp *instance, int channelId, uint8 *data, } /******************************************************************************/ -static boolean DEFAULT_CC +static BOOL DEFAULT_CC lfreerdp_authenticate(freerdp *instance, char **username, char **password, char **domain) { LLOGLN(0, ("lfreerdp_authenticate:")); - return true; + return TRUE; } /******************************************************************************/ -static boolean DEFAULT_CC +static BOOL DEFAULT_CC lfreerdp_verify_certificate(freerdp *instance, char *subject, char *issuer, char *fingerprint) { LLOGLN(0, ("lfreerdp_verify_certificate:")); - return true; + return TRUE; } /******************************************************************************/ diff --git a/freerdp1/xrdp-freerdp.h b/freerdp1/xrdp-freerdp.h index 9ea0bcb0..1022e21d 100644 --- a/freerdp1/xrdp-freerdp.h +++ b/freerdp1/xrdp-freerdp.h @@ -30,7 +30,7 @@ #include <freerdp/rail.h> #include <freerdp/rail/rail.h> #include <freerdp/codec/bitmap.h> -#include <freerdp/utils/memory.h> +//#include <freerdp/utils/memory.h> //#include "/home/jay/git/jsorg71/staging/include/freerdp/freerdp.h" struct bitmap_item diff --git a/libxrdp/Makefile.am b/libxrdp/Makefile.am index 11d1d836..0bf6f2e2 100644 --- a/libxrdp/Makefile.am +++ b/libxrdp/Makefile.am @@ -13,7 +13,7 @@ endif if XRDP_FREERDP1 EXTRA_DEFINES += -DXRDP_FREERDP1 -EXTRA_LIBS += -lfreerdp-codec -lfreerdp-utils +EXTRA_LIBS += $(FREERDP_LIBS) endif if XRDP_JPEG diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c index a391b93b..d4c9d372 100644 --- a/libxrdp/libxrdp.c +++ b/libxrdp/libxrdp.c @@ -744,6 +744,7 @@ libxrdp_query_channel(struct xrdp_session *session, int index, if (index < 0 || index >= count) { + DEBUG(("libxrdp_query_channel - Channel out of range %d", index)); return 1; } @@ -760,6 +761,7 @@ libxrdp_query_channel(struct xrdp_session *session, int index, if (channel_name != 0) { g_strncpy(channel_name, channel_item->name, 8); + DEBUG(("libxrdp_query_channel - Channel %d name %s", index, channel_name)); } if (channel_flags != 0) diff --git a/libxrdp/xrdp_mcs.c b/libxrdp/xrdp_mcs.c index a2793960..77c0d10d 100644 --- a/libxrdp/xrdp_mcs.c +++ b/libxrdp/xrdp_mcs.c @@ -144,9 +144,9 @@ xrdp_mcs_recv(struct xrdp_mcs *self, struct stream *s, int *chan) /* this is channels getting added from the client */ if (appid == MCS_CJRQ) { - g_writeln("channel join request received"); in_uint16_be(s, userid); in_uint16_be(s, chanid); + g_writeln("channel join request received %d:%d", userid, chanid); DEBUG(("xrdp_mcs_recv adding channel %4.4x", chanid)); if (xrdp_mcs_send_cjcf(self, userid, chanid) != 0) diff --git a/libxrdp/xrdp_orders.c b/libxrdp/xrdp_orders.c index a76ecaea..bb95aa71 100644 --- a/libxrdp/xrdp_orders.c +++ b/libxrdp/xrdp_orders.c @@ -2449,6 +2449,7 @@ xrdp_orders_send_create_os_surface(struct xrdp_orders *self, int id, order_flags |= 1 << 2; /* type RDP_ORDER_ALTSEC_CREATE_OFFSCR_BITMAP */ out_uint8(self->out_s, order_flags); cache_id = id & 0x7fff; + LLOGLN(10, ("xrdp_orders_send_create_os_surface: cache_id %d", cache_id)); flags = cache_id; if (num_del_list > 0) diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c index bf0f8f4e..44a7ac57 100644 --- a/libxrdp/xrdp_rdp.c +++ b/libxrdp/xrdp_rdp.c @@ -77,12 +77,14 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info) values = list_create(); values->auto_free = 1; g_snprintf(cfg_file, 255, "%s/xrdp.ini", XRDP_CFG_PATH); + DEBUG(("cfg_file %s", cfg_file)); file_by_name_read_section(cfg_file, "globals", items, values); for (index = 0; index < items->count; index++) { item = (char *)list_get_item(items, index); value = (char *)list_get_item(values, index); + DEBUG(("item %s value %s", item, value)); if (g_strcasecmp(item, "bitmap_cache") == 0) { @@ -193,7 +195,7 @@ xrdp_rdp_detect_cpu(void) if (edx & (1 << 26)) { - DEBUG("SSE2 detected"); + DEBUG(("SSE2 detected")); cpu_opt |= CPU_SSE2; } @@ -452,7 +454,7 @@ xrdp_rdp_send_data(struct xrdp_rdp *self, struct stream *s, } else { - g_writeln("mppc_encode not ok"); + g_writeln("mppc_encode not ok: type %d flags %d", mppc_enc->protocol_type, mppc_enc->flags); } } diff --git a/rdp/Makefile.am b/rdp/Makefile.am index 6f698d29..9b519d7c 100644 --- a/rdp/Makefile.am +++ b/rdp/Makefile.am @@ -1,10 +1,18 @@ EXTRA_DIST = rdp.h +EXTRA_DEFINES = + +if XRDP_DEBUG +EXTRA_DEFINES += -DXRDP_DEBUG +else +EXTRA_DEFINES += -DXRDP_NODEBUG +endif AM_CFLAGS = \ -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \ -DXRDP_SBIN_PATH=\"${sbindir}\" \ -DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \ - -DXRDP_PID_PATH=\"${localstatedir}/run\" + -DXRDP_PID_PATH=\"${localstatedir}/run\" \ + $(EXTRA_DEFINES) INCLUDES = \ -I$(top_srcdir)/common diff --git a/xorg/X11R7.6/rdp/rdp.h b/xorg/X11R7.6/rdp/rdp.h index 572bc6f4..57de4432 100644 --- a/xorg/X11R7.6/rdp/rdp.h +++ b/xorg/X11R7.6/rdp/rdp.h @@ -256,7 +256,6 @@ struct _rdpPixmapRec { int status; int rdpindex; - int allocBytes; int con_number; int is_dirty; int pad0; @@ -338,7 +337,7 @@ draw_item_remove(rdpPixmapRec* priv, struct rdp_draw_item* di); int draw_item_remove_all(rdpPixmapRec* priv); int -draw_item_pack(rdpPixmapRec* priv); +draw_item_pack(PixmapPtr pix, rdpPixmapRec* priv); int draw_item_add_img_region(rdpPixmapRec* priv, RegionPtr reg, int opcode, int type); @@ -359,7 +358,8 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint); Bool rdpDestroyPixmap(PixmapPtr pPixmap); - +int +xrdp_is_os(PixmapPtr pix, rdpPixmapPtr priv); Bool rdpCreateWindow(WindowPtr pWindow); Bool @@ -420,7 +420,6 @@ rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists, GlyphPtr* glyphs); - /* rdpinput.c */ int rdpKeybdProc(DeviceIntPtr pDevice, int onoff); diff --git a/xorg/X11R7.6/rdp/rdpCopyArea.c b/xorg/X11R7.6/rdp/rdpCopyArea.c index e064cd0f..0a5e5206 100644 --- a/xorg/X11R7.6/rdp/rdpCopyArea.c +++ b/xorg/X11R7.6/rdp/rdpCopyArea.c @@ -403,7 +403,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, pDstPixmap = (PixmapPtr)pDst; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { can_do_screen_blt = pGC->alu == GXcopy; @@ -423,7 +423,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, pSrcPixmap = (PixmapPtr)pSrc; pSrcPriv = GETPIXPRIV(pSrcPixmap); - if (XRDP_IS_OS(pSrcPriv)) + if (xrdp_is_os(pSrcPixmap, pSrcPriv)) { if (pDst->type == DRAWABLE_WINDOW) { @@ -442,7 +442,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, pDstPixmap = (PixmapPtr)pDst; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { if (g_can_do_pix_to_pix) { @@ -472,7 +472,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, pDstPixmap = (PixmapPtr)pDst; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpCopyPlane.c b/xorg/X11R7.6/rdp/rdpCopyPlane.c index 42e3f4f8..7ac5d263 100644 --- a/xorg/X11R7.6/rdp/rdpCopyPlane.c +++ b/xorg/X11R7.6/rdp/rdpCopyPlane.c @@ -105,7 +105,7 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, pDstPixmap = (PixmapPtr)pDst; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpFillPolygon.c b/xorg/X11R7.6/rdp/rdpFillPolygon.c index 11664ae3..e703ad03 100644 --- a/xorg/X11R7.6/rdp/rdpFillPolygon.c +++ b/xorg/X11R7.6/rdp/rdpFillPolygon.c @@ -144,7 +144,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC, pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpFillSpans.c b/xorg/X11R7.6/rdp/rdpFillSpans.c index b5a13a13..9b719bb4 100644 --- a/xorg/X11R7.6/rdp/rdpFillSpans.c +++ b/xorg/X11R7.6/rdp/rdpFillSpans.c @@ -80,7 +80,7 @@ rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit, pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); diff --git a/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c b/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c index a46475e0..7a938e93 100644 --- a/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c +++ b/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c @@ -102,7 +102,7 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpImageText16.c b/xorg/X11R7.6/rdp/rdpImageText16.c index 4e204421..61a34438 100644 --- a/xorg/X11R7.6/rdp/rdpImageText16.c +++ b/xorg/X11R7.6/rdp/rdpImageText16.c @@ -100,7 +100,7 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpImageText8.c b/xorg/X11R7.6/rdp/rdpImageText8.c index 2c4bbf6d..e714773f 100644 --- a/xorg/X11R7.6/rdp/rdpImageText8.c +++ b/xorg/X11R7.6/rdp/rdpImageText8.c @@ -100,7 +100,7 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpPolyArc.c b/xorg/X11R7.6/rdp/rdpPolyArc.c index aed23410..965fa170 100644 --- a/xorg/X11R7.6/rdp/rdpPolyArc.c +++ b/xorg/X11R7.6/rdp/rdpPolyArc.c @@ -119,7 +119,7 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpPolyFillArc.c b/xorg/X11R7.6/rdp/rdpPolyFillArc.c index 3941cb50..9bbceb68 100644 --- a/xorg/X11R7.6/rdp/rdpPolyFillArc.c +++ b/xorg/X11R7.6/rdp/rdpPolyFillArc.c @@ -119,7 +119,7 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpPolyFillRect.c b/xorg/X11R7.6/rdp/rdpPolyFillRect.c index d1c50e1f..6bbc34ab 100644 --- a/xorg/X11R7.6/rdp/rdpPolyFillRect.c +++ b/xorg/X11R7.6/rdp/rdpPolyFillRect.c @@ -99,7 +99,7 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c b/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c index 505c67eb..825a29ef 100644 --- a/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c +++ b/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c @@ -102,7 +102,7 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpPolyPoint.c b/xorg/X11R7.6/rdp/rdpPolyPoint.c index 7c65b602..46eb926b 100644 --- a/xorg/X11R7.6/rdp/rdpPolyPoint.c +++ b/xorg/X11R7.6/rdp/rdpPolyPoint.c @@ -150,7 +150,7 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpPolyRectangle.c b/xorg/X11R7.6/rdp/rdpPolyRectangle.c index 8de1e43f..9dd5ad8a 100644 --- a/xorg/X11R7.6/rdp/rdpPolyRectangle.c +++ b/xorg/X11R7.6/rdp/rdpPolyRectangle.c @@ -112,7 +112,7 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpPolySegment.c b/xorg/X11R7.6/rdp/rdpPolySegment.c index 7f9e5080..85b316f3 100644 --- a/xorg/X11R7.6/rdp/rdpPolySegment.c +++ b/xorg/X11R7.6/rdp/rdpPolySegment.c @@ -109,7 +109,7 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs) pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpPolyText16.c b/xorg/X11R7.6/rdp/rdpPolyText16.c index 6a2ac476..c2c31dbd 100644 --- a/xorg/X11R7.6/rdp/rdpPolyText16.c +++ b/xorg/X11R7.6/rdp/rdpPolyText16.c @@ -103,7 +103,7 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpPolyText8.c b/xorg/X11R7.6/rdp/rdpPolyText8.c index 4dbf1e8a..99b0a045 100644 --- a/xorg/X11R7.6/rdp/rdpPolyText8.c +++ b/xorg/X11R7.6/rdp/rdpPolyText8.c @@ -103,7 +103,7 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpPolylines.c b/xorg/X11R7.6/rdp/rdpPolylines.c index 8e05ea57..92b51a71 100644 --- a/xorg/X11R7.6/rdp/rdpPolylines.c +++ b/xorg/X11R7.6/rdp/rdpPolylines.c @@ -160,7 +160,7 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpPushPixels.c b/xorg/X11R7.6/rdp/rdpPushPixels.c index 24dc9084..c9458bff 100644 --- a/xorg/X11R7.6/rdp/rdpPushPixels.c +++ b/xorg/X11R7.6/rdp/rdpPushPixels.c @@ -96,7 +96,7 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, pDstPixmap = (PixmapPtr)pDst; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpPutImage.c b/xorg/X11R7.6/rdp/rdpPutImage.c index 2b17695b..4f3764d9 100644 --- a/xorg/X11R7.6/rdp/rdpPutImage.c +++ b/xorg/X11R7.6/rdp/rdpPutImage.c @@ -98,7 +98,7 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, pDstPixmap = (PixmapPtr)pDst; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpSetSpans.c b/xorg/X11R7.6/rdp/rdpSetSpans.c index ae0a0d42..101a2d6b 100644 --- a/xorg/X11R7.6/rdp/rdpSetSpans.c +++ b/xorg/X11R7.6/rdp/rdpSetSpans.c @@ -89,7 +89,7 @@ rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc, pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpdraw.c b/xorg/X11R7.6/rdp/rdpdraw.c index 4843ff21..9734607a 100644 --- a/xorg/X11R7.6/rdp/rdpdraw.c +++ b/xorg/X11R7.6/rdp/rdpdraw.c @@ -482,7 +482,7 @@ draw_item_remove_all(rdpPixmapRec *priv) /******************************************************************************/ int -draw_item_pack(rdpPixmapRec *priv) +draw_item_pack(PixmapPtr pix, rdpPixmapRec *priv) { struct rdp_draw_item *di; struct rdp_draw_item *di_prev; @@ -685,20 +685,6 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint); priv = GETPIXPRIV(rv); priv->rdpindex = -1; - - if ((rv->drawable.depth >= g_rdpScreen.depth) && - (org_width > 1) && (height > 1)) - { - priv->allocBytes = width * height * g_Bpp; - priv->rdpindex = rdpup_add_os_bitmap(rv, priv); - - if (priv->rdpindex >= 0) - { - priv->status = 1; - rdpup_create_os_surface(priv->rdpindex, width, height); - } - } - pScreen->ModifyPixmapHeader(rv, org_width, 0, 0, 0, 0, 0); pScreen->CreatePixmap = rdpCreatePixmap; return rv; @@ -735,6 +721,59 @@ rdpDestroyPixmap(PixmapPtr pPixmap) return rv; } +/*****************************************************************************/ +int +xrdp_is_os(PixmapPtr pix, rdpPixmapPtr priv) +{ + RegionRec reg1; + BoxRec box; + int width; + int height; + struct image_data id; + + if (priv->status == 0) + { + width = pix->drawable.width; + height = pix->drawable.height; + if ((pix->drawable.depth >= g_rdpScreen.depth) && + (width > 1) && (height > 1)) + { + width = (width + 3) & ~3; + priv->rdpindex = rdpup_add_os_bitmap(pix, priv); + if (priv->rdpindex >= 0) + { + priv->status = 1; + rdpup_create_os_surface(priv->rdpindex, width, height); + box.x1 = 0; + box.y1 = 0; + box.x2 = width; + box.y2 = height; + if (g_do_dirty_os) + { + draw_item_remove_all(priv); + RegionInit(®1, &box, 0); + draw_item_add_img_region(priv, ®1, GXcopy, RDI_IMGLL); + RegionUninit(®1); + priv->is_dirty = 1; + } + else + { + rdpup_get_pixmap_image_rect(pix, &id); + rdpup_switch_os_surface(priv->rdpindex); + rdpup_begin_update(); + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, + box.y2 - box.y1); + rdpup_end_update(); + rdpup_switch_os_surface(-1); + } + return 1; + } + } + return 0; + } + return 1; +} + /******************************************************************************/ Bool rdpCreateWindow(WindowPtr pWindow) @@ -831,8 +870,8 @@ rdpRealizeWindow(WindowPtr pWindow) LLOGLN(10, ("rdpRealizeWindow:")); LLOGLN(10, (" pWindow %p id 0x%x pWindow->parent %p id 0x%x x %d " "y %d width %d height %d", - pWindow, pWindow->drawable.id, - pWindow->parent, pWindow->parent->drawable.id, + pWindow, (int)(pWindow->drawable.id), + pWindow->parent, (int)(pWindow->parent->drawable.id), pWindow->drawable.x, pWindow->drawable.y, pWindow->drawable.width, pWindow->drawable.height)); priv->status = 1; @@ -1223,7 +1262,7 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, pDstPixmap = (PixmapPtr)p; pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) + if (xrdp_is_os(pDstPixmap, pDstPriv)) { post_process = 1; diff --git a/xorg/X11R7.6/rdp/rdpup.c b/xorg/X11R7.6/rdp/rdpup.c index 49cc55ee..c2eafe27 100644 --- a/xorg/X11R7.6/rdp/rdpup.c +++ b/xorg/X11R7.6/rdp/rdpup.c @@ -137,6 +137,7 @@ rdpup_disconnect(void) g_sck_closed = 1; g_pixmap_byte_total = 0; g_pixmap_num_used = 0; + g_rdpindex = -1; if (g_max_os_bitmaps > 0) { @@ -1833,7 +1834,7 @@ rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec *pDirtyPriv) rdpup_switch_os_surface(pDirtyPriv->rdpindex); rdpup_get_pixmap_image_rect(pDirtyPixmap, &id); rdpup_begin_update(); - draw_item_pack(pDirtyPriv); + draw_item_pack(pDirtyPixmap, pDirtyPriv); di = pDirtyPriv->draw_item_head; while (di != 0) @@ -1958,7 +1959,7 @@ rdpup_check_dirty_screen(rdpPixmapRec *pDirtyPriv) LLOGLN(10, ("-----------------got dirty")); rdpup_get_screen_image_rect(&id); rdpup_begin_update(); - draw_item_pack(pDirtyPriv); + draw_item_pack(0, pDirtyPriv); di = pDirtyPriv->draw_item_head; while (di != 0) diff --git a/xrdp/xrdp.c b/xrdp/xrdp.c index 0da7a101..fb6fd5dd 100644 --- a/xrdp/xrdp.c +++ b/xrdp/xrdp.c @@ -305,6 +305,12 @@ main(int argc, char **argv) g_init("xrdp"); ssl_init(); + + for (test=0;test<argc; test++) + { + DEBUG(("Argument %i - %s",test,argv[test])); + } + /* check compiled endian with actual endian */ test = 1; host_be = !((int)(*(unsigned char *)(&test))); diff --git a/xrdp/xrdp.ini b/xrdp/xrdp.ini index 58daa6af..6ee1d9c3 100644 --- a/xrdp/xrdp.ini +++ b/xrdp/xrdp.ini @@ -102,3 +102,10 @@ port=ask3389 username=ask password=ask +channel.rdpdr=true +channel.rdpsnd=true +channel.drdynvc=true +channel.cliprdr=true +channel.rail=true +channel.xrdpvr=true + diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index e13854ae..9b0de186 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -1932,6 +1932,7 @@ server_reset(struct xrdp_mod *mod, int width, int height, int bpp) xrdp_wm_load_static_pointers(wm); return 0; } + /* read the channel section of the ini file into lists * return 1 on success 0 on failure */ int read_allowed_channel_names(struct list *names, struct list *values) @@ -1960,44 +1961,90 @@ int read_allowed_channel_names(struct list *names, struct list *values) } g_file_close(fd); - return ret; } + return ret; +} + +#define CHANNEL_NAME_PREFIX "channel." +/* update the channel lists from connection specific overrides + * return 1 on success 0 on failure */ +int update_allowed_channel_names(struct xrdp_wm *wm, struct list *names, struct list *values) +{ + int ret = 1; + int index; + int oldindex; + char *val; + char *name; + //wm->mm->login_names,wm->mm->login_values + for (index = 0; index < wm->mm->login_names->count; index++) + { + name = (char *)list_get_item(wm->mm->login_names, index); + if ( (name != 0) && (g_strncmp( name, CHANNEL_NAME_PREFIX, g_strlen(CHANNEL_NAME_PREFIX)) == 0 ) ) + { + name += g_strlen(CHANNEL_NAME_PREFIX); + // locate and remove from list + oldindex = find_name_in_lists(name, names); + if (oldindex >= 0) + { + list_remove_item(names, oldindex); + list_remove_item(values, oldindex); + } + val = (char *)list_get_item(wm->mm->login_values, index); + // (re)add to lists + list_add_item(names, (tbus)g_strdup(name)); + list_add_item(values, (tbus)g_strdup(val)); + } + } + return ret; +} + +/* internal function return -1 if name is not in list + * otherwise return the index 0->count-1*/ +int DEFAULT_CC +find_name_in_lists(char *inName, struct list *names) +{ + int reply = -1; /*means not in the list*/ + int index; + char *name; + + for (index = 0; index < names->count; index++) + { + name = (char *)list_get_item(names, index); + if ( (name != 0) && g_strncmp(name, inName, MAX_CHANNEL_NAME)) + { + reply = index; + break; /* stop loop - item found*/ + } + } + + return reply; } + /* internal function return 1 if name is in list of channels * and if the value is allowed */ int DEFAULT_CC -is_name_in_lists(char *inName, struct list *names, struct list *values) +is_channel_enabled(char *inName, struct list *names, struct list *values) { int reply = 0; /*means not in the list*/ int index; char *val; char *name; - for (index = 0; index < names->count; index++) + index = find_name_in_lists(inName, names); + if ( index >= 0 ) { - name = (char *)list_get_item(names, index); + val = (char *)list_get_item(values, index); - if (name != 0) + if ((g_strcasecmp(val, "yes") == 0) || + (g_strcasecmp(val, "on") == 0) || + (g_strcasecmp(val, "true") == 0) || + (g_atoi(val) != 0)) { - /* ex rdpdr ;rdpsnd ; drdynvc ; cliprdr */ - if (!g_strncmp(name, inName, MAX_CHANNEL_NAME)) - { - val = (char *)list_get_item(values, index); - - if ((g_strcasecmp(val, "yes") == 0) || - (g_strcasecmp(val, "on") == 0) || - (g_strcasecmp(val, "true") == 0) || - (g_atoi(val) != 0)) - { - reply = 1; - } - else - { - g_writeln("This channel is disabled: %s", name); - } - - break; /* stop loop - item found*/ - } + reply = 1; + } + else + { + g_writeln("This channel is disabled: %s", name); } } @@ -2026,7 +2073,8 @@ void init_channel_allowed(struct xrdp_wm *wm) names = list_create(); values = list_create(); - if (read_allowed_channel_names(names, values)) + if ( read_allowed_channel_names(names, values) + && update_allowed_channel_names(wm, names, values) ) { do { @@ -2036,9 +2084,9 @@ void init_channel_allowed(struct xrdp_wm *wm) if (error == 0) { /* examples of channel names: rdpdr ; rdpsnd ; drdynvc ; cliprdr */ - if (is_name_in_lists(channelname, names, values)) + if (is_channel_enabled(channelname, names, values)) { - g_writeln("The following channel is allowed: %s", channelname); + g_writeln("The following channel is allowed: %s (%d)", channelname, index); wm->allowedchannels[allowindex] = index; allowindex++; @@ -2050,7 +2098,7 @@ void init_channel_allowed(struct xrdp_wm *wm) } else { - g_writeln("The following channel is not allowed: %s", channelname); + g_writeln("The following channel is not allowed: %s (%d)", channelname, index); } index++; diff --git a/xrdp/xrdp_painter.c b/xrdp/xrdp_painter.c index 0b867089..8ba33825 100644 --- a/xrdp/xrdp_painter.c +++ b/xrdp/xrdp_painter.c @@ -708,6 +708,8 @@ xrdp_painter_copy(struct xrdp_painter *self, int dsty; int w; int h; + int index; + struct list *del_list; if (self == 0 || src == 0 || dst == 0) { @@ -781,6 +783,22 @@ xrdp_painter_copy(struct xrdp_painter *self, cache_id = 255; // todo cache_idx = src->item_index; // todo + if (src->tab_stop == 0) + { + g_writeln("xrdp_painter_copy: warning src not created"); + del_list = self->wm->cache->xrdp_os_del_list; + index = list_index_of(del_list, cache_idx); + list_remove_item(del_list, index); + libxrdp_orders_send_create_os_surface(self->session, + cache_idx, + src->width, + src->height, + del_list); + src->tab_stop = 1; + list_clear(del_list); + } + + k = 0; while (xrdp_region_get_rect(region, k, &rect1) == 0) |