FreeRDP
update.c File Reference
#include <winpr/crt.h>
#include <winpr/print.h>
#include <winpr/synch.h>
#include <winpr/thread.h>
#include <winpr/collections.h>
#include "update.h"
#include "surface.h"
#include "message.h"
#include "info.h"
#include "window.h"
#include <freerdp/log.h>
#include <freerdp/peer.h>
#include <freerdp/codec/bitmap.h>
#include "../cache/pointer.h"
#include "../cache/palette.h"
#include "../cache/bitmap.h"

Macros

#define TAG   FREERDP_TAG("core.update")
 

Functions

static const char * update_type_to_string (UINT16 updateType)
 
static BOOL update_recv_orders (rdpUpdate *update, wStream *s)
 
static BOOL update_read_bitmap_data (rdpUpdate *update, wStream *s, BITMAP_DATA *bitmapData)
 
static BOOL update_write_bitmap_data (rdpUpdate *update, wStream *s, BITMAP_DATA *bitmapData)
 
BITMAP_UPDATE * update_read_bitmap_update (rdpUpdate *update, wStream *s)
 
static BOOL update_write_bitmap_update (rdpUpdate *update, wStream *s, const BITMAP_UPDATE *bitmapUpdate)
 
PALETTE_UPDATE * update_read_palette (rdpUpdate *update, wStream *s)
 
static void update_read_synchronize (rdpUpdate *update, wStream *s)
 
static BOOL update_read_play_sound (wStream *s, PLAY_SOUND_UPDATE *play_sound)
 
BOOL update_recv_play_sound (rdpUpdate *update, wStream *s)
 
POINTER_POSITION_UPDATE * update_read_pointer_position (rdpUpdate *update, wStream *s)
 
POINTER_SYSTEM_UPDATE * update_read_pointer_system (rdpUpdate *update, wStream *s)
 
static BOOL _update_read_pointer_color (wStream *s, POINTER_COLOR_UPDATE *pointer_color, BYTE xorBpp)
 
POINTER_COLOR_UPDATE * update_read_pointer_color (rdpUpdate *update, wStream *s, BYTE xorBpp)
 
POINTER_NEW_UPDATE * update_read_pointer_new (rdpUpdate *update, wStream *s)
 
POINTER_CACHED_UPDATE * update_read_pointer_cached (rdpUpdate *update, wStream *s)
 
BOOL update_recv_pointer (rdpUpdate *update, wStream *s)
 
BOOL update_recv (rdpUpdate *update, wStream *s)
 
void update_reset_state (rdpUpdate *update)
 
BOOL update_post_connect (rdpUpdate *update)
 
void update_post_disconnect (rdpUpdate *update)
 
static BOOL update_begin_paint (rdpContext *context)
 
static BOOL update_end_paint (rdpContext *context)
 
static void update_flush (rdpContext *context)
 
static void update_force_flush (rdpContext *context)
 
static BOOL update_check_flush (rdpContext *context, int size)
 
static BOOL update_set_bounds (rdpContext *context, const rdpBounds *bounds)
 
BOOL update_bounds_is_null (rdpBounds *bounds)
 
BOOL update_bounds_equals (rdpBounds *bounds1, rdpBounds *bounds2)
 
int update_prepare_bounds (rdpContext *context, ORDER_INFO *orderInfo)
 
static int update_prepare_order_info (rdpContext *context, ORDER_INFO *orderInfo, UINT32 orderType)
 
int update_write_order_info (rdpContext *context, wStream *s, ORDER_INFO *orderInfo, int offset)
 
static void update_write_refresh_rect (wStream *s, BYTE count, const RECTANGLE_16 *areas)
 
static BOOL update_send_refresh_rect (rdpContext *context, BYTE count, const RECTANGLE_16 *areas)
 
static void update_write_suppress_output (wStream *s, BYTE allow, const RECTANGLE_16 *area)
 
static BOOL update_send_suppress_output (rdpContext *context, BYTE allow, const RECTANGLE_16 *area)
 
static BOOL update_send_surface_command (rdpContext *context, wStream *s)
 
static BOOL update_send_surface_bits (rdpContext *context, const SURFACE_BITS_COMMAND *surfaceBitsCommand)
 
static BOOL update_send_surface_frame_marker (rdpContext *context, const SURFACE_FRAME_MARKER *surfaceFrameMarker)
 
static BOOL update_send_surface_frame_bits (rdpContext *context, const SURFACE_BITS_COMMAND *cmd, BOOL first, BOOL last, UINT32 frameId)
 
static BOOL update_send_frame_acknowledge (rdpContext *context, UINT32 frameId)
 
static BOOL update_send_synchronize (rdpContext *context)
 
static BOOL update_send_desktop_resize (rdpContext *context)
 
static BOOL update_send_bitmap_update (rdpContext *context, const BITMAP_UPDATE *bitmapUpdate)
 
static BOOL update_send_play_sound (rdpContext *context, const PLAY_SOUND_UPDATE *play_sound)
 
static BOOL update_send_dstblt (rdpContext *context, const DSTBLT_ORDER *dstblt)
 
static BOOL update_send_patblt (rdpContext *context, PATBLT_ORDER *patblt)
 
static BOOL update_send_scrblt (rdpContext *context, const SCRBLT_ORDER *scrblt)
 
static BOOL update_send_opaque_rect (rdpContext *context, const OPAQUE_RECT_ORDER *opaque_rect)
 
static BOOL update_send_line_to (rdpContext *context, const LINE_TO_ORDER *line_to)
 
static BOOL update_send_memblt (rdpContext *context, MEMBLT_ORDER *memblt)
 
static BOOL update_send_glyph_index (rdpContext *context, GLYPH_INDEX_ORDER *glyph_index)
 
static BOOL update_send_cache_bitmap (rdpContext *context, const CACHE_BITMAP_ORDER *cache_bitmap)
 
static BOOL update_send_cache_bitmap_v2 (rdpContext *context, CACHE_BITMAP_V2_ORDER *cache_bitmap_v2)
 
static BOOL update_send_cache_bitmap_v3 (rdpContext *context, CACHE_BITMAP_V3_ORDER *cache_bitmap_v3)
 
static BOOL update_send_cache_color_table (rdpContext *context, const CACHE_COLOR_TABLE_ORDER *cache_color_table)
 
static BOOL update_send_cache_glyph (rdpContext *context, const CACHE_GLYPH_ORDER *cache_glyph)
 
static BOOL update_send_cache_glyph_v2 (rdpContext *context, const CACHE_GLYPH_V2_ORDER *cache_glyph_v2)
 
static BOOL update_send_cache_brush (rdpContext *context, const CACHE_BRUSH_ORDER *cache_brush)
 
static BOOL update_send_create_offscreen_bitmap_order (rdpContext *context, const CREATE_OFFSCREEN_BITMAP_ORDER *create_offscreen_bitmap)
 
static BOOL update_send_switch_surface_order (rdpContext *context, const SWITCH_SURFACE_ORDER *switch_surface)
 
static BOOL update_send_pointer_system (rdpContext *context, const POINTER_SYSTEM_UPDATE *pointer_system)
 
static BOOL update_send_pointer_position (rdpContext *context, const POINTER_POSITION_UPDATE *pointerPosition)
 
static BOOL update_write_pointer_color (wStream *s, const POINTER_COLOR_UPDATE *pointer_color)
 
static BOOL update_send_pointer_color (rdpContext *context, const POINTER_COLOR_UPDATE *pointer_color)
 
static BOOL update_send_pointer_new (rdpContext *context, const POINTER_NEW_UPDATE *pointer_new)
 
static BOOL update_send_pointer_cached (rdpContext *context, const POINTER_CACHED_UPDATE *pointer_cached)
 
BOOL update_read_refresh_rect (rdpUpdate *update, wStream *s)
 
BOOL update_read_suppress_output (rdpUpdate *update, wStream *s)
 
static BOOL update_send_set_keyboard_indicators (rdpContext *context, UINT16 led_flags)
 
static BOOL update_send_set_keyboard_ime_status (rdpContext *context, UINT16 imeId, UINT32 imeState, UINT32 imeConvMode)
 
void update_register_server_callbacks (rdpUpdate *update)
 
void update_register_client_callbacks (rdpUpdate *update)
 
int update_process_messages (rdpUpdate *update)
 
static void update_free_queued_message (void *obj)
 
static void update_free_window_state (WINDOW_STATE_ORDER *window_state)
 
rdpUpdate * update_new (rdpRdp *rdp)
 
void update_free (rdpUpdate *update)
 

Variables

static const char *const UPDATE_TYPE_STRINGS []
 

Macro Definition Documentation

#define TAG   FREERDP_TAG("core.update")

FreeRDP: A Remote Desktop Protocol Implementation Update Data PDUs

Copyright 2011 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2016 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2016 Thincast Technologies GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

static BOOL _update_read_pointer_color ( wStream *  s,
POINTER_COLOR_UPDATE *  pointer_color,
BYTE  xorBpp 
)
static

As stated in 2.2.9.1.1.4.4 Color Pointer Update: The maximum allowed pointer width/height is 96 pixels if the client indicated support for large pointers by setting the LARGE_POINTER_FLAG (0x00000001) in the Large Pointer Capability Set (section 2.2.7.2.7). If the LARGE_POINTER_FLAG was not set, the maximum allowed pointer width/height is 32 pixels.

So we check for a maximum of 96 for CVE-2014-0250.

There does not seem to be any documentation on why xPos / yPos can be larger than width / height so it is missing in documentation or a bug in implementation 2.2.9.1.1.4.4 Color Pointer Update (TS_COLORPOINTERATTRIBUTE)

Spec states that:

xorMaskData (variable): A variable-length array of bytes. Contains the 24-bpp, bottom-up XOR mask scan-line data. The XOR mask is padded to a 2-byte boundary for each encoded scan-line. For example, if a 3x3 pixel cursor is being sent, then each scan-line will consume 10 bytes (3 pixels per scan-line multiplied by 3 bytes per pixel, rounded up to the next even number of bytes).

In fact instead of 24-bpp, the bpp parameter is given by the containing packet.

andMaskData (variable): A variable-length array of bytes. Contains the 1-bpp, bottom-up AND mask scan-line data. The AND mask is padded to a 2-byte boundary for each encoded scan-line. For example, if a 7x7 pixel cursor is being sent, then each scan-line will consume 2 bytes (7 pixels per scan-line multiplied by 1 bpp, rounded up to the next even number of bytes).

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_begin_paint ( rdpContext *  context)
static

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL update_bounds_equals ( rdpBounds *  bounds1,
rdpBounds *  bounds2 
)

Here is the caller graph for this function:

BOOL update_bounds_is_null ( rdpBounds *  bounds)

Here is the caller graph for this function:

static BOOL update_check_flush ( rdpContext *  context,
int  size 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_end_paint ( rdpContext *  context)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void update_flush ( rdpContext *  context)
static

Here is the caller graph for this function:

static void update_force_flush ( rdpContext *  context)
static

Here is the caller graph for this function:

void update_free ( rdpUpdate *  update)

Here is the call graph for this function:

Here is the caller graph for this function:

static void update_free_queued_message ( void obj)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void update_free_window_state ( WINDOW_STATE_ORDER *  window_state)
static

Here is the caller graph for this function:

rdpUpdate* update_new ( rdpRdp *  rdp)

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL update_post_connect ( rdpUpdate *  update)

Here is the call graph for this function:

Here is the caller graph for this function:

void update_post_disconnect ( rdpUpdate *  update)

Here is the call graph for this function:

Here is the caller graph for this function:

int update_prepare_bounds ( rdpContext *  context,
ORDER_INFO *  orderInfo 
)

Here is the call graph for this function:

Here is the caller graph for this function:

static int update_prepare_order_info ( rdpContext *  context,
ORDER_INFO *  orderInfo,
UINT32  orderType 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

int update_process_messages ( rdpUpdate *  update)

Here is the call graph for this function:

static BOOL update_read_bitmap_data ( rdpUpdate *  update,
wStream *  s,
BITMAP_DATA *  bitmapData 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

BITMAP_UPDATE* update_read_bitmap_update ( rdpUpdate *  update,
wStream *  s 
)

Here is the call graph for this function:

Here is the caller graph for this function:

PALETTE_UPDATE* update_read_palette ( rdpUpdate *  update,
wStream *  s 
)

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_read_play_sound ( wStream *  s,
PLAY_SOUND_UPDATE *  play_sound 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

POINTER_CACHED_UPDATE* update_read_pointer_cached ( rdpUpdate *  update,
wStream *  s 
)

Here is the call graph for this function:

Here is the caller graph for this function:

POINTER_COLOR_UPDATE* update_read_pointer_color ( rdpUpdate *  update,
wStream *  s,
BYTE  xorBpp 
)

Here is the call graph for this function:

Here is the caller graph for this function:

POINTER_NEW_UPDATE* update_read_pointer_new ( rdpUpdate *  update,
wStream *  s 
)

Here is the call graph for this function:

Here is the caller graph for this function:

POINTER_POSITION_UPDATE* update_read_pointer_position ( rdpUpdate *  update,
wStream *  s 
)

Here is the call graph for this function:

Here is the caller graph for this function:

POINTER_SYSTEM_UPDATE* update_read_pointer_system ( rdpUpdate *  update,
wStream *  s 
)

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL update_read_refresh_rect ( rdpUpdate *  update,
wStream *  s 
)

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL update_read_suppress_output ( rdpUpdate *  update,
wStream *  s 
)

Here is the call graph for this function:

Here is the caller graph for this function:

static void update_read_synchronize ( rdpUpdate *  update,
wStream *  s 
)
static

The Synchronize Update is an artifact from the T.128 protocol and should be ignored.

Here is the caller graph for this function:

BOOL update_recv ( rdpUpdate *  update,
wStream *  s 
)

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_recv_orders ( rdpUpdate *  update,
wStream *  s 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL update_recv_play_sound ( rdpUpdate *  update,
wStream *  s 
)

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL update_recv_pointer ( rdpUpdate *  update,
wStream *  s 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void update_register_client_callbacks ( rdpUpdate *  update)

Here is the call graph for this function:

Here is the caller graph for this function:

void update_register_server_callbacks ( rdpUpdate *  update)

Here is the call graph for this function:

Here is the caller graph for this function:

void update_reset_state ( rdpUpdate *  update)

Here is the caller graph for this function:

static BOOL update_send_bitmap_update ( rdpContext *  context,
const BITMAP_UPDATE *  bitmapUpdate 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_cache_bitmap ( rdpContext *  context,
const CACHE_BITMAP_ORDER *  cache_bitmap 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_cache_bitmap_v2 ( rdpContext *  context,
CACHE_BITMAP_V2_ORDER *  cache_bitmap_v2 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_cache_bitmap_v3 ( rdpContext *  context,
CACHE_BITMAP_V3_ORDER *  cache_bitmap_v3 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_cache_brush ( rdpContext *  context,
const CACHE_BRUSH_ORDER *  cache_brush 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_cache_color_table ( rdpContext *  context,
const CACHE_COLOR_TABLE_ORDER *  cache_color_table 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_cache_glyph ( rdpContext *  context,
const CACHE_GLYPH_ORDER *  cache_glyph 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_cache_glyph_v2 ( rdpContext *  context,
const CACHE_GLYPH_V2_ORDER *  cache_glyph_v2 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_create_offscreen_bitmap_order ( rdpContext *  context,
const CREATE_OFFSCREEN_BITMAP_ORDER *  create_offscreen_bitmap 
)
static

Alternate Secondary Drawing Orders

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_desktop_resize ( rdpContext *  context)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_dstblt ( rdpContext *  context,
const DSTBLT_ORDER *  dstblt 
)
static

Primary Drawing Orders

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_frame_acknowledge ( rdpContext *  context,
UINT32  frameId 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_glyph_index ( rdpContext *  context,
GLYPH_INDEX_ORDER *  glyph_index 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_line_to ( rdpContext *  context,
const LINE_TO_ORDER *  line_to 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_memblt ( rdpContext *  context,
MEMBLT_ORDER *  memblt 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_opaque_rect ( rdpContext *  context,
const OPAQUE_RECT_ORDER *  opaque_rect 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_patblt ( rdpContext *  context,
PATBLT_ORDER *  patblt 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_play_sound ( rdpContext *  context,
const PLAY_SOUND_UPDATE *  play_sound 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_pointer_cached ( rdpContext *  context,
const POINTER_CACHED_UPDATE *  pointer_cached 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_pointer_color ( rdpContext *  context,
const POINTER_COLOR_UPDATE *  pointer_color 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_pointer_new ( rdpContext *  context,
const POINTER_NEW_UPDATE *  pointer_new 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_pointer_position ( rdpContext *  context,
const POINTER_POSITION_UPDATE *  pointerPosition 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_pointer_system ( rdpContext *  context,
const POINTER_SYSTEM_UPDATE *  pointer_system 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_refresh_rect ( rdpContext *  context,
BYTE  count,
const RECTANGLE_16 *  areas 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_scrblt ( rdpContext *  context,
const SCRBLT_ORDER *  scrblt 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_set_keyboard_ime_status ( rdpContext *  context,
UINT16  imeId,
UINT32  imeState,
UINT32  imeConvMode 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_set_keyboard_indicators ( rdpContext *  context,
UINT16  led_flags 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_suppress_output ( rdpContext *  context,
BYTE  allow,
const RECTANGLE_16 *  area 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_surface_bits ( rdpContext *  context,
const SURFACE_BITS_COMMAND *  surfaceBitsCommand 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_surface_command ( rdpContext *  context,
wStream *  s 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_surface_frame_bits ( rdpContext *  context,
const SURFACE_BITS_COMMAND *  cmd,
BOOL  first,
BOOL  last,
UINT32  frameId 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_surface_frame_marker ( rdpContext *  context,
const SURFACE_FRAME_MARKER *  surfaceFrameMarker 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_switch_surface_order ( rdpContext *  context,
const SWITCH_SURFACE_ORDER *  switch_surface 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_send_synchronize ( rdpContext *  context)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_set_bounds ( rdpContext *  context,
const rdpBounds *  bounds 
)
static

Here is the caller graph for this function:

static const char* update_type_to_string ( UINT16  updateType)
static

Here is the caller graph for this function:

static BOOL update_write_bitmap_data ( rdpUpdate *  update,
wStream *  s,
BITMAP_DATA *  bitmapData 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_write_bitmap_update ( rdpUpdate *  update,
wStream *  s,
const BITMAP_UPDATE *  bitmapUpdate 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

int update_write_order_info ( rdpContext *  context,
wStream *  s,
ORDER_INFO *  orderInfo,
int  offset 
)

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL update_write_pointer_color ( wStream *  s,
const POINTER_COLOR_UPDATE *  pointer_color 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void update_write_refresh_rect ( wStream *  s,
BYTE  count,
const RECTANGLE_16 *  areas 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void update_write_suppress_output ( wStream *  s,
BYTE  allow,
const RECTANGLE_16 *  area 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

const char* const UPDATE_TYPE_STRINGS[]
static
Initial value:
=
{
"Orders",
"Bitmap",
"Palette",
"Synchronize"
}