/******************************************************************************/ int EXPORT_CC
libxrdp_process_incoming(struct xrdp_session *session)
{ int rv;
/******************************************************************************/ /* only used during connection */ struct stream *
libxrdp_force_read(struct trans *trans)
{ int bytes; struct stream *s;
/******************************************************************************/ int EXPORT_CC
libxrdp_process_data(struct xrdp_session *session, struct stream *s)
{ int cont; int rv; int code; int term; int dead_lock_counter; int do_read; struct xrdp_rdp *rdp;
do_read = s == 0; if (do_read && session->up_and_running)
{
LOG(LOG_LEVEL_ERROR, "libxrdp_process_data: error logic"); return1;
} if (session->in_process_data != 0)
{
LOG(LOG_LEVEL_ERROR, "libxrdp_process_data: error reentry"); return1;
}
session->in_process_data++;
switch (code)
{ case -1:
xrdp_caps_send_demand_active(rdp);
session->up_and_running = 0; break; case0:
dead_lock_counter++; break; case PDUTYPE_CONFIRMACTIVEPDU:
LOG_DEVEL(LOG_LEVEL_TRACE, "Processing received " "[MS-RDPBCGR] PDUTYPE_CONFIRMACTIVEPDU");
xrdp_caps_process_confirm_active(rdp, s); break; case PDUTYPE_DATAPDU:
LOG_DEVEL(LOG_LEVEL_TRACE, "Processing received " "[MS-RDPBCGR] PDUTYPE_DATAPDU"); if (xrdp_rdp_process_data(rdp, s) != 0)
{
LOG(LOG_LEVEL_ERROR, "libxrdp_process_data: xrdp_rdp_process_data failed");
cont = 0;
term = 1;
} break; case2: /* FASTPATH_INPUT_EVENT */ if (xrdp_fastpath_process_input_event(rdp->sec_layer->fastpath_layer, s) != 0)
{
LOG(LOG_LEVEL_ERROR, "libxrdp_process_data: xrdp_fastpath_process_input_event failed");
cont = 0;
term = 1;
} break; default:
LOG(LOG_LEVEL_WARNING, "unknown code = %d (ignored)", code);
dead_lock_counter++; break;
}
if (dead_lock_counter > 100000)
{ /*This situation can happen and this is a workaround*/
cont = 0;
LOG(LOG_LEVEL_WARNING, "Serious programming error: we were locked in a deadly loop. " "Remaining bytes: %d", (int) (s->end - s->next_packet));
s->next_packet = 0;
}
/******************************************************************************/ int EXPORT_CC
libxrdp_send_palette(struct xrdp_session *session, int *palette)
{ int rv; int i = 0; int color = 0; struct stream *s = (struct stream *)NULL;
/*****************************************************************************/ int EXPORT_CC
libxrdp_send_bitmap(struct xrdp_session *session, int width, int height, int bpp, char *data, int x, int y, int cx, int cy)
{ int line_bytes = 0; int i = 0; int j = 0; int k; int total_lines = 0; int lines_sending = 0; int Bpp = 0; int e = 0; int bufsize = 0; int total_bufsize = 0; int num_updates = 0; int line_pad_bytes; int server_line_bytes; char *p_num_updates = (char *)NULL; char *p = (char *)NULL; char *q = (char *)NULL; struct stream *s = (struct stream *)NULL; struct stream *temp_s = (struct stream *)NULL;
tui32 pixel;
/*****************************************************************************/ int EXPORT_CC
libxrdp_send_pointer_position(struct xrdp_session *session, int x, int y)
{ struct stream *s;
/*****************************************************************************/ int EXPORT_CC
libxrdp_send_pointer(struct xrdp_session *session, int cache_idx, char *data, char *mask, int x, int y, int bpp, int width, int height)
{ struct stream *s; char *p;
tui16 *p16;
tui32 *p32; int i; int j; int data_bytes; int mask_bytes;
LOG_DEVEL(LOG_LEVEL_DEBUG, "sending cursor"); if (bpp == 0)
{
bpp = 24;
} if (width == 0)
{
width = 32;
} if (height == 0)
{
height = 32;
} /* error check */ if ((session->client_info->pointer_flags & 1) == 0)
{ if (bpp != 24)
{
LOG(LOG_LEVEL_ERROR, "Send pointer: client does not support " "new cursors. The only valid bpp is 24, received %d", bpp); return1;
}
}
/******************************************************************************/ int EXPORT_CC
libxrdp_orders_rect(struct xrdp_session *session, int x, int y, int cx, int cy, int color, struct xrdp_rect *rect)
{ return xrdp_orders_rect((struct xrdp_orders *)session->orders,
x, y, cx, cy, color, rect);
}
/******************************************************************************/ int EXPORT_CC
libxrdp_orders_screen_blt(struct xrdp_session *session, int x, int y, int cx, int cy, int srcx, int srcy, int rop, struct xrdp_rect *rect)
{ return xrdp_orders_screen_blt((struct xrdp_orders *)session->orders,
x, y, cx, cy, srcx, srcy, rop, rect);
}
/******************************************************************************/ int EXPORT_CC
libxrdp_orders_pat_blt(struct xrdp_session *session, int x, int y, int cx, int cy, int rop, int bg_color, int fg_color, struct xrdp_brush *brush, struct xrdp_rect *rect)
{ return xrdp_orders_pat_blt((struct xrdp_orders *)session->orders,
x, y, cx, cy, rop, bg_color, fg_color,
brush, rect);
}
/******************************************************************************/ int EXPORT_CC
libxrdp_orders_dest_blt(struct xrdp_session *session, int x, int y, int cx, int cy, int rop, struct xrdp_rect *rect)
{ return xrdp_orders_dest_blt((struct xrdp_orders *)session->orders,
x, y, cx, cy, rop, rect);
}
/******************************************************************************/ int EXPORT_CC
libxrdp_orders_line(struct xrdp_session *session, int mix_mode, int startx, int starty, int endx, int endy, int rop, int bg_color, struct xrdp_pen *pen, struct xrdp_rect *rect)
{ return xrdp_orders_line((struct xrdp_orders *)session->orders,
mix_mode, startx, starty, endx, endy,
rop, bg_color, pen, rect);
}
/******************************************************************************/ int EXPORT_CC
libxrdp_orders_mem_blt(struct xrdp_session *session, int cache_id, int color_table, int x, int y, int cx, int cy, int rop, int srcx, int srcy, int cache_idx, struct xrdp_rect *rect)
{ return xrdp_orders_mem_blt((struct xrdp_orders *)session->orders,
cache_id, color_table, x, y, cx, cy, rop,
srcx, srcy, cache_idx, rect);
}
/******************************************************************************/ int
libxrdp_orders_composite_blt(struct xrdp_session *session, int srcidx, int srcformat, int srcwidth, int srcrepeat, int *srctransform, int mskflags, int mskidx, int mskformat, int mskwidth, int mskrepeat, int op, int srcx, int srcy, int mskx, int msky, int dstx, int dsty, int width, int height, int dstformat, struct xrdp_rect *rect)
{ return xrdp_orders_composite_blt((struct xrdp_orders *)session->orders,
srcidx, srcformat, srcwidth, srcrepeat,
srctransform, mskflags,
mskidx, mskformat, mskwidth, mskrepeat,
op, srcx, srcy, mskx, msky, dstx, dsty,
width, height, dstformat, rect);
}
/******************************************************************************/ int EXPORT_CC
libxrdp_orders_text(struct xrdp_session *session, int font, int flags, int mixmode, int fg_color, int bg_color, int clip_left, int clip_top, int clip_right, int clip_bottom, int box_left, int box_top, int box_right, int box_bottom, int x, int y, char *data, int data_len, struct xrdp_rect *rect)
{ return xrdp_orders_text((struct xrdp_orders *)session->orders,
font, flags, mixmode, fg_color, bg_color,
clip_left, clip_top, clip_right, clip_bottom,
box_left, box_top, box_right, box_bottom,
x, y, data, data_len, rect);
}
/******************************************************************************/ int EXPORT_CC
libxrdp_orders_send_palette(struct xrdp_session *session, int *palette, int cache_id)
{ return xrdp_orders_send_palette((struct xrdp_orders *)session->orders,
palette, cache_id);
}
/*****************************************************************************/ int EXPORT_CC
libxrdp_orders_send_raw_bitmap(struct xrdp_session *session, int width, int height, int bpp, char *data, int cache_id, int cache_idx)
{ return xrdp_orders_send_raw_bitmap((struct xrdp_orders *)session->orders,
width, height, bpp, data,
cache_id, cache_idx);
}
/*****************************************************************************/ int EXPORT_CC
libxrdp_orders_send_bitmap(struct xrdp_session *session, int width, int height, int bpp, char *data, int cache_id, int cache_idx)
{ return xrdp_orders_send_bitmap((struct xrdp_orders *)session->orders,
width, height, bpp, data,
cache_id, cache_idx);
}
/*****************************************************************************/ int EXPORT_CC
libxrdp_orders_send_font(struct xrdp_session *session, struct xrdp_font_char *font_char, int font_index, int char_index)
{ return xrdp_orders_send_font((struct xrdp_orders *)session->orders,
font_char, font_index, char_index);
}
/*****************************************************************************/ int EXPORT_CC
libxrdp_reset(struct xrdp_session *session)
{
LOG_DEVEL(LOG_LEVEL_TRACE, "libxrdp_reset:");
/* this will send any lingering orders */ if (xrdp_orders_reset((struct xrdp_orders *)session->orders) != 0)
{
LOG(LOG_LEVEL_ERROR, "libxrdp_reset: xrdp_orders_reset failed"); return1;
}
/* shut down the rdp client * *Whenresettingthelib,disableapplicationinputchecks,as *otherwisewecansendachannelmessagetotheotherendwhile
* the channels are inactive ([MS-RDPBCGR] 3.2.5.5.1 */
session->check_for_app_input = 0; if (xrdp_rdp_send_deactivate((struct xrdp_rdp *)session->rdp) != 0)
{
LOG(LOG_LEVEL_ERROR, "libxrdp_reset: xrdp_rdp_send_deactivate failed"); return1;
}
/* this should do the resizing */ if (xrdp_caps_send_demand_active((struct xrdp_rdp *)session->rdp) != 0)
{
LOG(LOG_LEVEL_ERROR, "libxrdp_reset: xrdp_caps_send_demand_active failed"); return1;
}
/*****************************************************************************/ int EXPORT_CC
libxrdp_orders_send_raw_bitmap2(struct xrdp_session *session, int width, int height, int bpp, char *data, int cache_id, int cache_idx)
{ return xrdp_orders_send_raw_bitmap2((struct xrdp_orders *)session->orders,
width, height, bpp, data,
cache_id, cache_idx);
}
/*****************************************************************************/ int EXPORT_CC
libxrdp_orders_send_bitmap2(struct xrdp_session *session, int width, int height, int bpp, char *data, int cache_id, int cache_idx, int hints)
{ return xrdp_orders_send_bitmap2((struct xrdp_orders *)session->orders,
width, height, bpp, data,
cache_id, cache_idx, hints);
}
/*****************************************************************************/ int EXPORT_CC
libxrdp_orders_send_bitmap3(struct xrdp_session *session, int width, int height, int bpp, char *data, int cache_id, int cache_idx, int hints)
{ return xrdp_orders_send_bitmap3((struct xrdp_orders *)session->orders,
width, height, bpp, data,
cache_id, cache_idx, hints);
}
if (mcs->channel_list == NULL)
{
LOG(LOG_LEVEL_WARNING, "libxrdp_get_channel_count - No channel initialized");
} else
{
count = mcs->channel_list->count;
}
return count;
}
/*****************************************************************************/ /* returns error */ /* this function gets the channel name and its flags, index is zero based.eitherchannel_nameorchannel_flagscanbepassedinnilif
they are not needed */ int EXPORT_CC
libxrdp_query_channel(struct xrdp_session *session, int channel_id, char *channel_name, int *channel_flags)
{ int count = 0; struct xrdp_rdp *rdp = (struct xrdp_rdp *)NULL; struct xrdp_mcs *mcs = (struct xrdp_mcs *)NULL; struct mcs_channel_item *channel_item = (struct mcs_channel_item *)NULL;
if (mcs->channel_list == NULL)
{
LOG(LOG_LEVEL_ERROR, "libxrdp_query_channel - No channel initialized"); return1 ;
}
count = mcs->channel_list->count;
if (channel_id < 0 || channel_id >= count)
{
LOG(LOG_LEVEL_ERROR, "libxrdp_query_channel: Channel index out of range. " "max channel index %d, received channel index %d",
count, channel_id); return1;
}
if (channel_item == NULL)
{ /* this should not happen */
LOG(LOG_LEVEL_ERROR, "libxrdp_query_channel - channel item is NULL"); return1;
}
if (channel_name != 0)
{
g_strncpy(channel_name, channel_item->name, CHANNEL_NAME_LEN);
LOG(LOG_LEVEL_DEBUG, "libxrdp_query_channel - Channel %d name %s",
channel_id, channel_name);
}
if (channel_flags != 0)
{
*channel_flags = channel_item->flags;
}
return0;
}
/*****************************************************************************/ /* returns a zero based index of the channel, -1 if error or it doesn't
exist */ int EXPORT_CC
libxrdp_get_channel_id(struct xrdp_session *session, constchar *name)
{ int index = 0; int count = 0; struct xrdp_rdp *rdp = NULL; struct xrdp_mcs *mcs = NULL; struct mcs_channel_item *channel_item = NULL;
/* here we make a copy of the data */
out_uint8a(s, data, data_len);
s_mark_end(s);
LOG_DEVEL(LOG_LEVEL_TRACE, "Sending [MS-RDPBCGR] Virtual Channel PDU " "data <omitted from log>");
/*****************************************************************************/ int EXPORT_CC
libxrdp_orders_send_brush(struct xrdp_session *session, int width, int height, int bpp, int type, int size, char *data, int cache_id)
{ return xrdp_orders_send_brush((struct xrdp_orders *)session->orders,
width, height, bpp, type, size, data,
cache_id);
}
/*****************************************************************************/ int EXPORT_CC
libxrdp_orders_send_create_os_surface(struct xrdp_session *session, int id, int width, int height, struct list *del_list)
{ return xrdp_orders_send_create_os_surface
((struct xrdp_orders *)(session->orders), id,
width, height, del_list);
}
/*****************************************************************************/ int EXPORT_CC
libxrdp_orders_send_switch_os_surface(struct xrdp_session *session, int id)
{ return xrdp_orders_send_switch_os_surface
((struct xrdp_orders *)(session->orders), id);
}
/*****************************************************************************/ int EXPORT_CC
libxrdp_window_new_update(struct xrdp_session *session, int window_id, struct rail_window_state_order *window_state, int flags)
{ struct xrdp_orders *orders;
/*****************************************************************************/ int EXPORT_CC
libxrdp_window_icon(struct xrdp_session *session, int window_id, int cache_entry, int cache_id, struct rail_icon_info *icon_info, int flags)
{ struct xrdp_orders *orders;
/*****************************************************************************/ int EXPORT_CC
libxrdp_window_cached_icon(struct xrdp_session *session, int window_id, int cache_entry, int cache_id, int flags)
{ struct xrdp_orders *orders;
/*****************************************************************************/ int EXPORT_CC
libxrdp_notify_new_update(struct xrdp_session *session, int window_id, int notify_id, struct rail_notify_state_order *notify_state, int flags)
{ struct xrdp_orders *orders;
/*****************************************************************************/ int
libxrdp_notify_delete(struct xrdp_session *session, int window_id, int notify_id)
{ struct xrdp_orders *orders;
/*****************************************************************************/ int EXPORT_CC
libxrdp_codec_jpeg_compress(struct xrdp_session *session, int format, char *inp_data, int width, int height, int stride, int x, int y, int cx, int cy, int quality, char *out_data, int *io_len)
{ struct xrdp_orders *orders; void *jpeg_han;
/*****************************************************************************/ int EXPORT_CC
libxrdp_fastpath_send_surface(struct xrdp_session *session, char *data_pad, int pad_bytes, int data_bytes, int destLeft, int destTop, int destRight, int destBottom, int bpp, int codecID, int width, int height)
{ struct stream ls; struct stream *s; struct xrdp_rdp *rdp; int sec_bytes; int rdp_bytes; int max_bytes; int cmd_bytes;
/* if EITHER physical_width or physical_height are *outofrange,BOTHmustbeignored.
*/ if (monitor_layout->physical_width > 10000
|| monitor_layout->physical_width < 10)
{
LOG(LOG_LEVEL_WARNING, "sanitise_extended_monitor_attributes:" " physical_width is not within valid range." " Setting physical_width to 0mm," " Setting physical_height to 0mm," " physical_width was: %d",
monitor_layout->physical_width);
monitor_layout->physical_width = 0;
monitor_layout->physical_height = 0;
}
if (monitor_layout->physical_height > 10000
|| monitor_layout->physical_height < 10)
{
LOG(LOG_LEVEL_WARNING, "sanitise_extended_monitor_attributes:" " physical_height is not within valid range." " Setting physical_width to 0mm," " Setting physical_height to 0mm," " physical_height was: %d",
monitor_layout->physical_height);
monitor_layout->physical_width = 0;
monitor_layout->physical_height = 0;
}
switch (monitor_layout->orientation)
{ case ORIENTATION_LANDSCAPE: case ORIENTATION_PORTRAIT: case ORIENTATION_LANDSCAPE_FLIPPED: case ORIENTATION_PORTRAIT_FLIPPED: break; default:
LOG(LOG_LEVEL_WARNING, "sanitise_extended_monitor_attributes:" " Orientation is not one of %d, %d, %d, or %d." " Value was %d and ignored and set to default value of LANDSCAPE.",
ORIENTATION_LANDSCAPE,
ORIENTATION_PORTRAIT,
ORIENTATION_LANDSCAPE_FLIPPED,
ORIENTATION_PORTRAIT_FLIPPED,
monitor_layout->orientation);
monitor_layout->orientation = ORIENTATION_LANDSCAPE;
}
int check_desktop_scale_factor
= monitor_layout->desktop_scale_factor < 100
|| monitor_layout->desktop_scale_factor > 500; if (check_desktop_scale_factor)
{
LOG(LOG_LEVEL_WARNING, "sanitise_extended_monitor_attributes:" " desktop_scale_factor is not within valid range" " of [100, 500]. Assuming 100. Value was: %d",
monitor_layout->desktop_scale_factor);
}
int check_device_scale_factor
= monitor_layout->device_scale_factor != 100
&& monitor_layout->device_scale_factor != 140
&& monitor_layout->device_scale_factor != 180; if (check_device_scale_factor)
{
LOG(LOG_LEVEL_WARNING, "sanitise_extended_monitor_attributes:" " device_scale_factor a valid value (One of 100, 140, 180)." " Assuming 100. Value was: %d",
monitor_layout->device_scale_factor);
}
/* Caller should have checked this, so don't log an error */ if (num_monitor > CLIENT_MONITOR_DATA_MAXIMUM_MONITORS)
{ return SEC_PROCESS_MONITORS_ERR_TOO_MANY_MONITORS;
}
if (monitor_layout->is_primary == TS_MONITOR_PRIMARY)
{ if (got_primary)
{ // Already got one - don't have two
monitor_layout->is_primary = 0;
} else
{
got_primary = 1;
}
}
}
if (!got_primary)
{ /* no primary monitor was set, *choosetheleftmostmonitorasprimary.
*/ for (monitor_index = 0; monitor_index < num_monitor; ++monitor_index)
{
monitor_layout = description->minfo + monitor_index; if (monitor_layout->left
== all_monitors_encompassing_bounds.left
&& monitor_layout->top
== all_monitors_encompassing_bounds.top)
{
monitor_layout->is_primary = TS_MONITOR_PRIMARY; break;
}
}
}
/* set wm geometry if the encompassing area is well formed. Otherwise,logandreturnanerror.
*/ if (all_monitors_encompassing_bounds.right
> all_monitors_encompassing_bounds.left
&& all_monitors_encompassing_bounds.bottom
> all_monitors_encompassing_bounds.top)
{
description->session_width =
all_monitors_encompassing_bounds.right
- all_monitors_encompassing_bounds.left + 1;
description->session_height =
all_monitors_encompassing_bounds.bottom
- all_monitors_encompassing_bounds.top + 1;
} else
{
LOG(LOG_LEVEL_ERROR, "libxrdp_init_display_size_description:" " The area encompassing the monitors is not a" " well-formed rectangle. Received" " (top: %d, left: %d, right: %d, bottom: %d)." " This will prevent initialization.",
all_monitors_encompassing_bounds.top,
all_monitors_encompassing_bounds.left,
all_monitors_encompassing_bounds.right,
all_monitors_encompassing_bounds.bottom); return SEC_PROCESS_MONITORS_ERR_INVALID_DESKTOP;
}
/* Make sure virtual desktop size is OK *2.2.1.3.6ClientMonitorData(TS_UD_CS_MONITOR)
*/ if (description->session_width
> CLIENT_MONITOR_DATA_MAXIMUM_VIRTUAL_DESKTOP_WIDTH
|| description->session_width
< CLIENT_MONITOR_DATA_MINIMUM_VIRTUAL_DESKTOP_WIDTH
|| description->session_height
> CLIENT_MONITOR_DATA_MAXIMUM_VIRTUAL_DESKTOP_HEIGHT
|| description->session_height
< CLIENT_MONITOR_DATA_MINIMUM_VIRTUAL_DESKTOP_HEIGHT)
{
LOG(LOG_LEVEL_ERROR, "libxrdp_init_display_size_description: Calculated virtual" " desktop width or height is invalid." " Allowed width range: min %d, max %d. Width received: %d." " Allowed height range: min %d, max %d. Height received: %d",
CLIENT_MONITOR_DATA_MINIMUM_VIRTUAL_DESKTOP_WIDTH,
CLIENT_MONITOR_DATA_MAXIMUM_VIRTUAL_DESKTOP_WIDTH,
description->session_width,
CLIENT_MONITOR_DATA_MINIMUM_VIRTUAL_DESKTOP_HEIGHT,
CLIENT_MONITOR_DATA_MAXIMUM_VIRTUAL_DESKTOP_HEIGHT,
description->session_width); return SEC_PROCESS_MONITORS_ERR_INVALID_DESKTOP;
}
/* keep a copy of non negative monitor info values for xrdp_wm usage */ for (monitor_index = 0; monitor_index < num_monitor; ++monitor_index)
{
monitor_layout = description->minfo_wm + monitor_index;
/*****************************************************************************/ int EXPORT_CC
libxrdp_planar_compress(char *in_data, int width, int height, struct stream *s, int bpp, int byte_limit, int start_line, struct stream *temp_s, int e, int flags)
{ return xrdp_bitmap32_compress(in_data, width, height,
s, bpp, byte_limit,
start_line, temp_s,
e, flags);
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.36 Sekunden
(vorverarbeitet am 2026-07-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.