Coverage Report

Created: 2024-05-20 06:11

/src/FreeRDP/libfreerdp/core/update.h
Line
Count
Source (jump to first uncovered line)
1
/**
2
 * FreeRDP: A Remote Desktop Protocol Implementation
3
 * Update Data PDUs
4
 *
5
 * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6
 *
7
 * Licensed under the Apache License, Version 2.0 (the "License");
8
 * you may not use this file except in compliance with the License.
9
 * You may obtain a copy of the License at
10
 *
11
 *     http://www.apache.org/licenses/LICENSE-2.0
12
 *
13
 * Unless required by applicable law or agreed to in writing, software
14
 * distributed under the License is distributed on an "AS IS" BASIS,
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 * See the License for the specific language governing permissions and
17
 * limitations under the License.
18
 */
19
20
#ifndef FREERDP_LIB_CORE_UPDATE_H
21
#define FREERDP_LIB_CORE_UPDATE_H
22
23
#include "rdp.h"
24
#include "orders.h"
25
26
#include <freerdp/types.h>
27
#include <freerdp/update.h>
28
#include <freerdp/freerdp.h>
29
#include <freerdp/api.h>
30
31
#include <winpr/stream.h>
32
33
#include "../cache/bitmap.h"
34
#include "../cache/palette.h"
35
#include "../cache/pointer.h"
36
37
0
#define UPDATE_TYPE_ORDERS 0x0000
38
0
#define UPDATE_TYPE_BITMAP 0x0001
39
0
#define UPDATE_TYPE_PALETTE 0x0002
40
0
#define UPDATE_TYPE_SYNCHRONIZE 0x0003
41
42
0
#define BITMAP_COMPRESSION 0x0001
43
0
#define NO_BITMAP_COMPRESSION_HDR 0x0400
44
45
typedef struct
46
{
47
  rdpUpdate common;
48
49
  wLog* log;
50
51
  BOOL dump_rfx;
52
  BOOL play_rfx;
53
  rdpPcap* pcap_rfx;
54
  BOOL initialState;
55
56
  BOOL asynchronous;
57
  rdpUpdateProxy* proxy;
58
  wMessageQueue* queue;
59
60
  wStream* us;
61
  UINT16 numberOrders;
62
  size_t offsetOrders; /* the offset to patch numberOrders in the stream */
63
  BOOL combineUpdates;
64
  rdpBounds currentBounds;
65
  rdpBounds previousBounds;
66
  CRITICAL_SECTION mux;
67
} rdp_update_internal;
68
69
typedef struct
70
{
71
  rdpAltSecUpdate common;
72
73
  CREATE_OFFSCREEN_BITMAP_ORDER create_offscreen_bitmap;
74
  SWITCH_SURFACE_ORDER switch_surface;
75
  CREATE_NINE_GRID_BITMAP_ORDER create_nine_grid_bitmap;
76
  FRAME_MARKER_ORDER frame_marker;
77
  STREAM_BITMAP_FIRST_ORDER stream_bitmap_first;
78
  STREAM_BITMAP_NEXT_ORDER stream_bitmap_next;
79
  DRAW_GDIPLUS_CACHE_FIRST_ORDER draw_gdiplus_cache_first;
80
  DRAW_GDIPLUS_CACHE_NEXT_ORDER draw_gdiplus_cache_next;
81
  DRAW_GDIPLUS_CACHE_END_ORDER draw_gdiplus_cache_end;
82
  DRAW_GDIPLUS_FIRST_ORDER draw_gdiplus_first;
83
  DRAW_GDIPLUS_NEXT_ORDER draw_gdiplus_next;
84
  DRAW_GDIPLUS_END_ORDER draw_gdiplus_end;
85
} rdp_altsec_update_internal;
86
87
typedef struct
88
{
89
  rdpPrimaryUpdate common;
90
91
  ORDER_INFO order_info;
92
  DSTBLT_ORDER dstblt;
93
  PATBLT_ORDER patblt;
94
  SCRBLT_ORDER scrblt;
95
  OPAQUE_RECT_ORDER opaque_rect;
96
  DRAW_NINE_GRID_ORDER draw_nine_grid;
97
  MULTI_DSTBLT_ORDER multi_dstblt;
98
  MULTI_PATBLT_ORDER multi_patblt;
99
  MULTI_SCRBLT_ORDER multi_scrblt;
100
  MULTI_OPAQUE_RECT_ORDER multi_opaque_rect;
101
  MULTI_DRAW_NINE_GRID_ORDER multi_draw_nine_grid;
102
  LINE_TO_ORDER line_to;
103
  POLYLINE_ORDER polyline;
104
  MEMBLT_ORDER memblt;
105
  MEM3BLT_ORDER mem3blt;
106
  SAVE_BITMAP_ORDER save_bitmap;
107
  GLYPH_INDEX_ORDER glyph_index;
108
  FAST_INDEX_ORDER fast_index;
109
  FAST_GLYPH_ORDER fast_glyph;
110
  POLYGON_SC_ORDER polygon_sc;
111
  POLYGON_CB_ORDER polygon_cb;
112
  ELLIPSE_SC_ORDER ellipse_sc;
113
  ELLIPSE_CB_ORDER ellipse_cb;
114
} rdp_primary_update_internal;
115
116
typedef struct
117
{
118
  rdpSecondaryUpdate common;
119
  BOOL glyph_v2;
120
} rdp_secondary_update_internal;
121
122
static INLINE rdp_update_internal* update_cast(rdpUpdate* update)
123
125k
{
124
125k
  union
125
125k
  {
126
125k
    rdpUpdate* pub;
127
125k
    rdp_update_internal* internal;
128
125k
  } cnv;
129
130
125k
  WINPR_ASSERT(update);
131
125k
  cnv.pub = update;
132
125k
  return cnv.internal;
133
125k
}
Unexecuted instantiation: TestFuzzCoreServer.c:update_cast
Unexecuted instantiation: activation.c:update_cast
Unexecuted instantiation: nla.c:update_cast
Unexecuted instantiation: info.c:update_cast
Unexecuted instantiation: settings.c:update_cast
orders.c:update_cast
Line
Count
Source
123
28.5k
{
124
28.5k
  union
125
28.5k
  {
126
28.5k
    rdpUpdate* pub;
127
28.5k
    rdp_update_internal* internal;
128
28.5k
  } cnv;
129
130
28.5k
  WINPR_ASSERT(update);
131
28.5k
  cnv.pub = update;
132
28.5k
  return cnv.internal;
133
28.5k
}
Unexecuted instantiation: freerdp.c:update_cast
Unexecuted instantiation: client.c:update_cast
Unexecuted instantiation: codecs.c:update_cast
Unexecuted instantiation: metrics.c:update_cast
Unexecuted instantiation: capabilities.c:update_cast
Unexecuted instantiation: connection.c:update_cast
Unexecuted instantiation: redirection.c:update_cast
Unexecuted instantiation: autodetect.c:update_cast
Unexecuted instantiation: heartbeat.c:update_cast
Unexecuted instantiation: multitransport.c:update_cast
Unexecuted instantiation: timezone.c:update_cast
Unexecuted instantiation: rdp.c:update_cast
Unexecuted instantiation: tcp.c:update_cast
Unexecuted instantiation: fastpath.c:update_cast
surface.c:update_cast
Line
Count
Source
123
15.0k
{
124
15.0k
  union
125
15.0k
  {
126
15.0k
    rdpUpdate* pub;
127
15.0k
    rdp_update_internal* internal;
128
15.0k
  } cnv;
129
130
15.0k
  WINPR_ASSERT(update);
131
15.0k
  cnv.pub = update;
132
15.0k
  return cnv.internal;
133
15.0k
}
Unexecuted instantiation: transport.c:update_cast
update.c:update_cast
Line
Count
Source
123
66.9k
{
124
66.9k
  union
125
66.9k
  {
126
66.9k
    rdpUpdate* pub;
127
66.9k
    rdp_update_internal* internal;
128
66.9k
  } cnv;
129
130
66.9k
  WINPR_ASSERT(update);
131
66.9k
  cnv.pub = update;
132
66.9k
  return cnv.internal;
133
66.9k
}
Unexecuted instantiation: message.c:update_cast
Unexecuted instantiation: channels.c:update_cast
window.c:update_cast
Line
Count
Source
123
15.0k
{
124
15.0k
  union
125
15.0k
  {
126
15.0k
    rdpUpdate* pub;
127
15.0k
    rdp_update_internal* internal;
128
15.0k
  } cnv;
129
130
15.0k
  WINPR_ASSERT(update);
131
15.0k
  cnv.pub = update;
132
15.0k
  return cnv.internal;
133
15.0k
}
Unexecuted instantiation: peer.c:update_cast
Unexecuted instantiation: display.c:update_cast
Unexecuted instantiation: rdg.c:update_cast
Unexecuted instantiation: rpc_client.c:update_cast
Unexecuted instantiation: wst.c:update_cast
Unexecuted instantiation: arm.c:update_cast
Unexecuted instantiation: gdi.c:update_cast
Unexecuted instantiation: utils.c:update_cast
Unexecuted instantiation: mcs.c:update_cast
Unexecuted instantiation: input.c:update_cast
Unexecuted instantiation: license.c:update_cast
Unexecuted instantiation: security.c:update_cast
Unexecuted instantiation: server.c:update_cast
Unexecuted instantiation: TestFuzzCoreClient.c:update_cast
Unexecuted instantiation: gfx.c:update_cast
Unexecuted instantiation: video.c:update_cast
134
135
static INLINE rdp_altsec_update_internal* altsec_update_cast(rdpAltSecUpdate* update)
136
24.1k
{
137
24.1k
  union
138
24.1k
  {
139
24.1k
    rdpAltSecUpdate* pub;
140
24.1k
    rdp_altsec_update_internal* internal;
141
24.1k
  } cnv;
142
143
24.1k
  WINPR_ASSERT(update);
144
24.1k
  cnv.pub = update;
145
24.1k
  return cnv.internal;
146
24.1k
}
Unexecuted instantiation: TestFuzzCoreServer.c:altsec_update_cast
Unexecuted instantiation: activation.c:altsec_update_cast
Unexecuted instantiation: nla.c:altsec_update_cast
Unexecuted instantiation: info.c:altsec_update_cast
Unexecuted instantiation: settings.c:altsec_update_cast
orders.c:altsec_update_cast
Line
Count
Source
136
9.20k
{
137
9.20k
  union
138
9.20k
  {
139
9.20k
    rdpAltSecUpdate* pub;
140
9.20k
    rdp_altsec_update_internal* internal;
141
9.20k
  } cnv;
142
143
9.20k
  WINPR_ASSERT(update);
144
9.20k
  cnv.pub = update;
145
9.20k
  return cnv.internal;
146
9.20k
}
Unexecuted instantiation: freerdp.c:altsec_update_cast
Unexecuted instantiation: client.c:altsec_update_cast
Unexecuted instantiation: codecs.c:altsec_update_cast
Unexecuted instantiation: metrics.c:altsec_update_cast
Unexecuted instantiation: capabilities.c:altsec_update_cast
Unexecuted instantiation: connection.c:altsec_update_cast
Unexecuted instantiation: redirection.c:altsec_update_cast
Unexecuted instantiation: autodetect.c:altsec_update_cast
Unexecuted instantiation: heartbeat.c:altsec_update_cast
Unexecuted instantiation: multitransport.c:altsec_update_cast
Unexecuted instantiation: timezone.c:altsec_update_cast
Unexecuted instantiation: rdp.c:altsec_update_cast
Unexecuted instantiation: tcp.c:altsec_update_cast
Unexecuted instantiation: fastpath.c:altsec_update_cast
Unexecuted instantiation: surface.c:altsec_update_cast
Unexecuted instantiation: transport.c:altsec_update_cast
update.c:altsec_update_cast
Line
Count
Source
136
14.9k
{
137
14.9k
  union
138
14.9k
  {
139
14.9k
    rdpAltSecUpdate* pub;
140
14.9k
    rdp_altsec_update_internal* internal;
141
14.9k
  } cnv;
142
143
14.9k
  WINPR_ASSERT(update);
144
14.9k
  cnv.pub = update;
145
14.9k
  return cnv.internal;
146
14.9k
}
Unexecuted instantiation: message.c:altsec_update_cast
Unexecuted instantiation: channels.c:altsec_update_cast
Unexecuted instantiation: window.c:altsec_update_cast
Unexecuted instantiation: peer.c:altsec_update_cast
Unexecuted instantiation: display.c:altsec_update_cast
Unexecuted instantiation: rdg.c:altsec_update_cast
Unexecuted instantiation: rpc_client.c:altsec_update_cast
Unexecuted instantiation: wst.c:altsec_update_cast
Unexecuted instantiation: arm.c:altsec_update_cast
Unexecuted instantiation: gdi.c:altsec_update_cast
Unexecuted instantiation: utils.c:altsec_update_cast
Unexecuted instantiation: mcs.c:altsec_update_cast
Unexecuted instantiation: input.c:altsec_update_cast
Unexecuted instantiation: license.c:altsec_update_cast
Unexecuted instantiation: security.c:altsec_update_cast
Unexecuted instantiation: server.c:altsec_update_cast
Unexecuted instantiation: TestFuzzCoreClient.c:altsec_update_cast
Unexecuted instantiation: gfx.c:altsec_update_cast
Unexecuted instantiation: video.c:altsec_update_cast
147
148
static INLINE rdp_primary_update_internal* primary_update_cast(rdpPrimaryUpdate* update)
149
20.6k
{
150
20.6k
  union
151
20.6k
  {
152
20.6k
    rdpPrimaryUpdate* pub;
153
20.6k
    rdp_primary_update_internal* internal;
154
20.6k
  } cnv;
155
156
20.6k
  WINPR_ASSERT(update);
157
20.6k
  cnv.pub = update;
158
20.6k
  return cnv.internal;
159
20.6k
}
Unexecuted instantiation: TestFuzzCoreServer.c:primary_update_cast
Unexecuted instantiation: activation.c:primary_update_cast
Unexecuted instantiation: nla.c:primary_update_cast
Unexecuted instantiation: info.c:primary_update_cast
Unexecuted instantiation: settings.c:primary_update_cast
orders.c:primary_update_cast
Line
Count
Source
149
5.72k
{
150
5.72k
  union
151
5.72k
  {
152
5.72k
    rdpPrimaryUpdate* pub;
153
5.72k
    rdp_primary_update_internal* internal;
154
5.72k
  } cnv;
155
156
5.72k
  WINPR_ASSERT(update);
157
5.72k
  cnv.pub = update;
158
5.72k
  return cnv.internal;
159
5.72k
}
Unexecuted instantiation: freerdp.c:primary_update_cast
Unexecuted instantiation: client.c:primary_update_cast
Unexecuted instantiation: codecs.c:primary_update_cast
Unexecuted instantiation: metrics.c:primary_update_cast
Unexecuted instantiation: capabilities.c:primary_update_cast
Unexecuted instantiation: connection.c:primary_update_cast
Unexecuted instantiation: redirection.c:primary_update_cast
Unexecuted instantiation: autodetect.c:primary_update_cast
Unexecuted instantiation: heartbeat.c:primary_update_cast
Unexecuted instantiation: multitransport.c:primary_update_cast
Unexecuted instantiation: timezone.c:primary_update_cast
Unexecuted instantiation: rdp.c:primary_update_cast
Unexecuted instantiation: tcp.c:primary_update_cast
Unexecuted instantiation: fastpath.c:primary_update_cast
Unexecuted instantiation: surface.c:primary_update_cast
Unexecuted instantiation: transport.c:primary_update_cast
update.c:primary_update_cast
Line
Count
Source
149
14.9k
{
150
14.9k
  union
151
14.9k
  {
152
14.9k
    rdpPrimaryUpdate* pub;
153
14.9k
    rdp_primary_update_internal* internal;
154
14.9k
  } cnv;
155
156
14.9k
  WINPR_ASSERT(update);
157
14.9k
  cnv.pub = update;
158
14.9k
  return cnv.internal;
159
14.9k
}
Unexecuted instantiation: message.c:primary_update_cast
Unexecuted instantiation: channels.c:primary_update_cast
Unexecuted instantiation: window.c:primary_update_cast
Unexecuted instantiation: peer.c:primary_update_cast
Unexecuted instantiation: display.c:primary_update_cast
Unexecuted instantiation: rdg.c:primary_update_cast
Unexecuted instantiation: rpc_client.c:primary_update_cast
Unexecuted instantiation: wst.c:primary_update_cast
Unexecuted instantiation: arm.c:primary_update_cast
Unexecuted instantiation: gdi.c:primary_update_cast
Unexecuted instantiation: utils.c:primary_update_cast
Unexecuted instantiation: mcs.c:primary_update_cast
Unexecuted instantiation: input.c:primary_update_cast
Unexecuted instantiation: license.c:primary_update_cast
Unexecuted instantiation: security.c:primary_update_cast
Unexecuted instantiation: server.c:primary_update_cast
Unexecuted instantiation: TestFuzzCoreClient.c:primary_update_cast
Unexecuted instantiation: gfx.c:primary_update_cast
Unexecuted instantiation: video.c:primary_update_cast
160
161
static INLINE rdp_secondary_update_internal* secondary_update_cast(rdpSecondaryUpdate* update)
162
2.01k
{
163
2.01k
  union
164
2.01k
  {
165
2.01k
    rdpSecondaryUpdate* pub;
166
2.01k
    rdp_secondary_update_internal* internal;
167
2.01k
  } cnv;
168
169
2.01k
  WINPR_ASSERT(update);
170
2.01k
  cnv.pub = update;
171
2.01k
  return cnv.internal;
172
2.01k
}
Unexecuted instantiation: TestFuzzCoreServer.c:secondary_update_cast
Unexecuted instantiation: activation.c:secondary_update_cast
Unexecuted instantiation: nla.c:secondary_update_cast
Unexecuted instantiation: info.c:secondary_update_cast
Unexecuted instantiation: settings.c:secondary_update_cast
Unexecuted instantiation: orders.c:secondary_update_cast
Unexecuted instantiation: freerdp.c:secondary_update_cast
Unexecuted instantiation: client.c:secondary_update_cast
Unexecuted instantiation: codecs.c:secondary_update_cast
Unexecuted instantiation: metrics.c:secondary_update_cast
capabilities.c:secondary_update_cast
Line
Count
Source
162
2.01k
{
163
2.01k
  union
164
2.01k
  {
165
2.01k
    rdpSecondaryUpdate* pub;
166
2.01k
    rdp_secondary_update_internal* internal;
167
2.01k
  } cnv;
168
169
2.01k
  WINPR_ASSERT(update);
170
2.01k
  cnv.pub = update;
171
2.01k
  return cnv.internal;
172
2.01k
}
Unexecuted instantiation: connection.c:secondary_update_cast
Unexecuted instantiation: redirection.c:secondary_update_cast
Unexecuted instantiation: autodetect.c:secondary_update_cast
Unexecuted instantiation: heartbeat.c:secondary_update_cast
Unexecuted instantiation: multitransport.c:secondary_update_cast
Unexecuted instantiation: timezone.c:secondary_update_cast
Unexecuted instantiation: rdp.c:secondary_update_cast
Unexecuted instantiation: tcp.c:secondary_update_cast
Unexecuted instantiation: fastpath.c:secondary_update_cast
Unexecuted instantiation: surface.c:secondary_update_cast
Unexecuted instantiation: transport.c:secondary_update_cast
Unexecuted instantiation: update.c:secondary_update_cast
Unexecuted instantiation: message.c:secondary_update_cast
Unexecuted instantiation: channels.c:secondary_update_cast
Unexecuted instantiation: window.c:secondary_update_cast
Unexecuted instantiation: peer.c:secondary_update_cast
Unexecuted instantiation: display.c:secondary_update_cast
Unexecuted instantiation: rdg.c:secondary_update_cast
Unexecuted instantiation: rpc_client.c:secondary_update_cast
Unexecuted instantiation: wst.c:secondary_update_cast
Unexecuted instantiation: arm.c:secondary_update_cast
Unexecuted instantiation: gdi.c:secondary_update_cast
Unexecuted instantiation: utils.c:secondary_update_cast
Unexecuted instantiation: mcs.c:secondary_update_cast
Unexecuted instantiation: input.c:secondary_update_cast
Unexecuted instantiation: license.c:secondary_update_cast
Unexecuted instantiation: security.c:secondary_update_cast
Unexecuted instantiation: server.c:secondary_update_cast
Unexecuted instantiation: TestFuzzCoreClient.c:secondary_update_cast
Unexecuted instantiation: gfx.c:secondary_update_cast
Unexecuted instantiation: video.c:secondary_update_cast
173
174
FREERDP_LOCAL void update_free(rdpUpdate* update);
175
176
WINPR_ATTR_MALLOC(update_free, 1)
177
FREERDP_LOCAL rdpUpdate* update_new(rdpRdp* rdp);
178
179
FREERDP_LOCAL void update_reset_state(rdpUpdate* update);
180
FREERDP_LOCAL BOOL update_post_connect(rdpUpdate* update);
181
FREERDP_LOCAL void update_post_disconnect(rdpUpdate* update);
182
183
FREERDP_LOCAL BOOL update_recv_play_sound(rdpUpdate* update, wStream* s);
184
FREERDP_LOCAL BOOL update_recv_pointer(rdpUpdate* update, wStream* s);
185
FREERDP_LOCAL BOOL update_recv(rdpUpdate* update, wStream* s);
186
187
WINPR_ATTR_MALLOC(free_bitmap_update, 2)
188
FREERDP_LOCAL BITMAP_UPDATE* update_read_bitmap_update(rdpUpdate* update, wStream* s);
189
190
WINPR_ATTR_MALLOC(free_palette_update, 2)
191
FREERDP_LOCAL PALETTE_UPDATE* update_read_palette(rdpUpdate* update, wStream* s);
192
193
WINPR_ATTR_MALLOC(free_pointer_system_update, 2)
194
FREERDP_LOCAL POINTER_SYSTEM_UPDATE* update_read_pointer_system(rdpUpdate* update, wStream* s);
195
196
WINPR_ATTR_MALLOC(free_pointer_position_update, 2)
197
FREERDP_LOCAL POINTER_POSITION_UPDATE* update_read_pointer_position(rdpUpdate* update, wStream* s);
198
199
WINPR_ATTR_MALLOC(free_pointer_color_update, 2)
200
FREERDP_LOCAL POINTER_COLOR_UPDATE* update_read_pointer_color(rdpUpdate* update, wStream* s,
201
                                                              BYTE xorBpp);
202
203
WINPR_ATTR_MALLOC(free_pointer_large_update, 2)
204
FREERDP_LOCAL POINTER_LARGE_UPDATE* update_read_pointer_large(rdpUpdate* update, wStream* s);
205
206
WINPR_ATTR_MALLOC(free_pointer_new_update, 2)
207
FREERDP_LOCAL POINTER_NEW_UPDATE* update_read_pointer_new(rdpUpdate* update, wStream* s);
208
209
WINPR_ATTR_MALLOC(free_pointer_cached_update, 2)
210
FREERDP_LOCAL POINTER_CACHED_UPDATE* update_read_pointer_cached(rdpUpdate* update, wStream* s);
211
212
FREERDP_LOCAL BOOL update_read_refresh_rect(rdpUpdate* update, wStream* s);
213
FREERDP_LOCAL BOOL update_read_suppress_output(rdpUpdate* update, wStream* s);
214
FREERDP_LOCAL void update_register_server_callbacks(rdpUpdate* update);
215
FREERDP_LOCAL void update_register_client_callbacks(rdpUpdate* update);
216
FREERDP_LOCAL int update_process_messages(rdpUpdate* update);
217
218
FREERDP_LOCAL BOOL update_begin_paint(rdpUpdate* update);
219
FREERDP_LOCAL BOOL update_end_paint(rdpUpdate* update);
220
221
#endif /* FREERDP_LIB_CORE_UPDATE_H */