ReactOS 0.4.15-dev-8058-ga7cbb60
proto.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

BOOL bitmap_decompress (uint8 *output, int width, int height, uint8 *input, int size, int Bpp)
 
void cache_rebuild_bmpcache_linked_list (RDPCLIENT *This, uint8 id, sint16 *idx, int count)
 
void cache_bump_bitmap (RDPCLIENT *This, uint8 id, uint16 idx, int bump)
 
void cache_evict_bitmap (RDPCLIENT *This, uint8 id)
 
HBITMAP cache_get_bitmap (RDPCLIENT *This, uint8 id, uint16 idx)
 
void cache_put_bitmap (RDPCLIENT *This, uint8 id, uint16 idx, HBITMAP bitmap)
 
void cache_save_state (RDPCLIENT *This)
 
FONTGLYPHcache_get_font (RDPCLIENT *This, uint8 font, uint16 character)
 
void cache_put_font (RDPCLIENT *This, uint8 font, uint16 character, uint16 offset, uint16 baseline, uint16 width, uint16 height, HGLYPH pixmap)
 
DATABLOBcache_get_text (RDPCLIENT *This, uint8 cache_id)
 
void cache_put_text (RDPCLIENT *This, uint8 cache_id, void *data, int length)
 
uint8cache_get_desktop (RDPCLIENT *This, uint32 offset, int cx, int cy, int bytes_per_pixel)
 
void cache_put_desktop (RDPCLIENT *This, uint32 offset, int cx, int cy, int scanline, int bytes_per_pixel, uint8 *data)
 
HCURSOR cache_get_cursor (RDPCLIENT *This, uint16 cache_idx)
 
void cache_put_cursor (RDPCLIENT *This, uint16 cache_idx, HCURSOR cursor)
 
VCHANNELchannel_register (RDPCLIENT *This, char *name, uint32 flags, void(*callback)(RDPCLIENT *, STREAM))
 
STREAM channel_init (RDPCLIENT *This, VCHANNEL *channel, uint32 length)
 
void channel_send (RDPCLIENT *This, STREAM s, VCHANNEL *channel)
 
void channel_process (RDPCLIENT *This, STREAM s, uint16 mcs_channel)
 
void cliprdr_send_simple_native_format_announce (RDPCLIENT *This, uint32 format)
 
void cliprdr_send_native_format_announce (RDPCLIENT *This, uint8 *formats_data, uint32 formats_data_length)
 
void cliprdr_send_data_request (RDPCLIENT *This, uint32 format)
 
void cliprdr_send_data (RDPCLIENT *This, uint8 *data, uint32 length)
 
void cliprdr_set_mode (RDPCLIENT *This, const char *optarg)
 
BOOL cliprdr_init (RDPCLIENT *This)
 
int mppc_expand (RDPCLIENT *This, uint8 *data, uint32 clen, uint8 ctype, uint32 *roff, uint32 *rlen)
 
int get_current_workarea (RDPCLIENT *This, uint32 *x, uint32 *y, uint32 *width, uint32 *height)
 
void ewmh_init (RDPCLIENT *This)
 
STREAM iso_init (RDPCLIENT *This, int length)
 
BOOL iso_send (RDPCLIENT *This, STREAM s)
 
STREAM iso_recv (RDPCLIENT *This, uint8 *rdpver)
 
BOOL iso_connect (RDPCLIENT *This, char *server, char *cookie)
 
BOOL iso_reconnect (RDPCLIENT *This, char *server, char *cookie)
 
BOOL iso_disconnect (RDPCLIENT *This)
 
void iso_reset_state (RDPCLIENT *This)
 
void licence_process (RDPCLIENT *This, STREAM s)
 
STREAM mcs_init (RDPCLIENT *This, int length)
 
BOOL mcs_send_to_channel (RDPCLIENT *This, STREAM s, uint16 channel)
 
BOOL mcs_send (RDPCLIENT *This, STREAM s)
 
STREAM mcs_recv (RDPCLIENT *This, uint16 *channel, uint8 *rdpver)
 
BOOL mcs_connect (RDPCLIENT *This, char *server, char *cookie, STREAM mcs_data)
 
BOOL mcs_reconnect (RDPCLIENT *This, char *server, char *cookie, STREAM mcs_data)
 
void mcs_disconnect (RDPCLIENT *This)
 
void mcs_reset_state (RDPCLIENT *This)
 
void process_orders (RDPCLIENT *This, STREAM s, uint16 num_orders)
 
void reset_order_state (RDPCLIENT *This)
 
int parallel_enum_devices (RDPCLIENT *This, uint32 *id, char *optarg)
 
int printer_enum_devices (RDPCLIENT *This, uint32 *id, char *optarg)
 
int printercache_load_blob (char *printer_name, uint8 **data)
 
void printercache_process (RDPCLIENT *This, STREAM s)
 
void pstcache_touch_bitmap (RDPCLIENT *This, uint8 cache_id, uint16 cache_idx, uint32 stamp)
 
BOOL pstcache_load_bitmap (RDPCLIENT *This, uint8 cache_id, uint16 cache_idx)
 
BOOL pstcache_save_bitmap (RDPCLIENT *This, uint8 cache_id, uint16 cache_idx, uint8 *key, uint8 width, uint8 height, uint16 length, uint8 *data)
 
int pstcache_enumerate (RDPCLIENT *This, uint8 id, HASH_KEY *keylist)
 
BOOL pstcache_init (RDPCLIENT *This, uint8 cache_id)
 
int main (int argc, char *argv[])
 
void generate_random (uint8 *random)
 
void error (char *format,...)
 
void warning (char *format,...)
 
void unimpl (char *format,...)
 
void hexdump (unsigned char *p, unsigned int len)
 
charnext_arg (char *src, char needle)
 
void toupper_str (char *p)
 
BOOL str_startswith (const char *s, const char *prefix)
 
BOOL str_handle_lines (RDPCLIENT *This, const char *input, char **rest, str_handle_lines_t linehandler, void *data)
 
BOOL subprocess (RDPCLIENT *This, char *const argv[], str_handle_lines_t linehandler, void *data)
 
charl_to_a (long N, int base)
 
int load_licence (RDPCLIENT *This, unsigned char **data)
 
void save_licence (RDPCLIENT *This, unsigned char *data, int length)
 
BOOL rd_pstcache_mkdir (void)
 
int rd_open_file (char *filename)
 
void rd_close_file (int fd)
 
int rd_read_file (int fd, void *ptr, int len)
 
int rd_write_file (int fd, void *ptr, int len)
 
int rd_lseek_file (int fd, int offset)
 
BOOL rd_lock_file (int fd, int start, int len)
 
BOOL rdp5_process (RDPCLIENT *This, STREAM s)
 
void rdp_out_unistr (RDPCLIENT *This, STREAM s, wchar_t *string, int len)
 
int rdp_in_unistr (RDPCLIENT *This, STREAM s, wchar_t *string, int uni_len)
 
BOOL rdp_send_input (RDPCLIENT *This, uint32 time, uint16 message_type, uint16 device_flags, uint16 param1, uint16 param2)
 
BOOL rdp_send_client_window_status (RDPCLIENT *This, int status)
 
void process_colour_pointer_pdu (RDPCLIENT *This, STREAM s)
 
void process_cached_pointer_pdu (RDPCLIENT *This, STREAM s)
 
void process_system_pointer_pdu (RDPCLIENT *This, STREAM s)
 
void process_bitmap_updates (RDPCLIENT *This, STREAM s)
 
void process_palette (RDPCLIENT *This, STREAM s)
 
void process_disconnect_pdu (STREAM s, uint32 *ext_disc_reason)
 
void rdp_main_loop (RDPCLIENT *This, BOOL *deactivated, uint32 *ext_disc_reason)
 
BOOL rdp_loop (RDPCLIENT *This, BOOL *deactivated, uint32 *ext_disc_reason)
 
BOOL rdp_connect (RDPCLIENT *This, char *server, uint32 flags, wchar_t *username, wchar_t *domain, wchar_t *password, wchar_t *command, wchar_t *directory, wchar_t *hostname, char *cookie)
 
BOOL rdp_reconnect (RDPCLIENT *This, char *server, uint32 flags, wchar_t *username, wchar_t *domain, wchar_t *password, wchar_t *command, wchar_t *directory, wchar_t *hostname, char *cookie)
 
void rdp_reset_state (RDPCLIENT *This)
 
void rdp_disconnect (RDPCLIENT *This)
 
void sec_hash_48 (uint8 *out, uint8 *in, uint8 *salt1, uint8 *salt2, uint8 salt)
 
void sec_hash_16 (uint8 *out, uint8 *in, uint8 *salt1, uint8 *salt2)
 
void buf_out_uint32 (uint8 *buffer, uint32 value)
 
void sec_sign (uint8 *signature, int siglen, uint8 *session_key, int keylen, uint8 *data, int datalen)
 
void sec_decrypt (RDPCLIENT *This, uint8 *data, int length)
 
STREAM sec_init (RDPCLIENT *This, uint32 flags, int maxlen)
 
BOOL sec_send_to_channel (RDPCLIENT *This, STREAM s, uint32 flags, uint16 channel)
 
BOOL sec_send (RDPCLIENT *This, STREAM s, uint32 flags)
 
void sec_process_mcs_data (RDPCLIENT *This, STREAM s)
 
STREAM sec_recv (RDPCLIENT *This, uint8 *rdpver)
 
BOOL sec_connect (RDPCLIENT *This, char *server, wchar_t *hostname, char *cookie)
 
BOOL sec_reconnect (RDPCLIENT *This, char *server, wchar_t *hostname, char *cookie)
 
void sec_disconnect (RDPCLIENT *This)
 
void sec_reset_state (RDPCLIENT *This)
 
STREAM tcp_init (RDPCLIENT *This, uint32 maxlen)
 
BOOL tcp_send (RDPCLIENT *This, STREAM s)
 
STREAM tcp_recv (RDPCLIENT *This, STREAM s, uint32 length)
 
BOOL tcp_connect (RDPCLIENT *This, char *server)
 
BOOL tcp_disconnect (RDPCLIENT *This)
 
wchar_ttcp_get_address (RDPCLIENT *This)
 
void tcp_reset_state (RDPCLIENT *This)
 
void ui_clip_format_announce (RDPCLIENT *This, uint8 *data, uint32 length)
 
void ui_clip_handle_data (RDPCLIENT *This, uint8 *data, uint32 length)
 
void ui_clip_request_failed (RDPCLIENT *This)
 
void ui_clip_request_data (RDPCLIENT *This, uint32 format)
 
void ui_clip_sync (RDPCLIENT *This)
 
void ui_clip_set_mode (RDPCLIENT *This, const char *optarg)
 
void xclip_init (RDPCLIENT *This)
 
void xclip_deinit (RDPCLIENT *This)
 
BOOL get_key_state (RDPCLIENT *This, unsigned int state, uint32 keysym)
 
BOOL ui_init (RDPCLIENT *This)
 
void ui_deinit (RDPCLIENT *This)
 
BOOL ui_create_window (RDPCLIENT *This)
 
void ui_resize_window (RDPCLIENT *This)
 
void ui_destroy_window (RDPCLIENT *This)
 
void xwin_toggle_fullscreen (RDPCLIENT *This)
 
int ui_select (RDPCLIENT *This, SOCKET rdp_socket)
 
void ui_move_pointer (RDPCLIENT *This, int x, int y)
 
HBITMAP ui_create_bitmap (RDPCLIENT *This, int width, int height, uint8 *data)
 
void ui_paint_bitmap (RDPCLIENT *This, int x, int y, int cx, int cy, int width, int height, uint8 *data)
 
void ui_destroy_bitmap (RDPCLIENT *This, HBITMAP bmp)
 
HGLYPH ui_create_glyph (RDPCLIENT *This, int width, int height, const uint8 *data)
 
void ui_destroy_glyph (RDPCLIENT *This, HGLYPH glyph)
 
HCURSOR ui_create_cursor (RDPCLIENT *This, unsigned int x, unsigned int y, int width, int height, uint8 *andmask, uint8 *xormask)
 
void ui_set_cursor (RDPCLIENT *This, HCURSOR cursor)
 
void ui_destroy_cursor (RDPCLIENT *This, HCURSOR cursor)
 
void ui_set_null_cursor (RDPCLIENT *This)
 
HCOLOURMAP ui_create_colourmap (RDPCLIENT *This, COLOURMAP *colours)
 
void ui_destroy_colourmap (RDPCLIENT *This, HCOLOURMAP map)
 
void ui_set_colourmap (RDPCLIENT *This, HCOLOURMAP map)
 
void ui_set_clip (RDPCLIENT *This, int x, int y, int cx, int cy)
 
void ui_reset_clip (RDPCLIENT *This)
 
void ui_bell (RDPCLIENT *This)
 
void ui_destblt (RDPCLIENT *This, uint8 opcode, int x, int y, int cx, int cy)
 
void ui_patblt (RDPCLIENT *This, uint8 opcode, int x, int y, int cx, int cy, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_screenblt (RDPCLIENT *This, uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy)
 
void ui_memblt (RDPCLIENT *This, uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy)
 
void ui_triblt (RDPCLIENT *This, uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_line (RDPCLIENT *This, uint8 opcode, int startx, int starty, int endx, int endy, PEN *pen)
 
void ui_rect (RDPCLIENT *This, int x, int y, int cx, int cy, int colour)
 
void ui_polygon (RDPCLIENT *This, uint8 opcode, uint8 fillmode, POINT *point, int npoints, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_polyline (RDPCLIENT *This, uint8 opcode, POINT *points, int npoints, PEN *pen)
 
void ui_ellipse (RDPCLIENT *This, uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_draw_glyph (RDPCLIENT *This, int mixmode, int x, int y, int cx, int cy, HGLYPH glyph, int srcx, int srcy, int bgcolour, int fgcolour)
 
void ui_draw_text (RDPCLIENT *This, uint8 font, uint8 flags, uint8 opcode, int mixmode, int x, int y, int clipx, int clipy, int clipcx, int clipcy, int boxx, int boxy, int boxcx, int boxcy, BRUSH *brush, int bgcolour, int fgcolour, uint8 *text, uint8 length)
 
void ui_desktop_save (RDPCLIENT *This, uint32 offset, int x, int y, int cx, int cy)
 
void ui_desktop_restore (RDPCLIENT *This, uint32 offset, int x, int y, int cx, int cy)
 
void ui_begin_update (RDPCLIENT *This)
 
void ui_end_update (RDPCLIENT *This)
 
void ui_seamless_begin (RDPCLIENT *This, BOOL hidden)
 
void ui_seamless_hide_desktop (RDPCLIENT *This)
 
void ui_seamless_unhide_desktop (RDPCLIENT *This)
 
void ui_seamless_toggle (RDPCLIENT *This)
 
void ui_seamless_create_window (RDPCLIENT *This, unsigned long id, unsigned long group, unsigned long parent, unsigned long flags)
 
void ui_seamless_destroy_window (RDPCLIENT *This, unsigned long id, unsigned long flags)
 
void ui_seamless_destroy_group (RDPCLIENT *This, unsigned long id, unsigned long flags)
 
void ui_seamless_move_window (RDPCLIENT *This, unsigned long id, int x, int y, int width, int height, unsigned long flags)
 
void ui_seamless_restack_window (RDPCLIENT *This, unsigned long id, unsigned long behind, unsigned long flags)
 
void ui_seamless_settitle (RDPCLIENT *This, unsigned long id, const char *title, unsigned long flags)
 
void ui_seamless_setstate (RDPCLIENT *This, unsigned long id, unsigned int state, unsigned long flags)
 
void ui_seamless_syncbegin (RDPCLIENT *This, unsigned long flags)
 
void ui_seamless_ack (RDPCLIENT *This, unsigned int serial)
 
BOOL lspci_init (RDPCLIENT *This)
 
BOOL seamless_init (RDPCLIENT *This)
 
unsigned int seamless_send_sync (RDPCLIENT *This)
 
unsigned int seamless_send_state (RDPCLIENT *This, unsigned long id, unsigned int state, unsigned long flags)
 
unsigned int seamless_send_position (RDPCLIENT *This, unsigned long id, int x, int y, int width, int height, unsigned long flags)
 
void seamless_select_timeout (RDPCLIENT *This, struct timeval *tv)
 
unsigned int seamless_send_zchange (RDPCLIENT *This, unsigned long id, unsigned long below, unsigned long flags)
 
unsigned int seamless_send_focus (RDPCLIENT *This, unsigned long id, unsigned long flags)
 
BOOL event_pubkey (RDPCLIENT *This, unsigned char *key, unsigned int key_size)
 
void event_logon (RDPCLIENT *This)
 
BOOL event_redirect (RDPCLIENT *This, uint32 flags, uint32 server_len, wchar_t *server, uint32 cookie_len, char *cookie, uint32 username_len, wchar_t *username, uint32 domain_len, wchar_t *domain, uint32 password_len, wchar_t *password)
 

Function Documentation

◆ bitmap_decompress()

BOOL bitmap_decompress ( uint8 output,
int  width,
int  height,
uint8 input,
int  size,
int  Bpp 
)

Definition at line 884 of file bitmap.c.

885{
886 RD_BOOL rv = False;
887
888 switch (Bpp)
889 {
890 case 1:
891 rv = bitmap_decompress1(output, width, height, input, size);
892 break;
893 case 2:
894 rv = bitmap_decompress2(output, width, height, input, size);
895 break;
896 case 3:
897 rv = bitmap_decompress3(output, width, height, input, size);
898 break;
899 case 4:
900 rv = bitmap_decompress4(output, width, height, input, size);
901 break;
902 default:
903 unimpl("Bpp %d\n", Bpp);
904 break;
905 }
906 return rv;
907}
static RD_BOOL bitmap_decompress1(uint8 *output, int width, int height, uint8 *input, int size)
Definition: bitmap.c:67
static RD_BOOL bitmap_decompress3(uint8 *output, int width, int height, uint8 *input, int size)
Definition: bitmap.c:464
static RD_BOOL bitmap_decompress4(uint8 *output, int width, int height, uint8 *input, int size)
Definition: bitmap.c:856
static RD_BOOL bitmap_decompress2(uint8 *output, int width, int height, uint8 *input, int size)
Definition: bitmap.c:265
void unimpl(char *format,...)
Definition: uimain.c:801
#define False
Definition: types.h:25
int RD_BOOL
Definition: types.h:21
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLenum GLenum GLenum input
Definition: glext.h:9031

Referenced by process_bitmap_updates(), process_bmpcache(), and process_bmpcache2().

◆ buf_out_uint32()

void buf_out_uint32 ( uint8 buffer,
uint32  value 
)

Definition at line 304 of file secure.c.

305{
306 buffer[0] = (value) & 0xff;
307 buffer[1] = (value >> 8) & 0xff;
308 buffer[2] = (value >> 16) & 0xff;
309 buffer[3] = (value >> 24) & 0xff;
310}
GLuint buffer
Definition: glext.h:5915
Definition: pdh_main.c:94

Referenced by sec_sign().

◆ cache_bump_bitmap()

void cache_bump_bitmap ( RDPCLIENT This,
uint8  id,
uint16  idx,
int  bump 
)

Definition at line 89 of file cache.c.

90{
91 int p_idx, n_idx, n;
92
93 if (!IS_PERSISTENT(id))
94 return;
95
96 if (This->cache.bmpcache_mru[id] == idx)
97 return;
98
99 DEBUG_RDP5(("bump bitmap: id=%d, idx=%d, bump=%d\n", id, idx, bump));
100
101 n_idx = This->cache.bmpcache[id][idx].next;
102 p_idx = This->cache.bmpcache[id][idx].previous;
103
104 if (IS_SET(n_idx))
105 {
106 /* remove */
107 --This->cache.bmpcache_count[id];
108 if (IS_SET(p_idx))
109 This->cache.bmpcache[id][p_idx].next = n_idx;
110 else
111 This->cache.bmpcache_lru[id] = n_idx;
112 if (IS_SET(n_idx))
113 This->cache.bmpcache[id][n_idx].previous = p_idx;
114 else
115 This->cache.bmpcache_mru[id] = p_idx;
116 }
117 else
118 {
119 p_idx = NOT_SET;
120 n_idx = This->cache.bmpcache_lru[id];
121 }
122
123 if (bump >= 0)
124 {
125 for (n = 0; n < bump && IS_SET(n_idx); n++)
126 {
127 p_idx = n_idx;
128 n_idx = This->cache.bmpcache[id][p_idx].next;
129 }
130 }
131 else
132 {
133 p_idx = This->cache.bmpcache_mru[id];
134 n_idx = NOT_SET;
135 }
136
137 /* insert */
138 ++This->cache.bmpcache_count[id];
139 This->cache.bmpcache[id][idx].previous = p_idx;
140 This->cache.bmpcache[id][idx].next = n_idx;
141
142 if (p_idx >= 0)
143 This->cache.bmpcache[id][p_idx].next = idx;
144 else
145 This->cache.bmpcache_lru[id] = idx;
146
147 if (n_idx >= 0)
148 This->cache.bmpcache[id][n_idx].previous = idx;
149 else
150 This->cache.bmpcache_mru[id] = idx;
151}
#define IS_SET(idx)
Definition: cache.c:31
#define NOT_SET
Definition: cache.c:30
#define IS_PERSISTENT(id)
Definition: precomp.h:26
#define DEBUG_RDP5(args)
Definition: rdesktop.h:141
unsigned int idx
Definition: utils.c:41
GLdouble n
Definition: glext.h:7729
GLuint id
Definition: glext.h:5910

◆ cache_evict_bitmap()

void cache_evict_bitmap ( RDPCLIENT This,
uint8  id 
)

Definition at line 155 of file cache.c.

156{
157 uint16 idx;
158 int n_idx;
159
160 if (!IS_PERSISTENT(id))
161 return;
162
163 idx = This->cache.bmpcache_lru[id];
164 n_idx = This->cache.bmpcache[id][idx].next;
165 DEBUG_RDP5(("evict bitmap: id=%d idx=%d n_idx=%d bmp=0x%x\n", id, idx, n_idx,
166 This->cache.bmpcache[id][idx].bitmap));
167
168 ui_destroy_bitmap(This, This->cache.bmpcache[id][idx].bitmap);
169 --This->cache.bmpcache_count[id];
170 This->cache.bmpcache[id][idx].bitmap = 0;
171
172 This->cache.bmpcache_lru[id] = n_idx;
173 This->cache.bmpcache[id][n_idx].previous = NOT_SET;
174
176}
void ui_destroy_bitmap(RD_HBITMAP bmp)
void pstcache_touch_bitmap(uint8 cache_id, uint16 cache_idx, uint32 stamp)
Definition: pstcache.c:39
unsigned short uint16
Definition: types.h:30

◆ cache_get_bitmap()

HBITMAP cache_get_bitmap ( RDPCLIENT This,
uint8  id,
uint16  idx 
)

Definition at line 180 of file cache.c.

181{
182 if ((id < NUM_ELEMENTS(This->cache.bmpcache)) && (idx < NUM_ELEMENTS(This->cache.bmpcache[0])))
183 {
184 if (This->cache.bmpcache[id][idx].bitmap || pstcache_load_bitmap(This, id, idx))
185 {
186 if (IS_PERSISTENT(id))
188
189 return This->cache.bmpcache[id][idx].bitmap;
190 }
191 }
192 else if ((id < NUM_ELEMENTS(This->cache.volatile_bc)) && (idx == 0x7fff))
193 {
194 return This->cache.volatile_bc[id];
195 }
196
197 error("get bitmap %d:%d\n", id, idx);
198 return NULL;
199}
#define BUMP_COUNT
Definition: cache.c:39
void cache_bump_bitmap(uint8 id, uint16 idx, int bump)
Definition: cache.c:104
#define NUM_ELEMENTS(array)
Definition: cache.c:27
RD_BOOL pstcache_load_bitmap(uint8 cache_id, uint16 cache_idx)
Definition: pstcache.c:53
#define NULL
Definition: types.h:112
#define error(str)
Definition: mkdosfs.c:1605

◆ cache_get_cursor()

HCURSOR cache_get_cursor ( RDPCLIENT This,
uint16  cache_idx 
)

Definition at line 381 of file cache.c.

382{
384
385 if (cache_idx < NUM_ELEMENTS(This->cache.cursorcache))
386 {
387 cursor = This->cache.cursorcache[cache_idx];
388 if (cursor != NULL)
389 return cursor;
390 }
391
392 error("get cursor %d\n", cache_idx);
393 return NULL;
394}
const char cursor[]
Definition: icontest.c:13
HICON HCURSOR
Definition: windef.h:299

◆ cache_get_desktop()

uint8 * cache_get_desktop ( RDPCLIENT This,
uint32  offset,
int  cx,
int  cy,
int  bytes_per_pixel 
)

Definition at line 336 of file cache.c.

337{
338 int length = cx * cy * bytes_per_pixel;
339
340 if (offset > sizeof(This->cache.deskcache))
341 offset = 0;
342
343 if ((offset + length) <= sizeof(This->cache.deskcache))
344 {
345 return &This->cache.deskcache[offset];
346 }
347
348 error("get desktop %d:%d\n", offset, length);
349 return NULL;
350}
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLintptr offset
Definition: glext.h:5920
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585

◆ cache_get_font()

FONTGLYPH * cache_get_font ( RDPCLIENT This,
uint8  font,
uint16  character 
)

Definition at line 262 of file cache.c.

263{
264 FONTGLYPH *glyph;
265
266 if ((font < NUM_ELEMENTS(This->cache.fontcache)) && (character < NUM_ELEMENTS(This->cache.fontcache[0])))
267 {
268 glyph = &This->cache.fontcache[font][character];
269 if (glyph->pixmap != NULL)
270 return glyph;
271 }
272
273 error("get font %d:%d\n", font, character);
274 return NULL;
275}
Definition: mk_font.cpp:20
RD_HBITMAP pixmap
Definition: types.h:116

◆ cache_get_text()

DATABLOB * cache_get_text ( RDPCLIENT This,
uint8  cache_id 
)

Definition at line 306 of file cache.c.

307{
308 DATABLOB *text;
309
310 text = &This->cache.textcache[cache_id];
311 return text;
312}
const WCHAR * text
Definition: package.c:1799

◆ cache_put_bitmap()

void cache_put_bitmap ( RDPCLIENT This,
uint8  id,
uint16  idx,
HBITMAP  bitmap 
)

Definition at line 203 of file cache.c.

204{
205 HBITMAP old;
206
207 if ((id < NUM_ELEMENTS(This->cache.bmpcache)) && (idx < NUM_ELEMENTS(This->cache.bmpcache[0])))
208 {
209 old = This->cache.bmpcache[id][idx].bitmap;
210 if (old != NULL)
212 This->cache.bmpcache[id][idx].bitmap = bitmap;
213
214 if (IS_PERSISTENT(id))
215 {
216 if (old == NULL)
217 This->cache.bmpcache[id][idx].previous = This->cache.bmpcache[id][idx].next = NOT_SET;
218
220 if (This->cache.bmpcache_count[id] > BMPCACHE2_C2_CELLS)
222 }
223 }
224 else if ((id < NUM_ELEMENTS(This->cache.volatile_bc)) && (idx == 0x7fff))
225 {
226 old = This->cache.volatile_bc[id];
227 if (old != NULL)
229 This->cache.volatile_bc[id] = bitmap;
230 }
231 else
232 {
233 error("put bitmap %d:%d\n", id, idx);
234 }
235}
#define TO_TOP
Definition: cache.c:29
void cache_evict_bitmap(uint8 id)
Definition: cache.c:170
#define BMPCACHE2_C2_CELLS
Definition: constants.h:284
static HBITMAP
Definition: button.c:44
Definition: uimain.c:89

◆ cache_put_cursor()

void cache_put_cursor ( RDPCLIENT This,
uint16  cache_idx,
HCURSOR  cursor 
)

Definition at line 398 of file cache.c.

399{
400 HCURSOR old;
401
402 if (cache_idx < NUM_ELEMENTS(This->cache.cursorcache))
403 {
404 old = This->cache.cursorcache[cache_idx];
405 if (old != NULL)
407
408 This->cache.cursorcache[cache_idx] = cursor;
409 }
410 else
411 {
412 error("put cursor %d\n", cache_idx);
413 }
414}
void ui_destroy_cursor(RD_HCURSOR cursor)

◆ cache_put_desktop()

void cache_put_desktop ( RDPCLIENT This,
uint32  offset,
int  cx,
int  cy,
int  scanline,
int  bytes_per_pixel,
uint8 data 
)

Definition at line 354 of file cache.c.

355{
356 int length = cx * cy * bytes_per_pixel;
357
358 if (offset > sizeof(This->cache.deskcache))
359 offset = 0;
360
361 if ((offset + length) <= sizeof(This->cache.deskcache))
362 {
363 cx *= bytes_per_pixel;
364 while (cy--)
365 {
366 memcpy(&This->cache.deskcache[offset], data, cx);
367 data += scanline;
368 offset += cx;
369 }
370 }
371 else
372 {
373 error("put desktop %d:%d\n", offset, length);
374 }
375}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ cache_put_font()

void cache_put_font ( RDPCLIENT This,
uint8  font,
uint16  character,
uint16  offset,
uint16  baseline,
uint16  width,
uint16  height,
HGLYPH  pixmap 
)

Definition at line 279 of file cache.c.

281{
282 FONTGLYPH *glyph;
283
284 if ((font < NUM_ELEMENTS(This->cache.fontcache)) && (character < NUM_ELEMENTS(This->cache.fontcache[0])))
285 {
286 glyph = &This->cache.fontcache[font][character];
287 if (glyph->pixmap != NULL)
289
290 glyph->offset = offset;
291 glyph->baseline = baseline;
292 glyph->width = width;
293 glyph->height = height;
294 glyph->pixmap = pixmap;
295 }
296 else
297 {
298 error("put font %d:%d\n", font, character);
299 }
300}
void ui_destroy_glyph(RD_HGLYPH glyph)
Definition: qtewin.cpp:1424
uint16 width
Definition: types.h:114
sint16 baseline
Definition: types.h:113
uint16 height
Definition: types.h:115
sint16 offset
Definition: types.h:112

◆ cache_put_text()

void cache_put_text ( RDPCLIENT This,
uint8  cache_id,
void data,
int  length 
)

Definition at line 316 of file cache.c.

317{
318 DATABLOB *text;
319 void * p = malloc(length);
320
321 if(p == NULL)
322 return;
323
324 text = &This->cache.textcache[cache_id];
325 if (text->data != NULL)
326 free(text->data);
327 text->data = p;
328 text->size = length;
329 memcpy(text->data, data, length);
330}
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
GLfloat GLfloat p
Definition: glext.h:8902

◆ cache_rebuild_bmpcache_linked_list()

void cache_rebuild_bmpcache_linked_list ( RDPCLIENT This,
uint8  id,
sint16 idx,
int  count 
)

Definition at line 43 of file cache.c.

44{
45 int n = count, c = 0;
46 sint16 n_idx;
47
48 /* find top, skip evicted bitmaps */
49 while (--n >= 0 && This->cache.bmpcache[id][idx[n]].bitmap == NULL);
50 if (n < 0)
51 {
52 This->cache.bmpcache_mru[id] = This->cache.bmpcache_lru[id] = NOT_SET;
53 return;
54 }
55
56 This->cache.bmpcache_mru[id] = idx[n];
57 This->cache.bmpcache[id][idx[n]].next = NOT_SET;
58 n_idx = idx[n];
59 c++;
60
61 /* link list */
62 while (n >= 0)
63 {
64 /* skip evicted bitmaps */
65 while (--n >= 0 && This->cache.bmpcache[id][idx[n]].bitmap == NULL);
66
67 if (n < 0)
68 break;
69
70 This->cache.bmpcache[id][n_idx].previous = idx[n];
71 This->cache.bmpcache[id][idx[n]].next = n_idx;
72 n_idx = idx[n];
73 c++;
74 }
75
76 This->cache.bmpcache[id][n_idx].previous = NOT_SET;
77 This->cache.bmpcache_lru[id] = n_idx;
78
79 if (c != This->cache.bmpcache_count[id])
80 {
81 error("Oops. %d in bitmap cache linked list, %d in ui cache...\n", c,
82 This->cache.bmpcache_count[id]);
83 exit(1);
84 }
85}
signed short sint16
Definition: types.h:31
GLuint GLuint GLsizei count
Definition: gl.h:1545
const GLubyte * c
Definition: glext.h:8905
#define exit(n)
Definition: config.h:202

◆ cache_save_state()

void cache_save_state ( RDPCLIENT This)

Definition at line 239 of file cache.c.

240{
241 uint32 id = 0, t = 0;
242 int idx;
243
244 for (id = 0; id < NUM_ELEMENTS(This->cache.bmpcache); id++)
245 if (IS_PERSISTENT(id))
246 {
247 DEBUG_RDP5(("Saving cache state for bitmap cache %d...", id));
248 idx = This->cache.bmpcache_lru[id];
249 while (idx >= 0)
250 {
252 idx = This->cache.bmpcache[id][idx].next;
253 }
254 DEBUG_RDP5((" %d stamps written.\n", t));
255 }
256}
unsigned int uint32
Definition: types.h:32
GLdouble GLdouble t
Definition: gl.h:2047

◆ channel_init()

STREAM channel_init ( RDPCLIENT This,
VCHANNEL channel,
uint32  length 
)

Definition at line 66 of file channels.c.

67{
68 STREAM s;
69
70 s = sec_init(This, This->encryption ? SEC_ENCRYPT : 0, length + 8);
71 s_push_layer(s, channel_hdr, 8);
72 return s;
73}
#define SEC_ENCRYPT
Definition: constants.h:101
#define s_push_layer(s, h, n)
Definition: parse.h:39
STREAM sec_init(uint32 flags, int maxlen)
Definition: secure.c:419
GLdouble s
Definition: gl.h:2039
Definition: parse.h:23

◆ channel_process()

void channel_process ( RDPCLIENT This,
STREAM  s,
uint16  mcs_channel 
)

Definition at line 413 of file rdesktop-core-tester.cpp.

414{
415}

◆ channel_register()

VCHANNEL * channel_register ( RDPCLIENT This,
char name,
uint32  flags,
void(*)(RDPCLIENT *, STREAM callback 
)

Definition at line 43 of file channels.c.

44{
45 VCHANNEL *channel;
46
47 if (!This->use_rdp5)
48 return NULL;
49
50 if (This->num_channels >= MAX_CHANNELS)
51 {
52 error("Channel table full, increase MAX_CHANNELS\n");
53 return NULL;
54 }
55
56 channel = &This->channels[This->num_channels];
57 channel->mcs_id = MCS_GLOBAL_CHANNEL + 1 + This->num_channels;
58 strncpy(channel->name, name, 8);
59 channel->flags = flags;
60 channel->process = callback;
61 This->num_channels++;
62 return channel;
63}
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
#define MAX_CHANNELS
Definition: channels.c:23
#define MCS_GLOBAL_CHANNEL
Definition: constants.h:87
GLbitfield flags
Definition: glext.h:7161
static IPrintDialogCallback callback
Definition: printdlg.c:326
void(* process)(STREAM)
Definition: types.h:156
uint32 flags
Definition: types.h:154
char name[8]
Definition: types.h:153
uint16 mcs_id
Definition: types.h:152
Definition: name.c:39

◆ channel_send()

void channel_send ( RDPCLIENT This,
STREAM  s,
VCHANNEL channel 
)

Definition at line 76 of file channels.c.

77{
79 uint32 thislength, remaining;
80 uint8 *data;
81
82 /* first fragment sent in-place */
83 s_pop_layer(s, channel_hdr);
84 length = s->end - s->p - sizeof(CHANNEL_PDU_HEADER);
85
86 DEBUG_CHANNEL(("channel_send, length = %d\n", length));
87
88 thislength = MIN(length, CHANNEL_CHUNK_LENGTH);
89/* Note: In the original clipboard implementation, this number was
90 1592, not 1600. However, I don't remember the reason and 1600 seems
91 to work so.. This applies only to *this* length, not the length of
92 continuation or ending packets. */
93 remaining = length - thislength;
97
100 data = s->end = s->p + thislength;
101 DEBUG_CHANNEL(("Sending %d bytes with FLAG_FIRST\n", thislength));
102 sec_send_to_channel(This, s, This->encryption ? SEC_ENCRYPT : 0, channel->mcs_id);
103
104 /* subsequent segments copied (otherwise would have to generate headers backwards) */
105 while (remaining > 0)
106 {
107 thislength = MIN(remaining, CHANNEL_CHUNK_LENGTH);
108 remaining -= thislength;
109 flags = (remaining == 0) ? CHANNEL_FLAG_LAST : 0;
110 if (channel->flags & CHANNEL_OPTION_SHOW_PROTOCOL)
112
113 DEBUG_CHANNEL(("Sending %d bytes with flags %d\n", thislength, flags));
114
115 s = sec_init(This, This->encryption ? SEC_ENCRYPT : 0, thislength + 8);
118 out_uint8p(s, data, thislength);
119 s_mark_end(s);
120 sec_send_to_channel(This, s, This->encryption ? SEC_ENCRYPT : 0, channel->mcs_id);
121
122 data += thislength;
123 }
124}
#define CHANNEL_FLAG_LAST
Definition: channels.c:26
#define CHANNEL_CHUNK_LENGTH
Definition: channels.c:24
#define CHANNEL_FLAG_FIRST
Definition: channels.c:25
#define CHANNEL_FLAG_SHOW_PROTOCOL
Definition: channels.c:27
#define CHANNEL_OPTION_SHOW_PROTOCOL
Definition: constants.h:434
#define s_mark_end(s)
Definition: parse.h:41
#define out_uint32_le(s, v)
Definition: parse.h:59
#define s_pop_layer(s, h)
Definition: parse.h:40
#define out_uint8p(s, v, n)
Definition: parse.h:93
void sec_send_to_channel(STREAM s, uint32 flags, uint16 channel)
Definition: secure.c:436
#define DEBUG_CHANNEL(args)
Definition: rdesktop.h:159
#define MIN(x, y)
Definition: rdesktop.h:171
unsigned char uint8
Definition: types.h:28

◆ cliprdr_init()

BOOL cliprdr_init ( RDPCLIENT This)

Definition at line 174 of file cliprdr.c.

175{
176 This->cliprdr.channel =
177 channel_register(This, "cliprdr",
181 return (This->cliprdr.channel != NULL);
182}
VCHANNEL * channel_register(char *name, uint32 flags, void(*callback)(STREAM))
Definition: channels.c:46
#define CHANNEL_OPTION_ENCRYPT_RDP
Definition: constants.h:432
#define CHANNEL_OPTION_INITIALIZED
Definition: constants.h:431
#define CHANNEL_OPTION_COMPRESS_RDP
Definition: constants.h:433
static void cliprdr_process(RDPCLIENT *This, STREAM s)
Definition: cliprdr.c:109

◆ cliprdr_send_data()

void cliprdr_send_data ( RDPCLIENT This,
uint8 data,
uint32  length 
)

Definition at line 102 of file cliprdr.c.

103{
104 DEBUG_CLIPBOARD(("cliprdr_send_data\n"));
106}
#define DEBUG_CLIPBOARD(args)
Definition: rdesktop.h:147
static void cliprdr_send_packet(RDPCLIENT *This, uint16 type, uint16 status, uint8 *data, uint32 length)
Definition: cliprdr.c:35
#define CLIPRDR_DATA_RESPONSE
Definition: cliprdr.c:28
#define CLIPRDR_RESPONSE
Definition: cliprdr.c:31

◆ cliprdr_send_data_request()

void cliprdr_send_data_request ( RDPCLIENT This,
uint32  format 
)

Definition at line 92 of file cliprdr.c.

93{
94 uint8 buffer[4];
95
96 DEBUG_CLIPBOARD(("cliprdr_send_data_request\n"));
99}
void buf_out_uint32(uint8 *buffer, uint32 value)
Definition: secure.c:304
#define CLIPRDR_DATA_REQUEST
Definition: cliprdr.c:27
#define CLIPRDR_REQUEST
Definition: cliprdr.c:30
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546

◆ cliprdr_send_native_format_announce()

void cliprdr_send_native_format_announce ( RDPCLIENT This,
uint8 formats_data,
uint32  formats_data_length 
)

Definition at line 73 of file cliprdr.c.

74{
75 DEBUG_CLIPBOARD(("cliprdr_send_native_format_announce\n"));
76
78 formats_data_length);
79
80 if (formats_data != This->cliprdr.last_formats)
81 {
82 if (This->cliprdr.last_formats)
83 xfree(This->cliprdr.last_formats);
84
85 This->cliprdr.last_formats = xmalloc(formats_data_length);
86 memcpy(This->cliprdr.last_formats, formats_data, formats_data_length);
87 This->cliprdr.last_formats_length = formats_data_length;
88 }
89}
void xfree(void *mem)
Definition: uimain.c:758
void * xmalloc(int size)
Definition: uimain.c:747
#define CLIPRDR_FORMAT_ANNOUNCE
Definition: cliprdr.c:25

Referenced by cliprdr_process(), and cliprdr_send_simple_native_format_announce().

◆ cliprdr_send_simple_native_format_announce()

void cliprdr_send_simple_native_format_announce ( RDPCLIENT This,
uint32  format 
)

Definition at line 57 of file cliprdr.c.

58{
59 uint8 buffer[36];
60
61 DEBUG_CLIPBOARD(("cliprdr_send_simple_native_format_announce\n"));
62
64 memset(buffer + 4, 0, sizeof(buffer) - 4); /* description */
66}
void cliprdr_send_native_format_announce(RDPCLIENT *This, uint8 *formats_data, uint32 formats_data_length)
Definition: cliprdr.c:73
#define memset(x, y, z)
Definition: compat.h:39

◆ cliprdr_set_mode()

void cliprdr_set_mode ( RDPCLIENT This,
const char optarg 
)

Definition at line 168 of file cliprdr.c.

169{
171}
void ui_clip_set_mode(const char *optarg)
const char * optarg
Definition: getopt.c:49

◆ error()

void error ( char format,
  ... 
)

Definition at line 817 of file uimain.c.

818{
819 va_list ap;
820 char text[512];
821 char text1[512];
822
823 sprintf(text1, "ERROR: ");
826 va_end(ap);
827 strcat(text1, text);
828 mi_error(text1);
829}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
#define sprintf(buf, format,...)
Definition: sprintf.c:55
void mi_error(char *msg)
Definition: win32.c:131
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36

◆ event_logon()

void event_logon ( RDPCLIENT This)

Definition at line 5908 of file activex.cpp.

5909{
5910 RdpClient::OnLogon(This);
5911}

Referenced by process_data_pdu().

◆ event_pubkey()

BOOL event_pubkey ( RDPCLIENT This,
unsigned char key,
unsigned int  key_size 
)

Definition at line 5900 of file activex.cpp.

5901{
5902 if(!RdpClient::OnPublicKey(This, key, key_size))
5903 return FALSE;
5904 else
5905 return TRUE;
5906}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
Definition: copy.c:22

◆ event_redirect()

BOOL event_redirect ( RDPCLIENT This,
uint32  flags,
uint32  server_len,
wchar_t server,
uint32  cookie_len,
char cookie,
uint32  username_len,
wchar_t username,
uint32  domain_len,
wchar_t domain,
uint32  password_len,
wchar_t password 
)

Definition at line 5913 of file activex.cpp.

5914{
5915 if
5916 (
5917 !RdpClient::OnRedirect
5918 (
5919 This,
5920 flags,
5921 server_len,
5922 server,
5923 cookie_len,
5924 cookie,
5925 username_len,
5926 username,
5927 domain_len,
5928 domain,
5929 password_len,
5930 password
5931 )
5932 )
5933 return FALSE;
5934 else
5935 return TRUE;
5936}
static WCHAR password[]
Definition: url.c:33
static WCHAR username[]
Definition: url.c:32
Definition: cookie.c:34
Definition: cookie.c:42
static rfbScreenInfoPtr server
Definition: vnc.c:74

Referenced by process_redirect_pdu().

◆ ewmh_init()

void ewmh_init ( RDPCLIENT This)

Definition at line 167 of file ewmhints.c.

168{
169 /* FIXME: Use XInternAtoms */
170 This->ewmhints.state_maximized_vert_atom =
171 XInternAtom(This->display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
172 This->ewmhints.state_maximized_horz_atom =
173 XInternAtom(This->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
174 This->ewmhints.state_hidden_atom = XInternAtom(This->display, "_NET_WM_STATE_HIDDEN", False);
175 This->ewmhints.state_skip_taskbar_atom =
176 XInternAtom(This->display, "_NET_WM_STATE_SKIP_TASKBAR", False);
177 This->ewmhints.state_skip_pager_atom = XInternAtom(This->display, "_NET_WM_STATE_SKIP_PAGER", False);
178 This->ewmhints.state_modal_atom = XInternAtom(This->display, "_NET_WM_STATE_MODAL", False);
179 This->net_wm_state_atom = XInternAtom(This->display, "_NET_WM_STATE", False);
180 This->net_wm_desktop_atom = XInternAtom(This->display, "_NET_WM_DESKTOP", False);
181 This->ewmhints.name_atom = XInternAtom(This->display, "_NET_WM_NAME", False);
182 This->ewmhints.utf8_string_atom = XInternAtom(This->display, "UTF8_STRING", False);
183}

◆ generate_random()

void generate_random ( uint8 random)

Definition at line 709 of file uimain.c.

710{
711 int i;
712
713 rand();
714 rand();
715 for (i = 0; i < 32; i++)
716 {
717 random[i] = rand(); /* higher bits are more random */
718 }
719}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_ int __cdecl rand(void)
Definition: rand.c:10
#define random
Definition: rosdhcp.h:81

◆ get_current_workarea()

int get_current_workarea ( RDPCLIENT This,
uint32 x,
uint32 y,
uint32 width,
uint32 height 
)

Definition at line 123 of file ewmhints.c.

124{
125 int current_desktop;
126 unsigned long nitems_return;
127 unsigned char *prop_return;
128 uint32 *return_words;
129 const uint32 net_workarea_x_offset = 0;
130 const uint32 net_workarea_y_offset = 1;
131 const uint32 net_workarea_width_offset = 2;
132 const uint32 net_workarea_height_offset = 3;
133 const uint32 max_prop_length = 32 * 4; /* Max 32 desktops */
134
136 (This, DefaultRootWindow(This->display), "_NET_WORKAREA", max_prop_length, &nitems_return,
137 &prop_return, 0) < 0)
138 return (-1);
139
140 if (nitems_return % 4)
141 {
142 fprintf(stderr, "_NET_WORKAREA has odd length\n");
143 return (-1);
144 }
145
146 current_desktop = get_current_desktop(This);
147
148 if (current_desktop < 0)
149 return -1;
150
151 return_words = (uint32 *) prop_return;
152
153 *x = return_words[current_desktop * 4 + net_workarea_x_offset];
154 *y = return_words[current_desktop * 4 + net_workarea_y_offset];
155 *width = return_words[current_desktop * 4 + net_workarea_width_offset];
156 *height = return_words[current_desktop * 4 + net_workarea_height_offset];
157
158 XFree(prop_return);
159
160 return (0);
161
162}
static int get_property_value(RDPCLIENT *This, Window wnd, char *propname, long max_length, unsigned long *nitems_return, unsigned char **prop_return, int nowarn)
Definition: ewmhints.c:38
static int get_current_desktop(RDPCLIENT *This)
Definition: ewmhints.c:95
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)

◆ get_key_state()

BOOL get_key_state ( RDPCLIENT This,
unsigned int  state,
uint32  keysym 
)

Definition at line 1143 of file xwin.c.

1144{
1145 int modifierpos, key, keysymMask = 0;
1146 int offset;
1147
1148 KeyCode keycode = XKeysymToKeycode(This->display, keysym);
1149
1150 if (keycode == NoSymbol)
1151 return False;
1152
1153 for (modifierpos = 0; modifierpos < 8; modifierpos++)
1154 {
1155 offset = This->xwin.mod_map->max_keypermod * modifierpos;
1156
1157 for (key = 0; key < This->xwin.mod_map->max_keypermod; key++)
1158 {
1159 if (This->xwin.mod_map->modifiermap[offset + key] == keycode)
1160 keysymMask |= 1 << modifierpos;
1161 }
1162 }
1163
1164 return (state & keysymMask) ? True : False;
1165}
static int state
Definition: maze.c:121
#define True
Definition: types.h:24
#define NoSymbol
Definition: x11stubs.h:10

◆ hexdump()

void hexdump ( unsigned char p,
unsigned int  len 
)

Definition at line 234 of file shimdbg.c.

235{
236 unsigned char *line = p;
237 unsigned int i, thisline, offset = 0;
238
239 while (offset < len)
240 {
241 xprintf("%04x ", offset);
242 thisline = len - offset;
243 if (thisline > 16)
244 thisline = 16;
245
246 for (i = 0; i < thisline; i++)
247 xprintf("%02x ", line[i]);
248
249 for (; i < 16; i++)
250 xprintf(" ");
251
252 for (i = 0; i < thisline; i++)
253 xprintf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
254
255 xprintf("\n");
256 offset += thisline;
257 line += thisline;
258 }
259}
GLenum GLsizei len
Definition: glext.h:6722
void xprintf(const char *fmt,...)
Definition: shimdbg.c:16
Definition: parser.c:49

Referenced by DumpRegistryData().

◆ iso_connect()

BOOL iso_connect ( RDPCLIENT This,
char server,
char cookie 
)

Definition at line 179 of file iso.c.

180{
181 uint8 code = 0;
182
183 if (!tcp_connect(This, server))
184 return False;
185
187 return False;
188
189 if (iso_recv_msg(This, &code, NULL) == NULL)
190 return False;
191
192 if (code != ISO_PDU_CC)
193 {
194 error("expected CC, got 0x%x\n", code);
196 return False;
197 }
198
199 return True;
200}
@ ISO_PDU_CC
Definition: constants.h:30
static STREAM iso_recv_msg(uint8 *code, uint8 *rdpver)
Definition: iso.c:101
static void iso_send_connection_request(char *username, uint32 neg_proto)
Definition: iso.c:60
void tcp_disconnect(void)
Definition: tcp.c:832
RD_BOOL tcp_connect(char *server)
Definition: tcp.c:717
Definition: inflate.c:139

◆ iso_disconnect()

BOOL iso_disconnect ( RDPCLIENT This)

Definition at line 229 of file iso.c.

230{
232 return tcp_disconnect(This);
233}
@ ISO_PDU_DR
Definition: constants.h:31
static void iso_send_msg(uint8 code)
Definition: iso.c:39

◆ iso_init()

STREAM iso_init ( RDPCLIENT This,
int  length 
)

Definition at line 122 of file iso.c.

123{
124 STREAM s;
125
126 s = tcp_init(This, length + 7);
127
128 if(s == NULL)
129 return NULL;
130
131 s_push_layer(s, iso_hdr, 7);
132
133 return s;
134}
STREAM tcp_init(uint32 maxlen)
Definition: tcp.c:82

◆ iso_reconnect()

BOOL iso_reconnect ( RDPCLIENT This,
char server,
char cookie 
)

Definition at line 204 of file iso.c.

205{
206 uint8 code = 0;
207
208 if (!tcp_connect(This, server))
209 return False;
210
211 if (!iso_send_connection_request(This, cookie)) // BUGBUG should we really pass the cookie here?
212 return False;
213
214 if (iso_recv_msg(This, &code, NULL) == NULL)
215 return False;
216
217 if (code != ISO_PDU_CC)
218 {
219 error("expected CC, got 0x%x\n", code);
221 return False;
222 }
223
224 return True;
225}

Referenced by mcs_reconnect().

◆ iso_recv()

STREAM iso_recv ( RDPCLIENT This,
uint8 rdpver 
)

Definition at line 158 of file iso.c.

159{
160 STREAM s;
161 uint8 code = 0;
162
163 s = iso_recv_msg(This, &code, rdpver);
164 if (s == NULL)
165 return NULL;
166 if (rdpver != NULL)
167 if (*rdpver != 3)
168 return s;
169 if (code != ISO_PDU_DT)
170 {
171 error("expected DT, got 0x%x\n", code);
172 return NULL;
173 }
174 return s;
175}
@ ISO_PDU_DT
Definition: constants.h:32

◆ iso_reset_state()

void iso_reset_state ( RDPCLIENT This)

Definition at line 237 of file iso.c.

238{
240}
void tcp_reset_state(void)
Definition: tcp.c:894

◆ iso_send()

BOOL iso_send ( RDPCLIENT This,
STREAM  s 
)

Definition at line 138 of file iso.c.

139{
141
142 s_pop_layer(s, iso_hdr);
143 length = (uint16)(s->end - s->p);
144
145 out_uint8(s, 3); /* version */
146 out_uint8(s, 0); /* reserved */
148
149 out_uint8(s, 2); /* hdrlen */
150 out_uint8(s, ISO_PDU_DT); /* code */
151 out_uint8(s, 0x80); /* eot */
152
153 return tcp_send(This, s);
154}
#define out_uint8(s, v)
Definition: parse.h:92
#define out_uint16_be(s, v)
Definition: parse.h:77
void tcp_send(STREAM s)
Definition: tcp.c:270

◆ l_to_a()

char * l_to_a ( long  N,
int  base 
)

Definition at line 1356 of file rdesktop.c.

1357{
1358 static char ret[LTOA_BUFSIZE];
1359
1360 char *head = ret, buf[LTOA_BUFSIZE], *tail = buf + sizeof(buf);
1361
1362 register int divrem;
1363
1364 if (base < 36 || 2 > base)
1365 base = 10;
1366
1367 if (N < 0)
1368 {
1369 *head++ = '-';
1370 N = -N;
1371 }
1372
1373 tail = buf + sizeof(buf);
1374 *--tail = 0;
1375
1376 do
1377 {
1378 divrem = N % base;
1379 *--tail = (divrem <= 9) ? divrem + '0' : divrem + 'a' - 10;
1380 N /= base;
1381 }
1382 while (N);
1383
1384 strcpy(head, tail);
1385 return ret;
1386}
#define N
Definition: crc32.c:57
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
struct outqueuenode * tail
Definition: adnsresfilter.c:66
struct outqueuenode * head
Definition: adnsresfilter.c:66
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define LTOA_BUFSIZE
Definition: rdesktop.c:1353
int ret

◆ licence_process()

void licence_process ( RDPCLIENT This,
STREAM  s 
)

Definition at line 300 of file licence.c.

301{
302 uint8 tag;
303
304 in_uint8(s, tag);
305 in_uint8s(s, 3); /* version, length */
306
307 switch (tag)
308 {
311 break;
312
315 break;
316
319 break;
320
323 break;
324
325 default:
326 unimpl("licence tag 0x%x\n", tag);
327 }
328}
#define in_uint8s(s, n)
Definition: parse.h:91
#define in_uint8(s, v)
Definition: parse.h:88
#define LICENCE_TAG_DEMAND
Definition: constants.h:94
#define LICENCE_TAG_AUTHREQ
Definition: constants.h:95
#define LICENCE_TAG_ISSUE
Definition: constants.h:96
#define LICENCE_TAG_REISSUE
Definition: constants.h:97
#define LICENCE_TAG_RESULT
Definition: constants.h:101
static void licence_process_issue(RDPCLIENT *This, STREAM s)
Definition: licence.c:261
static BOOL licence_process_demand(RDPCLIENT *This, STREAM s)
Definition: licence.c:136
static void licence_process_authreq(RDPCLIENT *This, STREAM s)
Definition: licence.c:229
Definition: ecma_167.h:138

◆ load_licence()

int load_licence ( RDPCLIENT This,
unsigned char **  data 
)

Definition at line 172 of file rdesktop-core-tester.cpp.

173 {
174 return -1;
175 }

◆ lspci_init()

BOOL lspci_init ( RDPCLIENT This)

Definition at line 152 of file lspci.c.

153{
157 return (lspci_channel != NULL);
158}
static void lspci_process(RDPCLIENT *This, STREAM s)
Definition: lspci.c:131
static VCHANNEL * lspci_channel
Definition: lspci.c:25

◆ main()

int main ( int  argc,
char argv[] 
)

Definition at line 31 of file evtmsggen.c.

32{
33 FILE* outFile;
34 unsigned int id_min, id_max;
35 unsigned int i;
36
37 /* Validate the arguments */
38 if (argc != 4)
39 {
40 usage(argv[0]);
41 return -1;
42 }
43
44 id_min = (unsigned int)atoi(argv[1]);
45 id_max = (unsigned int)atoi(argv[2]);
46 if (id_min > id_max)
47 {
48 fprintf(stderr, "ERROR: Min ID %u cannot be strictly greater than Max ID %u !\n", id_min, id_max);
49 return -1;
50 }
51
52 /* Open the file */
53 outFile = fopen(argv[3], "wb");
54 if (!outFile)
55 {
56 fprintf(stderr, "ERROR: Could not create output file '%s'.\n", argv[3]);
57 return -1;
58 }
59
60 /* Generate the file */
61
62 /* Write the header */
63 fprintf(outFile,
64 ";/*" EOL
65 "; * %s" EOL
66 "; * Contains event message string templates for the EventCreate Command." EOL
67 "; *" EOL
68 "; * This file is autogenerated, do not edit." EOL
69 "; * Generated with:" EOL
70 "; * %s %u %u %s" EOL
71 "; */" EOL
72 EOL
73#ifdef ENGLISH
74 "LanguageNames=(English=0x409:MSG00409)" EOL
75#else
76 "LanguageNames=(Neutral=0x0000:MSG00000)" EOL
77#endif
78 "MessageIdTypedef=DWORD" EOL
79 EOL,
80 argv[3],
81 argv[0], id_min /* argv[1] */, id_max /* argv[2] */, argv[3]);
82
83 /* Write the message string templates */
84 for (i = id_min; i <= id_max; ++i)
85 {
86 fprintf(outFile,
87 "MessageId=0x%X" EOL
88#ifdef ENGLISH
89 "Language=English" EOL
90#else
91 "Language=Neutral" EOL
92#endif
93 "%%1" EOL
94 "." EOL
95 EOL,
96 i);
97 }
98
99 /* Close the file */
100 fclose(outFile);
101
102 return 0;
103}
static int argc
Definition: ServiceArgs.c:12
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define EOL
Definition: evtmsggen.c:23
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define argv
Definition: mplay32.c:18

◆ mcs_connect()

BOOL mcs_connect ( RDPCLIENT This,
char server,
char cookie,
STREAM  mcs_data 
)

Definition at line 388 of file mcs.c.

389{
390 unsigned int i;
391
393 return False;
394
395 if (!mcs_send_connect_initial(This, mcs_data) || !mcs_recv_connect_response(This, mcs_data))
396 goto error;
397
399 goto error;
400
401 if (!mcs_recv_aucf(This, &This->mcs_userid))
402 goto error;
403
405 goto error;
406
408 goto error;
409
410 for (i = 0; i < This->num_channels; i++)
411 {
413 goto error;
414 }
415 return True;
416
417 error:
419 return False;
420}
#define MCS_USERCHANNEL_BASE
Definition: constants.h:88
RD_BOOL iso_connect(char *server, char *username, char *domain, char *password, RD_BOOL reconnect, uint32 *selected_protocol)
Definition: iso.c:203
void iso_disconnect(void)
Definition: iso.c:362
static void mcs_send_cjrq(uint16 chanid)
Definition: mcs.c:192
static void mcs_send_edrq(void)
Definition: mcs.c:131
static RD_BOOL mcs_recv_aucf(uint16 *mcs_userid)
Definition: mcs.c:161
static void mcs_send_aurq(void)
Definition: mcs.c:147
static RD_BOOL mcs_recv_connect_response(STREAM mcs_data)
Definition: mcs.c:87
static RD_BOOL mcs_recv_cjcf(void)
Definition: mcs.c:210
static void mcs_send_connect_initial(STREAM mcs_data)
Definition: mcs.c:57

Referenced by sec_connect().

◆ mcs_disconnect()

void mcs_disconnect ( RDPCLIENT This)

Definition at line 460 of file mcs.c.

461{
463}

◆ mcs_init()

STREAM mcs_init ( RDPCLIENT This,
int  length 
)

Definition at line 314 of file mcs.c.

315{
316 STREAM s;
317
318 s = iso_init(This, length + 8);
319
320 if(s == NULL)
321 return NULL;
322
323 s_push_layer(s, mcs_hdr, 8);
324
325 return s;
326}
STREAM iso_init(int length)
Definition: iso.c:150

◆ mcs_reconnect()

BOOL mcs_reconnect ( RDPCLIENT This,
char server,
char cookie,
STREAM  mcs_data 
)

Definition at line 424 of file mcs.c.

425{
426 unsigned int i;
427
429 return False;
430
431 if (!mcs_send_connect_initial(This, mcs_data) || !mcs_recv_connect_response(This, mcs_data))
432 goto error;
433
435 goto error;
436
437 if (!mcs_recv_aucf(This, &This->mcs_userid))
438 goto error;
439
441 goto error;
442
444 goto error;
445
446 for (i = 0; i < This->num_channels; i++)
447 {
449 goto error;
450 }
451 return True;
452
453 error:
455 return False;
456}
BOOL iso_reconnect(RDPCLIENT *This, char *server, char *cookie)
Definition: iso.c:204

Referenced by sec_reconnect().

◆ mcs_recv()

STREAM mcs_recv ( RDPCLIENT This,
uint16 channel,
uint8 rdpver 
)

Definition at line 356 of file mcs.c.

357{
358 uint8 opcode, appid, length;
359 STREAM s;
360
361 s = iso_recv(This, rdpver);
362 if (s == NULL)
363 return NULL;
364 if (rdpver != NULL)
365 if (*rdpver != 3)
366 return s;
367 in_uint8(s, opcode);
368 appid = opcode >> 2;
369 if (appid != MCS_SDIN)
370 {
371 if (appid != MCS_DPUM)
372 {
373 error("expected data, got %d\n", opcode);
374 }
375 return NULL;
376 }
377 in_uint8s(s, 2); /* userid */
378 in_uint16_be(s, *channel);
379 in_uint8s(s, 1); /* flags */
380 in_uint8(s, length);
381 if (length & 0x80)
382 in_uint8s(s, 1); /* second byte of length */
383 return s;
384}
@ MCS_SDIN
Definition: constants.h:71
@ MCS_DPUM
Definition: constants.h:65
STREAM iso_recv(uint8 *rdpver)
Definition: iso.c:182
#define in_uint16_be(s, v)
Definition: parse.h:75
char * appid
Definition: mkisofs.c:161

◆ mcs_reset_state()

void mcs_reset_state ( RDPCLIENT This)

Definition at line 467 of file mcs.c.

468{
469 This->mcs_userid = 0;
471}
void iso_reset_state(void)
Definition: iso.c:370

◆ mcs_send()

BOOL mcs_send ( RDPCLIENT This,
STREAM  s 
)

Definition at line 349 of file mcs.c.

350{
352}
void mcs_send_to_channel(STREAM s, uint16 channel)
Definition: mcs.c:254

◆ mcs_send_to_channel()

BOOL mcs_send_to_channel ( RDPCLIENT This,
STREAM  s,
uint16  channel 
)

Definition at line 330 of file mcs.c.

331{
333
334 s_pop_layer(s, mcs_hdr);
335 length = (uint16)(s->end - s->p - 8);
336 length |= 0x8000;
337
338 out_uint8(s, (MCS_SDRQ << 2));
339 out_uint16_be(s, This->mcs_userid);
340 out_uint16_be(s, channel);
341 out_uint8(s, 0x70); /* flags */
343
344 return iso_send(This, s);
345}
@ MCS_SDRQ
Definition: constants.h:70
void iso_send(STREAM s)
Definition: iso.c:162

◆ mppc_expand()

int mppc_expand ( RDPCLIENT This,
uint8 data,
uint32  clen,
uint8  ctype,
uint32 roff,
uint32 rlen 
)

Definition at line 56 of file mppc.c.

57{
58 int k, walker_len = 0, walker;
59 uint32 i = 0;
60 int next_offset, match_off;
61 int match_len;
62 int old_offset, match_bits;
63 BOOL big = ctype & RDP_MPPC_BIG ? True : False;
64
65 uint8 *dict = This->mppc_dict.hist;
66
67 if ((ctype & RDP_MPPC_COMPRESSED) == 0)
68 {
69 *roff = 0;
70 *rlen = clen;
71 return 0;
72 }
73
74 if ((ctype & RDP_MPPC_RESET) != 0)
75 {
76 This->mppc_dict.roff = 0;
77 }
78
79 if ((ctype & RDP_MPPC_FLUSH) != 0)
80 {
81 memset(dict, 0, RDP_MPPC_DICT_SIZE);
82 This->mppc_dict.roff = 0;
83 }
84
85 *roff = 0;
86 *rlen = 0;
87
88 walker = This->mppc_dict.roff;
89
90 next_offset = walker;
91 old_offset = next_offset;
92 *roff = old_offset;
93 if (clen == 0)
94 return 0;
95 clen += i;
96
97 do
98 {
99 if (walker_len == 0)
100 {
101 if (i >= clen)
102 break;
103 walker = data[i++] << 24;
104 walker_len = 8;
105 }
106 if (walker >= 0)
107 {
108 if (walker_len < 8)
109 {
110 if (i >= clen)
111 {
112 if (walker != 0)
113 return -1;
114 break;
115 }
116 walker |= (data[i++] & 0xff) << (24 - walker_len);
117 walker_len += 8;
118 }
119 if (next_offset >= RDP_MPPC_DICT_SIZE)
120 return -1;
121 dict[next_offset++] = (((uint32) walker) >> ((uint32) 24));
122 walker <<= 8;
123 walker_len -= 8;
124 continue;
125 }
126 walker <<= 1;
127 /* fetch next 8-bits */
128 if (--walker_len == 0)
129 {
130 if (i >= clen)
131 return -1;
132 walker = data[i++] << 24;
133 walker_len = 8;
134 }
135 /* literal decoding */
136 if (walker >= 0)
137 {
138 if (walker_len < 8)
139 {
140 if (i >= clen)
141 return -1;
142 walker |= (data[i++] & 0xff) << (24 - walker_len);
143 walker_len += 8;
144 }
145 if (next_offset >= RDP_MPPC_DICT_SIZE)
146 return -1;
147 dict[next_offset++] = (uint8) (walker >> 24 | 0x80);
148 walker <<= 8;
149 walker_len -= 8;
150 continue;
151 }
152
153 /* decode offset */
154 /* length pair */
155 walker <<= 1;
156 if (--walker_len < (big ? 3 : 2))
157 {
158 if (i >= clen)
159 return -1;
160 walker |= (data[i++] & 0xff) << (24 - walker_len);
161 walker_len += 8;
162 }
163
164 if (big)
165 {
166 /* offset decoding where offset len is:
167 -63: 11111 followed by the lower 6 bits of the value
168 64-319: 11110 followed by the lower 8 bits of the value ( value - 64 )
169 320-2367: 1110 followed by lower 11 bits of the value ( value - 320 )
170 2368-65535: 110 followed by lower 16 bits of the value ( value - 2368 )
171 */
172 switch (((uint32) walker) >> ((uint32) 29))
173 {
174 case 7: /* - 63 */
175 for (; walker_len < 9; walker_len += 8)
176 {
177 if (i >= clen)
178 return -1;
179 walker |= (data[i++] & 0xff) << (24 - walker_len);
180 }
181 walker <<= 3;
182 match_off = ((uint32) walker) >> ((uint32) 26);
183 walker <<= 6;
184 walker_len -= 9;
185 break;
186
187 case 6: /* 64 - 319 */
188 for (; walker_len < 11; walker_len += 8)
189 {
190 if (i >= clen)
191 return -1;
192 walker |= (data[i++] & 0xff) << (24 - walker_len);
193 }
194
195 walker <<= 3;
196 match_off = (((uint32) walker) >> ((uint32) 24)) + 64;
197 walker <<= 8;
198 walker_len -= 11;
199 break;
200
201 case 5:
202 case 4: /* 320 - 2367 */
203 for (; walker_len < 13; walker_len += 8)
204 {
205 if (i >= clen)
206 return -1;
207 walker |= (data[i++] & 0xff) << (24 - walker_len);
208 }
209
210 walker <<= 2;
211 match_off = (((uint32) walker) >> ((uint32) 21)) + 320;
212 walker <<= 11;
213 walker_len -= 13;
214 break;
215
216 default: /* 2368 - 65535 */
217 for (; walker_len < 17; walker_len += 8)
218 {
219 if (i >= clen)
220 return -1;
221 walker |= (data[i++] & 0xff) << (24 - walker_len);
222 }
223
224 walker <<= 1;
225 match_off = (((uint32) walker) >> ((uint32) 16)) + 2368;
226 walker <<= 16;
227 walker_len -= 17;
228 break;
229 }
230 }
231 else
232 {
233 /* offset decoding where offset len is:
234 -63: 1111 followed by the lower 6 bits of the value
235 64-319: 1110 followed by the lower 8 bits of the value ( value - 64 )
236 320-8191: 110 followed by the lower 13 bits of the value ( value - 320 )
237 */
238 switch (((uint32) walker) >> ((uint32) 30))
239 {
240 case 3: /* - 63 */
241 if (walker_len < 8)
242 {
243 if (i >= clen)
244 return -1;
245 walker |= (data[i++] & 0xff) << (24 - walker_len);
246 walker_len += 8;
247 }
248 walker <<= 2;
249 match_off = ((uint32) walker) >> ((uint32) 26);
250 walker <<= 6;
251 walker_len -= 8;
252 break;
253
254 case 2: /* 64 - 319 */
255 for (; walker_len < 10; walker_len += 8)
256 {
257 if (i >= clen)
258 return -1;
259 walker |= (data[i++] & 0xff) << (24 - walker_len);
260 }
261
262 walker <<= 2;
263 match_off = (((uint32) walker) >> ((uint32) 24)) + 64;
264 walker <<= 8;
265 walker_len -= 10;
266 break;
267
268 default: /* 320 - 8191 */
269 for (; walker_len < 14; walker_len += 8)
270 {
271 if (i >= clen)
272 return -1;
273 walker |= (data[i++] & 0xff) << (24 - walker_len);
274 }
275
276 match_off = (walker >> 18) + 320;
277 walker <<= 14;
278 walker_len -= 14;
279 break;
280 }
281 }
282 if (walker_len == 0)
283 {
284 if (i >= clen)
285 return -1;
286 walker = data[i++] << 24;
287 walker_len = 8;
288 }
289
290 /* decode length of match */
291 match_len = 0;
292 if (walker >= 0)
293 { /* special case - length of 3 is in bit 0 */
294 match_len = 3;
295 walker <<= 1;
296 walker_len--;
297 }
298 else
299 {
300 /* this is how it works len of:
301 4-7: 10 followed by 2 bits of the value
302 8-15: 110 followed by 3 bits of the value
303 16-31: 1110 followed by 4 bits of the value
304 32-63: .... and so forth
305 64-127:
306 128-255:
307 256-511:
308 512-1023:
309 1024-2047:
310 2048-4095:
311 4096-8191:
312
313 i.e. 4097 is encoded as: 111111111110 000000000001
314 meaning 4096 + 1...
315 */
316 match_bits = big ? 14 : 11; /* 11 or 14 bits of value at most */
317 do
318 {
319 walker <<= 1;
320 if (--walker_len == 0)
321 {
322 if (i >= clen)
323 return -1;
324 walker = data[i++] << 24;
325 walker_len = 8;
326 }
327 if (walker >= 0)
328 break;
329 if (--match_bits == 0)
330 {
331 return -1;
332 }
333 }
334 while (1);
335 match_len = (big ? 16 : 13) - match_bits;
336 walker <<= 1;
337 if (--walker_len < match_len)
338 {
339 for (; walker_len < match_len; walker_len += 8)
340 {
341 if (i >= clen)
342 {
343 return -1;
344 }
345 walker |= (data[i++] & 0xff) << (24 - walker_len);
346 }
347 }
348
349 match_bits = match_len;
350 match_len =
351 ((walker >> (32 - match_bits)) & (~(-1 << match_bits))) | (1 <<
352 match_bits);
353 walker <<= match_bits;
354 walker_len -= match_bits;
355 }
356 if (next_offset + match_len >= RDP_MPPC_DICT_SIZE)
357 {
358 return -1;
359 }
360 /* memory areas can overlap - meaning we can't use memXXX functions */
361 k = (next_offset - match_off) & (big ? 65535 : 8191);
362 do
363 {
364 dict[next_offset++] = dict[k++];
365 }
366 while (--match_len != 0);
367 }
368 while (1);
369
370 /* store history offset */
371 This->mppc_dict.roff = next_offset;
372
373 *roff = old_offset;
374 *rlen = next_offset - old_offset;
375
376 return 0;
377}
#define RDP_MPPC_RESET
Definition: constants.h:356
#define RDP_MPPC_DICT_SIZE
Definition: constants.h:358
#define RDP_MPPC_COMPRESSED
Definition: constants.h:355
#define RDP_MPPC_BIG
Definition: constants.h:354
#define RDP_MPPC_FLUSH
Definition: constants.h:357
Definition: _ctype.h:58
unsigned int BOOL
Definition: ntddk_ex.h:94
int k
Definition: mpi.c:3369

◆ next_arg()

char * next_arg ( char src,
char  needle 
)

Definition at line 1174 of file rdesktop.c.

1175{
1176 char *nextval;
1177 char *p;
1178 char *mvp = 0;
1179
1180 /* EOS */
1181 if (*src == (char) 0x00)
1182 return 0;
1183
1184 p = src;
1185 /* skip escaped needles */
1186 while ((nextval = strchr(p, needle)))
1187 {
1188 mvp = nextval - 1;
1189 /* found backslashed needle */
1190 if (*mvp == '\\' && (mvp > src))
1191 {
1192 /* move string one to the left */
1193 while (*(mvp + 1) != (char) 0x00)
1194 {
1195 *mvp = *(mvp + 1);
1196 mvp++;
1197 }
1198 *mvp = (char) 0x00;
1199 p = nextval;
1200 }
1201 else
1202 {
1203 p = nextval + 1;
1204 break;
1205 }
1206
1207 }
1208
1209 /* more args available */
1210 if (nextval)
1211 {
1212 *nextval = (char) 0x00;
1213 return ++nextval;
1214 }
1215
1216 /* no more args after this, jump to EOS */
1217 nextval = src + strlen(src);
1218 return nextval;
1219}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strchr(const char *String, int ch)
Definition: utclib.c:501
unsigned char
Definition: typeof.h:29
GLenum src
Definition: glext.h:6340

Referenced by main().

◆ parallel_enum_devices()

int parallel_enum_devices ( RDPCLIENT This,
uint32 id,
char optarg 
)

Definition at line 40 of file parallel.c.

41{
42 PARALLEL_DEVICE *ppar_info;
43
44 char *pos = optarg;
45 char *pos2;
46 int count = 0;
47
48 /* skip the first colon */
49 optarg++;
50 while ((pos = next_arg(optarg, ',')) && *id < RDPDR_MAX_DEVICES)
51 {
52 ppar_info = (PARALLEL_DEVICE *) xmalloc(sizeof(PARALLEL_DEVICE));
53
54 pos2 = next_arg(optarg, '=');
55 strcpy(This->rdpdr_device[*id].name, optarg);
56
57 toupper_str(This->rdpdr_device[*id].name);
58
59 This->rdpdr_device[*id].local_path = xmalloc(strlen(pos2) + 1);
60 strcpy(This->rdpdr_device[*id].local_path, pos2);
61 printf("PARALLEL %s to %s\n", optarg, pos2);
62
63 /* set device type */
64 This->rdpdr_device[*id].device_type = DEVICE_TYPE_PARALLEL;
65 This->rdpdr_device[*id].pdevice_data = (void *) ppar_info;
66 This->rdpdr_device[*id].handle = 0;
67 count++;
68 (*id)++;
69
70 optarg = pos;
71 }
72 return count;
73}
#define RDPDR_MAX_DEVICES
Definition: constants.h:484
#define DEVICE_TYPE_PARALLEL
Definition: constants.h:486
char * next_arg(char *src, char needle)
Definition: rdesktop.c:1174
void toupper_str(char *p)
Definition: rdesktop.c:1223
#define printf
Definition: freeldr.h:97

◆ printer_enum_devices()

int printer_enum_devices ( RDPCLIENT This,
uint32 id,
char optarg 
)

Definition at line 36 of file printer.c.

37{
38 PRINTER *pprinter_data;
39
40 char *pos = optarg;
41 char *pos2;
42 int count = 0;
43 int already = 0;
44
45 /* we need to know how many printers we've already set up
46 supplied from other -r flags than this one. */
47 while (count < *id)
48 {
49 if (This->rdpdr_device[count].device_type == DEVICE_TYPE_PRINTER)
50 already++;
51 count++;
52 }
53
54 count = 0;
55
56 if (*optarg == ':')
57 optarg++;
58
59 while ((pos = next_arg(optarg, ',')) && *id < RDPDR_MAX_DEVICES)
60 {
61 pprinter_data = (PRINTER *) xmalloc(sizeof(PRINTER));
62
63 strcpy(This->rdpdr_device[*id].name, "PRN");
64 strcat(This->rdpdr_device[*id].name, l_to_a(already + count + 1, 10));
65
66 /* first printer is set as default printer */
67 if ((already + count) == 0)
68 pprinter_data->default_printer = True;
69 else
70 pprinter_data->default_printer = False;
71
72 pos2 = next_arg(optarg, '=');
73 if (*optarg == (char) 0x00)
74 pprinter_data->printer = "mydeskjet"; /* set default */
75 else
76 {
77 pprinter_data->printer = xmalloc(strlen(optarg) + 1);
78 strcpy(pprinter_data->printer, optarg);
79 }
80
81 if (!pos2 || (*pos2 == (char) 0x00))
82 pprinter_data->driver = "HP Color LaserJet 8500 PS"; /* no printer driver supplied set default */
83 else
84 {
85 pprinter_data->driver = xmalloc(strlen(pos2) + 1);
86 strcpy(pprinter_data->driver, pos2);
87 }
88
89 printf("PRINTER %s to %s driver %s\n", This->rdpdr_device[*id].name,
90 pprinter_data->printer, pprinter_data->driver);
91 This->rdpdr_device[*id].device_type = DEVICE_TYPE_PRINTER;
92 This->rdpdr_device[*id].pdevice_data = (void *) pprinter_data;
93 count++;
94 (*id)++;
95
96 optarg = pos;
97 }
98 return count;
99}
#define DEVICE_TYPE_PRINTER
Definition: constants.h:487
char * l_to_a(long N, int base)
Definition: rdesktop.c:1356
char * printer
Definition: types.h:263
char * driver
Definition: types.h:263
RD_BOOL default_printer
Definition: types.h:266

◆ printercache_load_blob()

int printercache_load_blob ( char printer_name,
uint8 **  data 
)

Definition at line 154 of file printercache.c.

155{
156 char *home, *path;
157 struct stat st;
158 int fd, length;
159
160 if (printer_name == NULL)
161 return 0;
162
163 *data = NULL;
164
165 home = getenv("HOME");
166 if (home == NULL)
167 return 0;
168
169 path = (char *) xmalloc(strlen(home) + sizeof("/.rdesktop/rdpdr/") + strlen(printer_name) +
170 sizeof("/AutoPrinterCacheData") + 1);
171 sprintf(path, "%s/.rdesktop/rdpdr/%s/AutoPrinterCacheData", home, printer_name);
172
173 fd = open(path, O_RDONLY);
174 if (fd == -1)
175 {
176 xfree(path);
177 return 0;
178 }
179
180 if (fstat(fd, &st))
181 {
182 xfree(path);
183 close(fd);
184 return 0;
185 }
186
187 *data = (uint8 *) xmalloc(st.st_size);
188 length = read(fd, *data, st.st_size);
189 close(fd);
190 xfree(path);
191 return length;
192}
#define read
Definition: acwin.h:96
#define O_RDONLY
Definition: acwin.h:108
#define open
Definition: acwin.h:95
#define close
Definition: acwin.h:98
#define fstat
Definition: acwin.h:100
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
static int fd
Definition: io.c:51
Definition: tftpd.h:38
Definition: stat.h:55

◆ printercache_process()

void printercache_process ( RDPCLIENT This,
STREAM  s 
)

Definition at line 233 of file printercache.c.

234{
235 uint32 type, printer_length, driver_length, printer_unicode_length, blob_length;
236 char device_name[9], printer[256], driver[256];
237
239 switch (type)
240 {
241 case 4: /* rename item */
242 in_uint8(s, printer_length);
243 in_uint8s(s, 0x3); /* padding */
244 in_uint8(s, driver_length);
245 in_uint8s(s, 0x3); /* padding */
246
247 /* NOTE - 'driver' doesn't contain driver, it contains the new printer name */
248
249 rdp_in_unistr(This, s, printer, printer_length);
250 rdp_in_unistr(This, s, driver, driver_length);
251
253 break;
254
255 case 3: /* delete item */
256 in_uint8(s, printer_unicode_length);
257 in_uint8s(s, 0x3); /* padding */
258 printer_length = rdp_in_unistr(This, s, printer, printer_unicode_length);
260 break;
261
262 case 2: /* save printer data */
263 in_uint32_le(s, printer_unicode_length);
264 in_uint32_le(s, blob_length);
265
266 if (printer_unicode_length < 2 * 255)
267 {
268 rdp_in_unistr(This, s, printer, printer_unicode_length);
269 printercache_save_blob(printer, s->p, blob_length);
270 }
271 break;
272
273 case 1: /* save device data */
274 in_uint8a(s, device_name, 5); /* get LPTx/COMx name */
275
276 /* need to fetch this data so that we can get the length of the packet to store. */
277 in_uint8s(s, 0x2); /* ??? */
278 in_uint8s(s, 0x2) /* pad?? */
279 in_uint32_be(s, driver_length);
280 in_uint32_be(s, printer_length);
281 in_uint8s(s, 0x7) /* pad?? */
282 /* next is driver in unicode */
283 /* next is printer in unicode */
284 /* TODO: figure out how to use this information when reconnecting */
285 /* actually - all we need to store is the driver and printer */
286 /* and figure out what the first word is. */
287 /* rewind stream so that we can save this blob */
288 /* length is driver_length + printer_length + 19 */
289 /* rewind stream */
290 s->p = s->p - 19;
291
293 driver_length + printer_length + 19);
294 break;
295 default:
296
297 unimpl("RDPDR Printer Cache Packet Type: %d\n", type);
298 break;
299 }
300}
Type
Definition: Type.h:7
#define in_uint32_be(s, v)
Definition: parse.h:76
#define in_uint8a(s, v, n)
Definition: parse.h:90
#define in_uint32_le(s, v)
Definition: parse.h:56
void rdp_in_unistr(STREAM s, int in_len, char **string, uint32 *str_size)
Definition: rdp.c:265
static const WCHAR device_name[]
Definition: btrfs.c:60
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define d
Definition: ke_i.h:81
struct @1671::@1672 driver
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1549
static BOOL printercache_rename_blob(char *printer, char *new_printer)
Definition: printercache.c:113
static void printercache_save_blob(char *printer_name, uint8 *data, uint32 length)
Definition: printercache.c:195
static BOOL printercache_unlink_blob(char *printer)
Definition: printercache.c:76
Definition: fatfs.h:173

◆ process_bitmap_updates()

void process_bitmap_updates ( RDPCLIENT This,
STREAM  s 
)

Definition at line 1084 of file rdp.c.

1085{
1086 uint16 num_updates;
1088 uint16 cx, cy, bpp, Bpp, compress, bufsize, size;
1089 uint8 *data, *bmpdata;
1090 int i;
1091
1092 in_uint16_le(s, num_updates);
1093
1094 for (i = 0; i < num_updates; i++)
1095 {
1097 in_uint16_le(s, top);
1102 in_uint16_le(s, bpp);
1103 Bpp = (bpp + 7) / 8;
1106
1107 cx = right - left + 1;
1108 cy = bottom - top + 1;
1109
1110 DEBUG(("BITMAP_UPDATE(l=%d,t=%d,r=%d,b=%d,w=%d,h=%d,Bpp=%d,cmp=%d)\n",
1111 left, top, right, bottom, width, height, Bpp, compress));
1112
1113 if (!compress)
1114 {
1115#if 0
1116 int y;
1117 bmpdata = (uint8 *) xmalloc(width * height * Bpp);
1118 for (y = 0; y < height; y++)
1119 {
1120 in_uint8a(s, &bmpdata[(height - y - 1) * (width * Bpp)],
1121 width * Bpp);
1122 }
1123 ui_paint_bitmap(This, left, top, cx, cy, width, height, bmpdata);
1124 xfree(bmpdata);
1125#else
1126 in_uint8p(s, bmpdata, width * height * Bpp);
1127 ui_paint_bitmap(This, left, top, cx, cy, width, height, bmpdata);
1128#endif
1129 continue;
1130 }
1131
1132
1133 if (compress & 0x400)
1134 {
1135 size = bufsize;
1136 }
1137 else
1138 {
1139 in_uint8s(s, 2); /* pad */
1141 in_uint8s(s, 4); /* line_size, final_size */
1142 }
1143 in_uint8p(s, data, size);
1144 bmpdata = (uint8 *) malloc(width * height * Bpp);
1145
1146 if(bmpdata == NULL)
1147 return;
1148
1149 if (bitmap_decompress(bmpdata, width, height, data, size, Bpp))
1150 {
1151 ui_paint_bitmap(This, left, top, cx, cy, width, height, bmpdata);
1152 }
1153 else
1154 {
1155 DEBUG_RDP5(("Failed to decompress data\n"));
1156 }
1157
1158 free(bmpdata);
1159 }
1160}
RD_BOOL bitmap_decompress(uint8 *output, int width, int height, uint8 *input, int size, int Bpp)
Definition: bitmap.c:884
#define in_uint16_le(s, v)
Definition: parse.h:55
#define in_uint8p(s, v, n)
Definition: parse.h:89
void ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 *data)
Definition: uimain.c:307
#define DEBUG(args)
Definition: rdesktop.h:129
DWORD bpp
Definition: surface.c:185
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
Definition: compress.c:68

◆ process_cached_pointer_pdu()

void process_cached_pointer_pdu ( RDPCLIENT This,
STREAM  s 
)

Definition at line 1020 of file rdp.c.

1021{
1022 uint16 cache_idx;
1023
1024 in_uint16_le(s, cache_idx);
1026}
RD_HCURSOR cache_get_cursor(uint16 cache_idx)
Definition: cache.c:400
void ui_set_cursor(RD_HCURSOR cursor)

◆ process_colour_pointer_pdu()

void process_colour_pointer_pdu ( RDPCLIENT This,
STREAM  s 
)

Definition at line 998 of file rdp.c.

999{
1000 uint16 x, y, width, height, cache_idx, masklen, datalen;
1001 uint8 *mask, *data;
1003
1004 in_uint16_le(s, cache_idx);
1005 in_uint16_le(s, x);
1006 in_uint16_le(s, y);
1009 in_uint16_le(s, masklen);
1012 in_uint8p(s, mask, masklen);
1015 cache_put_cursor(This, cache_idx, cursor);
1016}
void cache_put_cursor(uint16 cache_idx, RD_HCURSOR cursor)
Definition: cache.c:417
RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, int width, int height, uint8 *andmask, uint8 *xormask, int bpp)
Definition: uimain.c:175
GLenum GLint GLuint mask
Definition: glext.h:6028
int const JOCTET unsigned int datalen
Definition: jpeglib.h:1031

◆ process_disconnect_pdu()

void process_disconnect_pdu ( STREAM  s,
uint32 ext_disc_reason 
)

Definition at line 1407 of file rdp.c.

1408{
1410
1411 DEBUG(("Received disconnect PDU\n"));
1412}
uint32 ext_disc_reason
Definition: svgawin.c:64

Referenced by process_data_pdu().

◆ process_orders()

void process_orders ( RDPCLIENT This,
STREAM  s,
uint16  num_orders 
)

Definition at line 1243 of file orders.c.

1244{
1245 RDP_ORDER_STATE *os = &This->orders.order_state;
1246 uint32 present;
1247 uint8 order_flags;
1248 int size, processed = 0;
1249 BOOL delta;
1250
1251 while (processed < num_orders)
1252 {
1253 in_uint8(s, order_flags);
1254
1255 if (!(order_flags & RDP_ORDER_STANDARD))
1256 {
1257 error("order parsing failed\n");
1258 break;
1259 }
1260
1261 if (order_flags & RDP_ORDER_SECONDARY)
1262 {
1264 }
1265 else
1266 {
1267 if (order_flags & RDP_ORDER_CHANGE)
1268 {
1269 in_uint8(s, os->order_type);
1270 }
1271
1272 switch (os->order_type)
1273 {
1274 case RDP_ORDER_TRIBLT:
1275 case RDP_ORDER_TEXT2:
1276 size = 3;
1277 break;
1278
1279 case RDP_ORDER_PATBLT:
1280 case RDP_ORDER_MEMBLT:
1281 case RDP_ORDER_LINE:
1282 case RDP_ORDER_POLYGON2:
1283 case RDP_ORDER_ELLIPSE2:
1284 size = 2;
1285 break;
1286
1287 default:
1288 size = 1;
1289 }
1290
1291 rdp_in_present(s, &present, order_flags, size);
1292
1293 if (order_flags & RDP_ORDER_BOUNDS)
1294 {
1295 if (!(order_flags & RDP_ORDER_LASTBOUNDS))
1296 rdp_parse_bounds(s, &os->bounds);
1297
1299 os->bounds.top,
1300 os->bounds.right -
1301 os->bounds.left + 1,
1302 os->bounds.bottom - os->bounds.top + 1);
1303 }
1304
1305 delta = order_flags & RDP_ORDER_DELTA;
1306
1307 switch (os->order_type)
1308 {
1309 case RDP_ORDER_DESTBLT:
1310 process_destblt(This, s, &os->destblt, present, delta);
1311 break;
1312
1313 case RDP_ORDER_PATBLT:
1314 process_patblt(This, s, &os->patblt, present, delta);
1315 break;
1316
1318 process_screenblt(This, s, &os->screenblt, present, delta);
1319 break;
1320
1321 case RDP_ORDER_LINE:
1322 process_line(This, s, &os->line, present, delta);
1323 break;
1324
1325 case RDP_ORDER_RECT:
1326 process_rect(This, s, &os->rect, present, delta);
1327 break;
1328
1329 case RDP_ORDER_DESKSAVE:
1330 process_desksave(This, s, &os->desksave, present, delta);
1331 break;
1332
1333 case RDP_ORDER_MEMBLT:
1334 process_memblt(This, s, &os->memblt, present, delta);
1335 break;
1336
1337 case RDP_ORDER_TRIBLT:
1338 process_triblt(This, s, &os->triblt, present, delta);
1339 break;
1340
1341 case RDP_ORDER_POLYGON:
1342 process_polygon(This, s, &os->polygon, present, delta);
1343 break;
1344
1345 case RDP_ORDER_POLYGON2:
1346 process_polygon2(This, s, &os->polygon2, present, delta);
1347 break;
1348
1349 case RDP_ORDER_POLYLINE:
1350 process_polyline(This, s, &os->polyline, present, delta);
1351 break;
1352
1353 case RDP_ORDER_ELLIPSE:
1354 process_ellipse(This, s, &os->ellipse, present, delta);
1355 break;
1356
1357 case RDP_ORDER_ELLIPSE2:
1358 process_ellipse2(This, s, &os->ellipse2, present, delta);
1359 break;
1360
1361 case RDP_ORDER_TEXT2:
1362 process_text2(This, s, &os->text2, present, delta);
1363 break;
1364
1365 default:
1366 unimpl("order %d\n", os->order_type);
1367 return;
1368 }
1369
1370 if (order_flags & RDP_ORDER_BOUNDS)
1372 }
1373
1374 processed++;
1375 }
1376#if 0
1377 /* not true when RDP_COMPRESSION is set */
1378 if (s->p != This->next_packet)
1379 error("%d bytes remaining\n", (int) (This->next_packet - s->p));
1380#endif
1381
1382}
static void process_rect(STREAM s, RECT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:334
static void process_polygon2(STREAM s, POLYGON2_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:597
static void process_desksave(STREAM s, DESKSAVE_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:374
static void process_triblt(STREAM s, TRIBLT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:456
static void process_ellipse2(STREAM s, ELLIPSE2_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:795
static void process_destblt(STREAM s, DESTBLT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:201
static void process_polygon(STREAM s, POLYGON_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:518
static void process_ellipse(STREAM s, ELLIPSE_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:763
static void rdp_in_present(STREAM s, uint32 *present, uint8 flags, int size)
Definition: orders.c:29
static void process_screenblt(STREAM s, SCREENBLT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:264
static void process_memblt(STREAM s, MEMBLT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:410
static void process_text2(STREAM s, TEXT2_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:837
static void process_polyline(STREAM s, POLYLINE_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:685
static RD_BOOL rdp_parse_bounds(STREAM s, BOUNDS *bounds)
Definition: orders.c:105
static void process_secondary_order(STREAM s)
Definition: orders.c:1256
static void process_patblt(STREAM s, PATBLT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:226
static void process_line(STREAM s, LINE_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:295
#define RDP_ORDER_BOUNDS
Definition: orders.h:22
@ RDP_ORDER_POLYLINE
Definition: orders.h:41
@ RDP_ORDER_RECT
Definition: orders.h:35
@ RDP_ORDER_ELLIPSE
Definition: orders.h:42
@ RDP_ORDER_LINE
Definition: orders.h:34
@ RDP_ORDER_TRIBLT
Definition: orders.h:38
@ RDP_ORDER_DESTBLT
Definition: orders.h:31
@ RDP_ORDER_ELLIPSE2
Definition: orders.h:43
@ RDP_ORDER_TEXT2
Definition: orders.h:44
@ RDP_ORDER_PATBLT
Definition: orders.h:32
@ RDP_ORDER_MEMBLT
Definition: orders.h:37
@ RDP_ORDER_DESKSAVE
Definition: orders.h:36
@ RDP_ORDER_SCREENBLT
Definition: orders.h:33
@ RDP_ORDER_POLYGON2
Definition: orders.h:40
@ RDP_ORDER_POLYGON
Definition: orders.h:39
#define RDP_ORDER_CHANGE
Definition: orders.h:23
#define RDP_ORDER_SECONDARY
Definition: orders.h:21
#define RDP_ORDER_STANDARD
Definition: orders.h:20
#define RDP_ORDER_LASTBOUNDS
Definition: orders.h:25
#define RDP_ORDER_DELTA
Definition: orders.h:24
void ui_set_clip(int x, int y, int cx, int cy)
Definition: uimain.c:320
void ui_reset_clip(void)
Definition: uimain.c:328
sint16 left
Definition: types.h:74
sint16 top
Definition: types.h:75
sint16 right
Definition: types.h:76
sint16 bottom
Definition: types.h:77
ELLIPSE2_ORDER ellipse2
Definition: orders.h:286
DESKSAVE_ORDER desksave
Definition: orders.h:279
BOUNDS bounds
Definition: orders.h:272
POLYGON_ORDER polygon
Definition: orders.h:282
DESTBLT_ORDER destblt
Definition: orders.h:274
RECT_ORDER rect
Definition: orders.h:278
MEMBLT_ORDER memblt
Definition: orders.h:280
LINE_ORDER line
Definition: orders.h:277
TRIBLT_ORDER triblt
Definition: orders.h:281
POLYGON2_ORDER polygon2
Definition: orders.h:283
PATBLT_ORDER patblt
Definition: orders.h:275
POLYLINE_ORDER polyline
Definition: orders.h:284
SCREENBLT_ORDER screenblt
Definition: orders.h:276
ELLIPSE_ORDER ellipse
Definition: orders.h:285
TEXT2_ORDER text2
Definition: orders.h:287
uint8 order_type
Definition: orders.h:271
static int processed(const type_t *type)
Definition: typegen.c:2254

◆ process_palette()

void process_palette ( RDPCLIENT This,
STREAM  s 
)

Definition at line 1164 of file rdp.c.

1165{
1167 COLOURMAP map;
1168 HCOLOURMAP hmap;
1169 int i;
1170
1171 in_uint8s(s, 2); /* pad */
1172 in_uint16_le(s, map.ncolours);
1173 in_uint8s(s, 2); /* pad */
1174
1175 map.colours = (COLOURENTRY *) malloc(sizeof(COLOURENTRY) * map.ncolours);
1176
1177 if(map.colours == NULL)
1178 {
1179 in_uint8s(s, sizeof(*entry) * map.ncolours);
1180 return;
1181 }
1182
1183 DEBUG(("PALETTE(c=%d)\n", map.ncolours));
1184
1185 for (i = 0; i < map.ncolours; i++)
1186 {
1187 entry = &map.colours[i];
1188 in_uint8(s, entry->red);
1189 in_uint8(s, entry->green);
1190 in_uint8(s, entry->blue);
1191 }
1192
1193 hmap = ui_create_colourmap(This, &map);
1194 ui_set_colourmap(This, hmap);
1195
1196 free(map.colours);
1197}
void ui_set_colourmap(RD_HCOLOURMAP map)
Definition: qtewin.cpp:1527
RD_HCOLOURMAP ui_create_colourmap(COLOURMAP *colours)
Definition: uimain.c:336
Definition: _map.h:48
uint32_t entry
Definition: isohybrid.c:63

◆ process_system_pointer_pdu()

void process_system_pointer_pdu ( RDPCLIENT This,
STREAM  s 
)

Definition at line 1030 of file rdp.c.

1031{
1032 uint16 system_pointer_type;
1033
1034 in_uint16(s, system_pointer_type);
1035 switch (system_pointer_type)
1036 {
1037 case RDP_NULL_POINTER:
1039 break;
1040
1041 default:
1042 unimpl("System pointer message 0x%x\n", system_pointer_type);
1043 }
1044}
@ RDP_NULL_POINTER
Definition: constants.h:225
#define in_uint16(s, v)
Definition: parse.h:82
void ui_set_null_cursor(void)
Definition: uimain.c:227

◆ pstcache_enumerate()

int pstcache_enumerate ( RDPCLIENT This,
uint8  id,
HASH_KEY keylist 
)

Definition at line 104 of file pstcache.c.

105{
106 int fd, n;
107 uint16 idx;
108 sint16 mru_idx[0xa00];
109 uint32 mru_stamp[0xa00];
110 CELLHEADER cellhdr;
111
112 if (!(This->bitmap_cache && This->bitmap_cache_persist_enable && IS_PERSISTENT(id)))
113 return 0;
114
115 /* The server disconnects if the bitmap cache content is sent more than once */
116 if (This->pstcache_enumerated)
117 return 0;
118
119 DEBUG_RDP5(("Persistent bitmap cache enumeration... "));
120 for (idx = 0; idx < BMPCACHE2_NUM_PSTCELLS; idx++)
121 {
122 fd = This->pstcache_fd[id];
123 rd_lseek_file(fd, idx * (This->pstcache_Bpp * MAX_CELL_SIZE + sizeof(CELLHEADER)));
124 if (rd_read_file(fd, &cellhdr, sizeof(CELLHEADER)) <= 0)
125 break;
126
127 if (memcmp(cellhdr.key, zero_key, sizeof(HASH_KEY)) != 0)
128 {
129 memcpy(keylist[idx], cellhdr.key, sizeof(HASH_KEY));
130
131 /* Pre-cache (not possible for 8 bit colour depth cause it needs a colourmap) */
132 if (This->bitmap_cache_precache && cellhdr.stamp && This->server_depth > 8)
134
135 /* Sort by stamp */
136 for (n = idx; n > 0 && cellhdr.stamp < mru_stamp[n - 1]; n--)
137 {
138 mru_idx[n] = mru_idx[n - 1];
139 mru_stamp[n] = mru_stamp[n - 1];
140 }
141
142 mru_idx[n] = idx;
143 mru_stamp[n] = cellhdr.stamp;
144 }
145 else
146 {
147 break;
148 }
149 }
150
151 DEBUG_RDP5(("%d cached bitmaps.\n", idx));
152
154 This->pstcache_enumerated = True;
155 return idx;
156}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
void cache_rebuild_bmpcache_linked_list(uint8 id, sint16 *idx, int count)
Definition: cache.c:58
#define BMPCACHE2_NUM_PSTCELLS
Definition: constants.h:285
int rd_read_file(int fd, void *ptr, int len)
Definition: uimain.c:854
int rd_lseek_file(int fd, int offset)
Definition: uimain.c:868
RD_BOOL pstcache_load_bitmap(uint8 cache_id, uint16 cache_idx)
Definition: pstcache.c:53
uint8 zero_key[]
Definition: pstcache.c:34
#define IS_PERSISTENT(id)
Definition: pstcache.c:24
#define MAX_CELL_SIZE
Definition: pstcache.c:22
uint8 HASH_KEY[8]
Definition: types.h:161
HASH_KEY key
Definition: types.h:166
Definition: path.c:35

◆ pstcache_init()

BOOL pstcache_init ( RDPCLIENT This,
uint8  cache_id 
)

Definition at line 160 of file pstcache.c.

161{
162 int fd;
163 char filename[256];
164
165 if (This->pstcache_enumerated)
166 return True;
167
168 This->pstcache_fd[cache_id] = 0;
169
170 if (!(This->bitmap_cache && This->bitmap_cache_persist_enable))
171 return False;
172
173 if (!rd_pstcache_mkdir())
174 {
175 DEBUG(("failed to get/make cache directory!\n"));
176 return False;
177 }
178
179 This->pstcache_Bpp = (This->server_depth + 7) / 8;
180 sprintf(filename, "cache/pstcache_%d_%d", cache_id, This->pstcache_Bpp);
181 DEBUG(("persistent bitmap cache file: %s\n", filename));
182
184 if (fd == -1)
185 return False;
186
187 if (!rd_lock_file(fd, 0, 0))
188 {
189 warning("Persistent bitmap caching is disabled. (The file is already in use)\n");
191 return False;
192 }
193
194 This->pstcache_fd[cache_id] = fd;
195 return True;
196}
void rd_close_file(int fd)
Definition: uimain.c:847
RD_BOOL rd_lock_file(int fd, int start, int len)
Definition: uimain.c:875
RD_BOOL rd_pstcache_mkdir(void)
Definition: uimain.c:833
int rd_open_file(char *filename)
Definition: uimain.c:840
const char * filename
Definition: ioapi.h:137
#define warning(s)
Definition: debug.h:83

◆ pstcache_load_bitmap()

BOOL pstcache_load_bitmap ( RDPCLIENT This,
uint8  cache_id,
uint16  cache_idx 
)

Definition at line 46 of file pstcache.c.

47{
48 uint8 *celldata;
49 int fd;
50 CELLHEADER cellhdr;
52
53 if (!This->bitmap_cache_persist_enable)
54 return False;
55
56 if (!IS_PERSISTENT(cache_id) || cache_idx >= BMPCACHE2_NUM_PSTCELLS)
57 return False;
58
59 fd = This->pstcache_fd[cache_id];
60 rd_lseek_file(fd, cache_idx * (This->pstcache_Bpp * MAX_CELL_SIZE + sizeof(CELLHEADER)));
61 rd_read_file(fd, &cellhdr, sizeof(CELLHEADER));
62 celldata = (uint8 *) malloc(cellhdr.length);
63
64 if(celldata == NULL)
65 return False;
66
67 rd_read_file(fd, celldata, cellhdr.length);
68
69 bitmap = ui_create_bitmap(This, cellhdr.width, cellhdr.height, celldata);
70 DEBUG(("Load bitmap from disk: id=%d, idx=%d, bmp=0x%x)\n", cache_id, cache_idx, bitmap));
71 cache_put_bitmap(This, cache_id, cache_idx, bitmap);
72
73 free(celldata);
74 return True;
75}
void cache_put_bitmap(uint8 id, uint16 idx, RD_HBITMAP bitmap)
Definition: cache.c:218
RD_HBITMAP ui_create_bitmap(int width, int height, uint8 *data)
Definition: uimain.c:277

◆ pstcache_save_bitmap()

BOOL pstcache_save_bitmap ( RDPCLIENT This,
uint8  cache_id,
uint16  cache_idx,
uint8 key,
uint8  width,
uint8  height,
uint16  length,
uint8 data 
)

Definition at line 79 of file pstcache.c.

81{
82 int fd;
83 CELLHEADER cellhdr;
84
85 if (!IS_PERSISTENT(cache_id) || cache_idx >= BMPCACHE2_NUM_PSTCELLS)
86 return False;
87
88 memcpy(cellhdr.key, key, sizeof(HASH_KEY));
89 cellhdr.width = width;
90 cellhdr.height = height;
91 cellhdr.length = length;
92 cellhdr.stamp = 0;
93
94 fd = This->pstcache_fd[cache_id];
95 rd_lseek_file(fd, cache_idx * (This->pstcache_Bpp * MAX_CELL_SIZE + sizeof(CELLHEADER)));
96 rd_write_file(fd, &cellhdr, sizeof(CELLHEADER));
98
99 return True;
100}
int rd_write_file(int fd, void *ptr, int len)
Definition: uimain.c:861

◆ pstcache_touch_bitmap()

void pstcache_touch_bitmap ( RDPCLIENT This,
uint8  cache_id,
uint16  cache_idx,
uint32  stamp 
)

Definition at line 32 of file pstcache.c.

33{
34 int fd;
35
36 if (!IS_PERSISTENT(cache_id) || cache_idx >= BMPCACHE2_NUM_PSTCELLS)
37 return;
38
39 fd = This->pstcache_fd[cache_id];
40 rd_lseek_file(fd, 12 + cache_idx * (This->pstcache_Bpp * MAX_CELL_SIZE + sizeof(CELLHEADER)));
41 rd_write_file(fd, &stamp, sizeof(stamp));
42}

◆ rd_close_file()

void rd_close_file ( int  fd)

Definition at line 847 of file uimain.c.

848{
849 return;
850}

◆ rd_lock_file()

BOOL rd_lock_file ( int  fd,
int  start,
int  len 
)

Definition at line 875 of file uimain.c.

876{
877 return False;
878}

◆ rd_lseek_file()

int rd_lseek_file ( int  fd,
int  offset 
)

Definition at line 868 of file uimain.c.

869{
870 return 0;
871}

◆ rd_open_file()

int rd_open_file ( char filename)

Definition at line 840 of file uimain.c.

841{
842 return 0;
843}

◆ rd_pstcache_mkdir()

BOOL rd_pstcache_mkdir ( void  )

Definition at line 833 of file uimain.c.

834{
835 return 0;
836}

◆ rd_read_file()

int rd_read_file ( int  fd,
void ptr,
int  len 
)

Definition at line 854 of file uimain.c.

855{
856 return 0;
857}

◆ rd_write_file()

int rd_write_file ( int  fd,
void ptr,
int  len 
)

Definition at line 861 of file uimain.c.

862{
863 return 0;
864}

◆ rdp5_process()

BOOL rdp5_process ( RDPCLIENT This,
STREAM  s 
)

Definition at line 25 of file rdp5.c.

26{
29 uint8 *next;
30
31 uint32 roff, rlen;
32 struct stream *ns = &(This->mppc_dict.ns);
33 struct stream *ts;
34
35#if 0
36 printf("RDP5 data:\n");
37 hexdump(s->p, s->end - s->p);
38#endif
39
41 while (s->p < s->end)
42 {
43 in_uint8(s, type);
45 {
49 }
50 else
51 {
52 ctype = 0;
54 }
55 This->next_packet = next = s->p + length;
56
58 {
59 void * p;
60
61 if (mppc_expand(This, s->p, length, ctype, &roff, &rlen) == -1)
62 error("error while decompressing packet\n");
63
64 /* allocate memory and copy the uncompressed data into the temporary stream */
65 p = realloc(ns->data, rlen);
66
67 if(p == NULL)
68 {
69 This->disconnect_reason = 262;
70 return False;
71 }
72
73 ns->data = (uint8 *) p;
74
75 memcpy((ns->data), (unsigned char *) (This->mppc_dict.hist + roff), rlen);
76
77 ns->size = rlen;
78 ns->end = (ns->data + ns->size);
79 ns->p = ns->data;
80 ns->rdp_hdr = ns->p;
81
82 ts = ns;
83 }
84 else
85 ts = s;
86
87 switch (type)
88 {
89 case 0: /* update orders */
92 break;
93 case 1: /* update bitmap */
94 in_uint8s(ts, 2); /* part length */
96 break;
97 case 2: /* update palette */
98 in_uint8s(ts, 2); /* uint16 = 2 */
100 break;
101 case 3: /* update synchronize */
102 break;
103 case 5: /* null pointer */
105 break;
106 case 6: /* default pointer */
107 break;
108 case 8: /* pointer position */
109 in_uint16_le(ts, x);
110 in_uint16_le(ts, y);
111 if (s_check(ts))
113 break;
114 case 9: /* color pointer */
116 break;
117 case 10: /* cached pointer */
119 break;
120 default:
121 unimpl("RDP5 opcode %d\n", type);
122 }
123
124 s->p = next;
125 }
127 return True;
128}
#define RDP5_COMPRESSED
Definition: constants.h:360
int mppc_expand(uint8 *data, uint32 clen, uint8 ctype, uint32 *roff, uint32 *rlen)
Definition: mppc.c:58
void process_orders(STREAM s, uint16 num_orders)
Definition: orders.c:1311
#define s_check(s)
Definition: parse.h:42
void process_bitmap_updates(STREAM s)
Definition: rdp.c:1224
void process_cached_pointer_pdu(STREAM s)
Definition: rdp.c:1156
void process_palette(STREAM s)
Definition: rdp.c:1295
void hexdump(unsigned char *p, unsigned int len)
Definition: shimdbg.c:234
void process_colour_pointer_pdu(STREAM s)
Definition: rdp.c:1139
void ui_begin_update(void)
Definition: uimain.c:657
void ui_move_pointer(int x, int y)
Definition: uimain.c:616
void ui_end_update(void)
Definition: uimain.c:664
#define realloc
Definition: debug_ros.c:6
static unsigned __int64 next
Definition: rand_nt.c:6
Definition: mxnamespace.c:45

◆ rdp_connect()

BOOL rdp_connect ( RDPCLIENT This,
char server,
uint32  flags,
wchar_t username,
wchar_t domain,
wchar_t password,
wchar_t command,
wchar_t directory,
wchar_t hostname,
char cookie 
)

Definition at line 1474 of file rdp.c.

1476{
1478 return False;
1479
1481 return True;
1482}
RD_BOOL sec_connect(char *server, char *username, char *domain, char *password, RD_BOOL reconnect)
Definition: secure.c:1005
static void rdp_send_logon_info(uint32 flags, char *domain, char *user, char *password, char *program, char *directory)
Definition: rdp.c:343
char * hostname
Definition: ftp.c:88

◆ rdp_disconnect()

void rdp_disconnect ( RDPCLIENT This)

Definition at line 1507 of file rdp.c.

1508{
1510}
void sec_disconnect(void)
Definition: secure.c:1032

◆ rdp_in_unistr()

int rdp_in_unistr ( RDPCLIENT This,
STREAM  s,
wchar_t string,
int  uni_len 
)

Definition at line 210 of file rdp.c.

211{
212#ifdef HAVE_ICONV
213 size_t ibl = uni_len, obl = uni_len;
214 char *pin = (char *) s->p, *pout = string;
215 static iconv_t iconv_h = (iconv_t) - 1;
216
217 if (This->rdp.iconv_works)
218 {
219 if (iconv_h == (iconv_t) - 1)
220 {
221 if ((iconv_h = iconv_open(This->codepage, WINDOWS_CODEPAGE)) == (iconv_t) - 1)
222 {
223 warning("rdp_in_unistr: iconv_open[%s -> %s] fail %d\n",
224 WINDOWS_CODEPAGE, This->codepage, (int) iconv_h);
225
226 This->rdp.iconv_works = False;
227 return rdp_in_unistr(This, s, string, uni_len);
228 }
229 }
230
231 if (iconv(iconv_h, (ICONV_CONST char **) &pin, &ibl, &pout, &obl) == (size_t) - 1)
232 {
233 iconv_close(iconv_h);
234 iconv_h = (iconv_t) - 1;
235 warning("rdp_in_unistr: iconv fail, errno %d\n", errno);
236
237 This->rdp.iconv_works = False;
238 return rdp_in_unistr(This, s, string, uni_len);
239 }
240
241 /* we must update the location of the current STREAM for future reads of s->p */
242 s->p += uni_len;
243
244 return pout - string;
245 }
246 else
247#endif
248 // TODO
249 {
250 int i = 0;
251
252 while (i < uni_len / 2)
253 {
254 in_uint8a(s, &string[i++], 1);
255 in_uint8s(s, 1);
256 }
257
258 return i - 1;
259 }
260}
#define WINDOWS_CODEPAGE
Definition: constants.h:24
void rdp_in_unistr(STREAM s, int in_len, char **string, uint32 *str_size)
Definition: rdp.c:265
int iconv_close(iconv_t cd)
Definition: win_iconv.c:756
iconv_t iconv_open(const char *tocode, const char *fromcode)
Definition: win_iconv.c:730
size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Definition: win_iconv.c:771
char string[160]
Definition: util.h:11
#define errno
Definition: errno.h:18
Definition: regsvr.c:104
#define iconv_t
Definition: iconv.h:68

◆ rdp_loop()

BOOL rdp_loop ( RDPCLIENT This,
BOOL deactivated,
uint32 ext_disc_reason 
)

Definition at line 1431 of file rdp.c.

1432{
1433 uint8 type;
1434 BOOL disc = False; /* True when a disconnect PDU was received */
1435 BOOL cont = True;
1436 STREAM s;
1437
1438 while (cont)
1439 {
1440 s = rdp_recv(This, &type);
1441 if (s == NULL)
1442 return False;
1443 switch (type)
1444 {
1447 return False;
1448 *deactivated = False;
1449 break;
1450 case RDP_PDU_DEACTIVATE:
1451 DEBUG(("RDP_PDU_DEACTIVATE\n"));
1452 *deactivated = True;
1453 break;
1454 case RDP_PDU_REDIRECT:
1455 return process_redirect_pdu(This, s);
1456 break;
1457 case RDP_PDU_DATA:
1459 break;
1460 case 0:
1461 break;
1462 default:
1463 unimpl("PDU %d\n", type);
1464 }
1465 if (disc)
1466 return False;
1467 cont = This->next_packet < s->end;
1468 }
1469 return True;
1470}
@ RDP_PDU_DEMAND_ACTIVE
Definition: constants.h:160
@ RDP_PDU_DEACTIVATE
Definition: constants.h:163
@ RDP_PDU_REDIRECT
Definition: constants.h:162
@ RDP_PDU_DATA
Definition: constants.h:164
static void process_demand_active(STREAM s)
Definition: rdp.c:1067
static STREAM rdp_recv(uint8 *type)
Definition: rdp.c:85
static RD_BOOL process_data_pdu(STREAM s, uint32 *ext_disc_reason)
Definition: rdp.c:1416
static RD_BOOL process_redirect_pdu(STREAM s, RD_BOOL enhanced_redirect)
Definition: rdp.c:1506
int deactivated
Definition: svgawin.c:63

◆ rdp_main_loop()

void rdp_main_loop ( RDPCLIENT This,
BOOL deactivated,
uint32 ext_disc_reason 
)

Definition at line 1423 of file rdp.c.

1424{
1426 ;
1427}
RD_BOOL rdp_loop(RD_BOOL *deactivated, uint32 *ext_disc_reason)
Definition: rdp.c:1695

◆ rdp_out_unistr()

void rdp_out_unistr ( RDPCLIENT This,
STREAM  s,
wchar_t string,
int  len 
)

Definition at line 134 of file rdp.c.

135{
136#ifdef HAVE_ICONV
137 size_t ibl = strlen(string), obl = len + 2;
138 static iconv_t iconv_h = (iconv_t) - 1;
139 char *pin = string, *pout = (char *) s->p;
140
141 memset(pout, 0, len + 4);
142
143 if (This->rdp.iconv_works)
144 {
145 if (iconv_h == (iconv_t) - 1)
146 {
147 size_t i = 1, o = 4;
148 if ((iconv_h = iconv_open(WINDOWS_CODEPAGE, This->codepage)) == (iconv_t) - 1)
149 {
150 warning("rdp_out_unistr: iconv_open[%s -> %s] fail %d\n",
151 This->codepage, WINDOWS_CODEPAGE, (int) iconv_h);
152
153 This->rdp.iconv_works = False;
154 rdp_out_unistr(This, s, string, len);
155 return;
156 }
157 if (iconv(iconv_h, (ICONV_CONST char **) &pin, &i, &pout, &o) ==
158 (size_t) - 1)
159 {
160 iconv_close(iconv_h);
161 iconv_h = (iconv_t) - 1;
162 warning("rdp_out_unistr: iconv(1) fail, errno %d\n", errno);
163
164 This->rdp.iconv_works = False;
165 rdp_out_unistr(This, s, string, len);
166 return;
167 }
168 pin = string;
169 pout = (char *) s->p;
170 }
171
172 if (iconv(iconv_h, (ICONV_CONST char **) &pin, &ibl, &pout, &obl) == (size_t) - 1)
173 {
174 iconv_close(iconv_h);
175 iconv_h = (iconv_t) - 1;
176 warning("rdp_out_unistr: iconv(2) fail, errno %d\n", errno);
177
178 This->rdp.iconv_works = False;
179 rdp_out_unistr(This, s, string, len);
180 return;
181 }
182
183 s->p += len + 2;
184
185 }
186 else
187#endif
188 // TODO
189 {
190 int i = 0, j = 0;
191
192 len += 2;
193
194 while (i < len)
195 {
196 int c = string[j++];
197 s->p[i++] = (c >> 0) & 0xFF;
198 s->p[i++] = (c >> 8) & 0xFF;
199 }
200
201 s->p += len;
202 }
203}
void rdp_out_unistr(STREAM s, char *string, int len)
Definition: rdp.c:188
__kernel_size_t size_t
Definition: linux.h:237
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250

◆ rdp_reconnect()

BOOL rdp_reconnect ( RDPCLIENT This,
char server,
uint32  flags,
wchar_t username,
wchar_t domain,
wchar_t password,
wchar_t command,
wchar_t directory,
wchar_t hostname,
char cookie 
)

Definition at line 1486 of file rdp.c.

1488{
1490 return False;
1491
1493 return True;
1494}
BOOL sec_reconnect(RDPCLIENT *This, char *server, wchar_t *hostname, char *cookie)
Definition: secure.c:933

Referenced by main(), and SEALED_::ProtocolLoop().

◆ rdp_reset_state()

void rdp_reset_state ( RDPCLIENT This)

Definition at line 1498 of file rdp.c.

1499{
1500 This->next_packet = NULL; /* reset the packet information */
1501 This->rdp_shareid = 0;
1503}
void sec_reset_state(void)
Definition: secure.c:1039

◆ rdp_send_client_window_status()

BOOL rdp_send_client_window_status ( RDPCLIENT This,
int  status 
)

Definition at line 483 of file rdp.c.

484{
485 STREAM s;
486
487 if (This->rdp.current_status == status)
488 return True;
489
490 s = rdp_init_data(This, 12);
491
492 if(s == NULL)
493 return False;
494
496
497 switch (status)
498 {
499 case 0: /* shut the server up */
500 break;
501
502 case 1: /* receive data again */
503 out_uint32_le(s, 0); /* unknown */
504 out_uint16_le(s, This->width);
505 out_uint16_le(s, This->height);
506 break;
507 }
508
509 s_mark_end(s);
510 This->rdp.current_status = status;
512}
@ RDP_DATA_PDU_CLIENT_WINDOW_STATUS
Definition: constants.h:176
#define out_uint16_le(s, v)
Definition: parse.h:58
static STREAM rdp_init_data(int maxlen)
Definition: rdp.c:140
static void rdp_send_data(STREAM s, uint8 data_pdu_type)
Definition: rdp.c:152
Definition: ps.c:97

◆ rdp_send_input()

BOOL rdp_send_input ( RDPCLIENT This,
uint32  time,
uint16  message_type,
uint16  device_flags,
uint16  param1,
uint16  param2 
)

Definition at line 459 of file rdp.c.

460{
461 STREAM s;
462
463 s = rdp_init_data(This, 16);
464
465 if(s == NULL)
466 return False;
467
468 out_uint16_le(s, 1); /* number of events */
469 out_uint16(s, 0); /* pad */
470
472 out_uint16_le(s, message_type);
473 out_uint16_le(s, device_flags);
474 out_uint16_le(s, param1);
475 out_uint16_le(s, param2);
476
477 s_mark_end(s);
479}
@ RDP_DATA_PDU_INPUT
Definition: constants.h:173
#define out_uint16(s, v)
Definition: parse.h:84
__u16 time
Definition: mkdosfs.c:8

◆ reset_order_state()

void reset_order_state ( RDPCLIENT This)

Definition at line 1386 of file orders.c.

1387{
1388 memset(&This->orders.order_state, 0, sizeof(This->orders.order_state));
1389 This->orders.order_state.order_type = RDP_ORDER_PATBLT;
1390}

◆ save_licence()

void save_licence ( RDPCLIENT This,
unsigned char data,
int  length 
)

Definition at line 178 of file rdesktop-core-tester.cpp.

179 {
180 }

◆ seamless_init()

BOOL seamless_init ( RDPCLIENT This)

Definition at line 333 of file seamless.c.

334{
335 if (!This->seamless_rdp)
336 return False;
337
338 This->seamless.serial = 0;
339
340 This->seamless.channel =
343 return (This->seamless.channel != NULL);
344}
static void seamless_process(RDPCLIENT *This, STREAM s)
Definition: seamless.c:311

◆ seamless_select_timeout()

void seamless_select_timeout ( RDPCLIENT This,
struct timeval tv 
)

Definition at line 416 of file seamless.c.

417{
418 struct timeval ourtimeout = { 0, SEAMLESSRDP_POSITION_TIMER };
419
420 if (This->seamless_rdp)
421 {
422 if (timercmp(&ourtimeout, tv, <))
423 {
424 tv->tv_sec = ourtimeout.tv_sec;
425 tv->tv_usec = ourtimeout.tv_usec;
426 }
427 }
428}
#define SEAMLESSRDP_POSITION_TIMER
Definition: constants.h:570
#define timercmp(tvp, uvp, cmp)
Definition: rdesktop.h:184
unsigned long tv_sec
Definition: linux.h:1738
unsigned long tv_usec
Definition: linux.h:1739

◆ seamless_send_focus()

unsigned int seamless_send_focus ( RDPCLIENT This,
unsigned long  id,
unsigned long  flags 
)

Definition at line 443 of file seamless.c.

444{
445 if (!This->seamless_rdp)
446 return (unsigned int) -1;
447
448 return seamless_send(This, "FOCUS", "0x%08lx,0x%lx", id, flags);
449}
static unsigned int seamless_send(RDPCLIENT *This, const char *command, const char *format,...)
Definition: seamless.c:348

◆ seamless_send_position()

unsigned int seamless_send_position ( RDPCLIENT This,
unsigned long  id,
int  x,
int  y,
int  width,
int  height,
unsigned long  flags 
)

Definition at line 407 of file seamless.c.

408{
409 return seamless_send(This, "POSITION", "0x%08lx,%d,%d,%d,%d,0x%lx", id, x, y, width, height,
410 flags);
411}

◆ seamless_send_state()

unsigned int seamless_send_state ( RDPCLIENT This,
unsigned long  id,
unsigned int  state,
unsigned long  flags 
)

Definition at line 397 of file seamless.c.

398{
399 if (!This->seamless_rdp)
400 return (unsigned int) -1;
401
402 return seamless_send(This, "STATE", "0x%08lx,0x%x,0x%lx", id, state, flags);
403}

◆ seamless_send_sync()

unsigned int seamless_send_sync ( RDPCLIENT This)

Definition at line 387 of file seamless.c.

388{
389 if (!This->seamless_rdp)
390 return (unsigned int) -1;
391
392 return seamless_send(This, "SYNC", "");
393}

◆ seamless_send_zchange()

unsigned int seamless_send_zchange ( RDPCLIENT This,
unsigned long  id,
unsigned long  below,
unsigned long  flags 
)

Definition at line 432 of file seamless.c.

433{
434 if (!This->seamless_rdp)
435 return (unsigned int) -1;
436
437 return seamless_send(This, "ZCHANGE", "0x%08lx,0x%08lx,0x%lx", id, below, flags);
438}

◆ sec_connect()

BOOL sec_connect ( RDPCLIENT This,
char server,
wchar_t hostname,
char cookie 
)

Definition at line 905 of file secure.c.

906{
907 struct stream mcs_data;
908 void * p = malloc(512);
909
910 if(p == NULL)
911 {
912 This->disconnect_reason = 262;
913 return False;
914 }
915
916 /* We exchange some RDP data during the MCS-Connect */
917 mcs_data.size = 512;
918 mcs_data.p = mcs_data.data = (uint8 *) p;
919 sec_out_mcs_data(This, &mcs_data, hostname);
920
921 if (!mcs_connect(This, server, cookie, &mcs_data))
922 return False;
923
924 /* sec_process_mcs_data(&mcs_data); */
925 if (This->encryption)
927 free(mcs_data.data);
928 return True;
929}
static void sec_out_mcs_data(STREAM s, uint32 selected_protocol)
Definition: secure.c:498
static void sec_establish_key(void)
Definition: secure.c:480
BOOL mcs_connect(RDPCLIENT *This, char *server, char *cookie, STREAM mcs_data)
Definition: mcs.c:388

◆ sec_decrypt()

void sec_decrypt ( RDPCLIENT This,
uint8 data,
int  length 
)

Definition at line 239 of file secure.c.

240{
241 if (This->secure.decrypt_use_count == 4096)
242 {
243 sec_update(This, This->secure.decrypt_key, This->secure.decrypt_update_key);
244 RC4_set_key(&This->secure.rc4_decrypt_key, This->secure.rc4_key_len, This->secure.decrypt_key);
245 This->secure.decrypt_use_count = 0;
246 }
247
248 RC4(&This->secure.rc4_decrypt_key, length, data, data);
249 This->secure.decrypt_use_count++;
250}
static void sec_update(uint8 *key, uint8 *update_key)
Definition: secure.c:346

◆ sec_disconnect()

void sec_disconnect ( RDPCLIENT This)

Definition at line 961 of file secure.c.

962{
964}
void mcs_disconnect(void)
Definition: mcs.c:356

◆ sec_hash_16()

void sec_hash_16 ( uint8 out,
uint8 in,
uint8 salt1,
uint8 salt2 
)

Definition at line 187 of file secure.c.

188{
189 void * md5;
190
193 rdssl_md5_transform(md5, (char *)in, 16);
194 rdssl_md5_transform(md5, (char *)salt1, 32);
195 rdssl_md5_transform(md5, (char *)salt2, 32);
196 rdssl_md5_complete(md5, (char *)out);
198}
void rdssl_md5_clear(void *md5_info)
Definition: ssl_calls.c:428
void rdssl_md5_transform(void *md5_info, char *data, int len)
Definition: ssl_calls.c:435
void rdssl_md5_complete(void *md5_info, char *data)
Definition: ssl_calls.c:442
void rdssl_md5_info_delete(void *md5_info)
Definition: ssl_calls.c:421
void * rdssl_md5_info_create(void)
Definition: ssl_calls.c:414
#define md5
Definition: compat-1.3.h:2034
GLuint in
Definition: glext.h:9616
static FILE * out
Definition: regtests2xml.c:44

Referenced by sec_generate_keys().

◆ sec_hash_48()

void sec_hash_48 ( uint8 out,
uint8 in,
uint8 salt1,
uint8 salt2,
uint8  salt 
)

Definition at line 155 of file secure.c.

156{
157 uint8 shasig[20];
158 uint8 pad[4];
159 void * sha;
160 void * md5;
161 int i;
162
163 for (i = 0; i < 3; i++)
164 {
165 memset(pad, salt + i, i + 1);
168 rdssl_sha1_transform(sha, (char *)pad, i + 1);
169 rdssl_sha1_transform(sha, (char *)in, 48);
170 rdssl_sha1_transform(sha, (char *)salt1, 32);
171 rdssl_sha1_transform(sha, (char *)salt2, 32);
172 rdssl_sha1_complete(sha, (char *)shasig);
176 rdssl_md5_transform(md5, (char *)in, 48);
177 rdssl_md5_transform(md5, (char *)shasig, 20);
178 rdssl_md5_complete(md5, (char *)out + i * 16);
180 }
181}
void rdssl_sha1_clear(void *sha1_info)
Definition: ssl_calls.c:393
void rdssl_sha1_transform(void *sha1_info, char *data, int len)
Definition: ssl_calls.c:400
void rdssl_sha1_info_delete(void *sha1_info)
Definition: ssl_calls.c:386
void rdssl_sha1_complete(void *sha1_info, char *data)
Definition: ssl_calls.c:407
void * rdssl_sha1_info_create(void)
Definition: ssl_calls.c:379
static const WCHAR sha[]
Definition: oid.c:1218

Referenced by sec_generate_keys().

◆ sec_init()

STREAM sec_init ( RDPCLIENT This,
uint32  flags,
int  maxlen 
)

Definition at line 305 of file secure.c.

306{
307 int hdrlen;
308 STREAM s;
309
310 if (!This->licence_issued)
311 hdrlen = (flags & SEC_ENCRYPT) ? 12 : 4;
312 else
313 hdrlen = (flags & SEC_ENCRYPT) ? 12 : 0;
314 s = mcs_init(This, maxlen + hdrlen);
315
316 if(s == NULL)
317 return s;
318
319 s_push_layer(s, sec_hdr, hdrlen);
320
321 return s;
322}
STREAM mcs_init(int length)
Definition: mcs.c:242

◆ sec_process_mcs_data()

void sec_process_mcs_data ( RDPCLIENT This,
STREAM  s 
)

Definition at line 771 of file secure.c.

772{
774 uint8 *next_tag;
775 uint8 len;
776
777 in_uint8s(s, 21); /* header (T.124 ConferenceCreateResponse) */
778 in_uint8(s, len);
779 if (len & 0x80)
780 in_uint8(s, len);
781
782 while (s->p < s->end)
783 {
786
787 if (length <= 4)
788 return;
789
790 next_tag = s->p + length - 4;
791
792 switch (tag)
793 {
794 case SEC_TAG_SRV_INFO:
796 break;
797
800 break;
801
803 /* FIXME: We should parse this information and
804 use it to map RDP5 channels to MCS
805 channels */
806 break;
807
808 default:
809 unimpl("response tag 0x%x\n", tag);
810 }
811
812 s->p = next_tag;
813 }
814}
#define SEC_TAG_SRV_INFO
Definition: constants.h:115
#define SEC_TAG_SRV_CRYPT
Definition: constants.h:116
#define SEC_TAG_SRV_CHANNELS
Definition: constants.h:117
static void sec_process_srv_info(STREAM s)
Definition: secure.c:842
static void sec_process_crypt_info(STREAM s)
Definition: secure.c:818

◆ sec_reconnect()

BOOL sec_reconnect ( RDPCLIENT This,
char server,
wchar_t hostname,
char cookie 
)

Definition at line 933 of file secure.c.

934{
935 struct stream mcs_data;
936 void * p = malloc(512);
937
938 if(p == NULL)
939 {
940 This->disconnect_reason = 262;
941 return False;
942 }
943
944 /* We exchange some RDP data during the MCS-Connect */
945 mcs_data.size = 512;
946 mcs_data.p = mcs_data.data = (uint8 *) p;
947 sec_out_mcs_data(This, &mcs_data, hostname);
948
949 if (!mcs_reconnect(This, server, cookie, &mcs_data))
950 return False;
951
952 /* sec_process_mcs_data(&mcs_data); */
953 if (This->encryption)
955 free(mcs_data.data);
956 return True;
957}
BOOL mcs_reconnect(RDPCLIENT *This, char *server, char *cookie, STREAM mcs_data)
Definition: mcs.c:424

Referenced by rdp_reconnect().

◆ sec_recv()

STREAM sec_recv ( RDPCLIENT This,
uint8 rdpver 
)

Definition at line 818 of file secure.c.

819{
820 uint32 sec_flags;
821 uint16 channel;
822 STREAM s;
823
824 while ((s = mcs_recv(This, &channel, rdpver)) != NULL)
825 {
826 if (rdpver != NULL)
827 {
828 if (*rdpver != 3)
829 {
830 if (*rdpver & 0x80)
831 {
832 in_uint8s(s, 8); /* signature */
833 sec_decrypt(This, s->p, (int)(s->end - s->p));
834 }
835 return s;
836 }
837 }
838 if (This->encryption || !This->licence_issued)
839 {
840 in_uint32_le(s, sec_flags);
841
842 if (sec_flags & SEC_ENCRYPT)
843 {
844 in_uint8s(s, 8); /* signature */
845 sec_decrypt(This, s->p, (int)(s->end - s->p));
846 }
847
848 if (sec_flags & SEC_LICENCE_NEG)
849 {
851 continue;
852 }
853
854 if (sec_flags & 0x0400) /* SEC_REDIRECT_ENCRYPT */
855 {
856 uint8 swapbyte;
857
858 in_uint8s(s, 8); /* signature */
859 sec_decrypt(This, s->p, (int)(s->end - s->p));
860
861 /* Check for a redirect packet, starts with 00 04 */
862 if (s->p[0] == 0 && s->p[1] == 4)
863 {
864 /* for some reason the PDU and the length seem to be swapped.
865 This isn't good, but we're going to do a byte for byte
866 swap. So the first foure value appear as: 00 04 XX YY,
867 where XX YY is the little endian length. We're going to
868 use 04 00 as the PDU type, so after our swap this will look
869 like: XX YY 04 00 */
870 swapbyte = s->p[0];
871 s->p[0] = s->p[2];
872 s->p[2] = swapbyte;
873
874 swapbyte = s->p[1];
875 s->p[1] = s->p[3];
876 s->p[3] = swapbyte;
877
878 swapbyte = s->p[2];
879 s->p[2] = s->p[3];
880 s->p[3] = swapbyte;
881 }
882#ifdef WITH_DEBUG
883 /* warning! this debug statement will show passwords in the clear! */
884 hexdump(s->p, s->end - s->p);
885#endif
886 }
887
888 }
889
890 if (channel != MCS_GLOBAL_CHANNEL)
891 {
892 channel_process(This, s, channel);
893 *rdpver = 0xff;
894 return s;
895 }
896
897 return s;
898 }
899
900 return NULL;
901}
void channel_process(STREAM s, uint16 mcs_channel)
Definition: channels.c:138
void licence_process(STREAM s)
Definition: licence.c:378
STREAM mcs_recv(uint16 *channel, uint8 *rdpver)
Definition: mcs.c:280
void sec_decrypt(uint8 *data, int length)
Definition: secure.c:396
#define SEC_LICENCE_NEG
Definition: constants.h:72

◆ sec_reset_state()

void sec_reset_state ( RDPCLIENT This)

Definition at line 968 of file secure.c.

969{
970 This->server_rdp_version = 0;
971 This->secure.encrypt_use_count = 0;
972 This->secure.decrypt_use_count = 0;
974}
void mcs_reset_state(void)
Definition: mcs.c:363

◆ sec_send()

BOOL sec_send ( RDPCLIENT This,
STREAM  s,
uint32  flags 
)

Definition at line 356 of file secure.c.

357{
359}
void sec_send_to_channel(STREAM s, uint32 flags, uint16 channel)
Definition: secure.c:436

◆ sec_send_to_channel()

BOOL sec_send_to_channel ( RDPCLIENT This,
STREAM  s,
uint32  flags,
uint16  channel 
)

Definition at line 328 of file secure.c.

329{
330 int datalen;
331
332 s_pop_layer(s, sec_hdr);
333 if (!This->licence_issued || (flags & SEC_ENCRYPT))
335
336 if (flags & SEC_ENCRYPT)
337 {
338 flags &= ~SEC_ENCRYPT;
339 datalen = (int)(s->end - s->p - 8);
340
341#if WITH_DEBUG
342 DEBUG(("Sending encrypted packet:\n"));
343 hexdump(s->p + 8, datalen);
344#endif
345
346 sec_sign(s->p, 8, This->secure.sign_key, This->secure.rc4_key_len, s->p + 8, datalen);
347 sec_encrypt(This, s->p + 8, datalen);
348 }
349
350 return mcs_send_to_channel(This, s, channel);
351}
static void sec_encrypt(uint8 *data, int length)
Definition: secure.c:381
void sec_sign(uint8 *signature, int siglen, uint8 *session_key, int keylen, uint8 *data, int datalen)
Definition: secure.c:314

◆ sec_sign()

void sec_sign ( uint8 signature,
int  siglen,
uint8 session_key,
int  keylen,
uint8 data,
int  datalen 
)

Definition at line 314 of file secure.c.

315{
316 uint8 shasig[20];
317 uint8 md5sig[16];
318 uint8 lenhdr[4];
319 void * sha;
320 void * md5;
321
322 buf_out_uint32(lenhdr, datalen);
323
326 rdssl_sha1_transform(sha, (char *)session_key, keylen);
327 rdssl_sha1_transform(sha, (char *)pad_54, 40);
328 rdssl_sha1_transform(sha, (char *)lenhdr, 4);
330 rdssl_sha1_complete(sha, (char *)shasig);
332
335 rdssl_md5_transform(md5, (char *)session_key, keylen);
336 rdssl_md5_transform(md5, (char *)pad_92, 48);
337 rdssl_md5_transform(md5, (char *)shasig, 20);
338 rdssl_md5_complete(md5, (char *)md5sig);
340
341 memcpy(signature, md5sig, siglen);
342}
void buf_out_uint32(uint8 *buffer, uint32 value)
Definition: secure.c:304
static uint8 pad_54[40]
Definition: secure.c:288
static uint8 pad_92[48]
Definition: secure.c:295

Referenced by sec_send_to_channel().

◆ str_handle_lines()

BOOL str_handle_lines ( RDPCLIENT This,
const char input,
char **  rest,
str_handle_lines_t  linehandler,
void data 
)

Definition at line 1246 of file rdesktop.c.

1247{
1248 char *buf, *p;
1249 char *oldrest;
1250 size_t inputlen;
1251 size_t buflen;
1252 size_t restlen = 0;
1253 BOOL ret = True;
1254
1255 /* Copy data to buffer */
1256 inputlen = strlen(input);
1257 if (*rest)
1258 restlen = strlen(*rest);
1259 buflen = restlen + inputlen + 1;
1260 buf = (char *) xmalloc(buflen);
1261 buf[0] = '\0';
1262 if (*rest)
1263 STRNCPY(buf, *rest, buflen);
1264 strncat(buf, input, inputlen);
1265 p = buf;
1266
1267 while (1)
1268 {
1269 char *newline = strchr(p, '\n');
1270 if (newline)
1271 {
1272 *newline = '\0';
1273 if (!linehandler(This, p, data))
1274 {
1275 p = newline + 1;
1276 ret = False;
1277 break;
1278 }
1279 p = newline + 1;
1280 }
1281 else
1282 {
1283 break;
1284
1285 }
1286 }
1287
1288 /* Save in rest */
1289 oldrest = *rest;
1290 restlen = buf + buflen - p;
1291 *rest = (char *) xmalloc(restlen);
1292 STRNCPY((*rest), p, restlen);
1293 xfree(oldrest);
1294
1295 xfree(buf);
1296 return ret;
1297}
char * strncat(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:605
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
void xfree(void *mem)
Definition: rdesktop.c:1080
void * xmalloc(int size)
Definition: rdesktop.c:1037

Referenced by subprocess().

◆ str_startswith()

BOOL str_startswith ( const char s,
const char prefix 
)

Definition at line 1235 of file rdesktop.c.

1236{
1237 return (strncmp(s, prefix, strlen(prefix)) == 0);
1238}
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534

Referenced by main().

◆ subprocess()

BOOL subprocess ( RDPCLIENT This,
char *const  argv[],
str_handle_lines_t  linehandler,
void data 
)

Definition at line 1302 of file rdesktop.c.

1303{
1304 pid_t child;
1305 int fd[2];
1306 int n = 1;
1307 char output[256];
1308 char *rest = NULL;
1309
1310 if (pipe(fd) < 0)
1311 {
1312 perror("pipe");
1313 return False;
1314 }
1315
1316 if ((child = fork()) < 0)
1317 {
1318 perror("fork");
1319 return False;
1320 }
1321
1322 /* Child */
1323 if (child == 0)
1324 {
1325 /* Close read end */
1326 close(fd[0]);
1327
1328 /* Redirect stdout and stderr to pipe */
1329 dup2(fd[1], 1);
1330 dup2(fd[1], 2);
1331
1332 /* Execute */
1333 execvp(argv[0], argv);
1334 perror("Error executing child");
1335 _exit(128);
1336 }
1337
1338 /* Parent. Close write end. */
1339 close(fd[1]);
1340 while (n > 0)
1341 {
1342 n = read(fd[0], output, 255);
1343 output[n] = '\0';
1344 str_handle_lines(This, output, &rest, linehandler, data);
1345 }
1346 xfree(rest);
1347
1348 return True;
1349}
void _exit(int exitcode)
Definition: _exit.c:25
DWORD pid_t
Definition: types.h:91
_CRTIMP void __cdecl perror(_In_opt_z_ const char *_ErrMsg)
static HWND child
Definition: cursoricon.c:298
BOOL str_handle_lines(RDPCLIENT *This, const char *input, char **rest, str_handle_lines_t linehandler, void *data)
Definition: rdesktop.c:1246
_Check_return_ _CRTIMP int __cdecl dup2(_In_ int _FileHandleSrc, _In_ int _FileHandleDst)
_CRTIMP intptr_t __cdecl execvp(_In_z_ const char *_Filename, _In_z_ char *const _ArgList[])

◆ tcp_connect()

BOOL tcp_connect ( RDPCLIENT This,
char server 
)

Definition at line 205 of file tcp.c.

206{
207 int true_value = 1;
208
209#ifdef IPv6
210
211 int n;
212 struct addrinfo hints, *res, *ressave;
213 char tcp_port_rdp_s[10];
214
215 snprintf(tcp_port_rdp_s, 10, "%d", This->tcp_port_rdp);
216
217 memset(&hints, 0, sizeof(struct addrinfo));
218 hints.ai_family = AF_UNSPEC;
219 hints.ai_socktype = SOCK_STREAM;
220
221 if ((n = getaddrinfo(server, tcp_port_rdp_s, &hints, &res)))
222 {
223 error("getaddrinfo: %s\n", gai_strerror(n));
224 return False;
225 }
226
227 ressave = res;
228 This->tcp.sock = -1;
229 while (res)
230 {
231 This->tcp.sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
232 if (!(This->tcp.sock < 0))
233 {
234 if (connect(This->tcp.sock, res->ai_addr, res->ai_addrlen) == 0)
235 break;
236 close(This->tcp.sock);
237 This->tcp.sock = -1;
238 }
239 res = res->ai_next;
240 }
241 freeaddrinfo(ressave);
242
243 if (This->tcp.sock == -1)
244 {
245 error("%s: unable to connect\n", server);
246 return False;
247 }
248
249#else /* no IPv6 support */
250
251 struct hostent *nslookup;
252 struct sockaddr_in servaddr;
253
254 if ((nslookup = gethostbyname(server)) != NULL)
255 {
256 memcpy(&servaddr.sin_addr, nslookup->h_addr, sizeof(servaddr.sin_addr));
257 }
258 else if ((servaddr.sin_addr.s_addr = inet_addr(server)) == INADDR_NONE)
259 {
260 error("%s: unable to resolve host\n", server);
261 This->disconnect_reason = 260;
262 return False;
263 }
264
265 if ((This->tcp.sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
266 {
267 // error("socket: %s\n", strerror(errno)); // EOF
268 return False;
269 }
270
271 servaddr.sin_family = AF_INET;
272 servaddr.sin_port = htons(This->tcp_port_rdp);
273
274 // TODO: apply connection timeout here
275
276 if (connect(This->tcp.sock, (struct sockaddr *) &servaddr, sizeof(struct sockaddr)) < 0)
277 {
278 // error("connect: %s\n", strerror(errno)); // EOF
279 This->disconnect_reason = 516;
280 closesocket(This->tcp.sock);
281 return False;
282 }
283
284#endif /* IPv6 */
285
286 setsockopt(This->tcp.sock, IPPROTO_TCP, TCP_NODELAY, (void *) &true_value, sizeof(true_value));
287
288 This->tcp.in.size = 4096;
289 This->tcp.in.data = (uint8 *) malloc(This->tcp.in.size);
290
291 if(This->tcp.in.data == NULL)
292 {
293 This->disconnect_reason = 262;
294 return False;
295 }
296
297 This->tcp.out.size = 4096;
298 This->tcp.out.data = (uint8 *) malloc(This->tcp.out.size);
299
300 if(This->tcp.out.data == NULL)
301 {
302 This->disconnect_reason = 262;
303 return False;
304 }
305
306 return True;
307}
#define INADDR_NONE
Definition: tcp.c:42
#define IPPROTO_TCP
Definition: ip.h:196
#define SOCK_STREAM
Definition: tcpip.h:118
#define AF_INET
Definition: tcpip.h:117
PHOSTENT WSAAPI gethostbyname(IN const char FAR *name)
Definition: getxbyxx.c:221
GLuint res
Definition: glext.h:9613
#define inet_addr(cp)
Definition: inet.h:98
#define htons(x)
Definition: module.h:215
#define closesocket
Definition: ncftp.h:477
namespace GUID const ADDRINFOEXW * hints
Definition: sock.c:80
INT WSAAPI setsockopt(IN SOCKET s, IN INT level, IN INT optname, IN CONST CHAR FAR *optval, IN INT optlen)
Definition: sockctrl.c:421
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
Definition: socklife.c:143
#define TCP_NODELAY
Definition: tcpdef.h:117
#define AF_UNSPEC
Definition: winsock.h:344
#define snprintf
Definition: wintirpc.h:48
#define getaddrinfo
Definition: wspiapi.h:44
#define freeaddrinfo
Definition: wspiapi.h:46

◆ tcp_disconnect()

BOOL tcp_disconnect ( RDPCLIENT This)

Definition at line 311 of file tcp.c.

312{
313 closesocket(This->tcp.sock);
314 return True;
315}

◆ tcp_get_address()

wchar_t * tcp_get_address ( RDPCLIENT This)

Definition at line 318 of file tcp.c.

319{
320#if 0
321 static char ipaddr[32];
322 struct sockaddr_in sockaddr;
323 socklen_t len = sizeof(sockaddr);
324 if (getsockname(This->tcp.sock, (struct sockaddr *) &sockaddr, &len) == 0)
325 {
326 unsigned char *ip = (unsigned char *) &sockaddr.sin_addr;
327 sprintf(ipaddr, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
328 }
329 else
330 strcpy(ipaddr, "127.0.0.1");
331 return ipaddr;
332#endif
333 return NULL; // TODO
334}
int socklen_t
Definition: tcp.c:35
INT WSAAPI getsockname(IN SOCKET s, OUT LPSOCKADDR name, IN OUT INT FAR *namelen)
Definition: sockctrl.c:213
Definition: dhcpd.h:62

◆ tcp_init()

STREAM tcp_init ( RDPCLIENT This,
uint32  maxlen 
)

Definition at line 43 of file tcp.c.

44{
45 if (maxlen > This->tcp.out.size)
46 {
47 void * p;
48
49 p = realloc(This->tcp.out.data, maxlen);
50
51 if (p == NULL)
52 {
53 This->disconnect_reason = 262;
54 return NULL;
55 }
56
57 This->tcp.out.data = (uint8 *)p;
58 This->tcp.out.size = maxlen;
59 }
60
61 This->tcp.out.p = This->tcp.out.data;
62 This->tcp.out.end = This->tcp.out.data + This->tcp.out.size;
63 return &This->tcp.out;
64}

◆ tcp_recv()

STREAM tcp_recv ( RDPCLIENT This,
STREAM  s,
uint32  length 
)

Definition at line 110 of file tcp.c.

111{
112 unsigned int new_length, end_offset, p_offset;
113 DWORD rcvd = 0;
114
115 if (s == NULL)
116 {
117 /* read into "new" stream */
118 if (length > This->tcp.in.size)
119 {
120 void * p = realloc(This->tcp.in.data, length);
121
122 if(p == NULL)
123 {
124 This->disconnect_reason = 262;
125 return NULL;
126 }
127
128 This->tcp.in.data = (uint8 *) p;
129 This->tcp.in.size = length;
130 }
131 This->tcp.in.end = This->tcp.in.p = This->tcp.in.data;
132 s = &This->tcp.in;
133 }
134 else
135 {
136 /* append to existing stream */
137 new_length = (unsigned int)(s->end - s->data) + length;
138 if (new_length > s->size)
139 {
140 void * p = realloc(s->data, new_length);
141
142 if(p == NULL)
143 {
144 This->disconnect_reason = 262;
145 return NULL;
146 }
147
148 p_offset = (unsigned int)(s->p - s->data);
149 end_offset = (unsigned int)(s->end - s->data);
150 s->data = (uint8 *) p;
151 s->size = new_length;
152 s->p = s->data + p_offset;
153 s->end = s->data + end_offset;
154 }
155 }
156
157 while (length > 0)
158 {
160 memset(&overlapped, 0, sizeof(overlapped));
161
162 if (!ui_select(This, This->tcp.sock))
163 /* User quit */
164 return NULL;
165
166 ReadFile((HANDLE)This->tcp.sock, s->end, length, NULL, &overlapped);
167
168 switch(WaitForSingleObjectEx((HANDLE)This->tcp.sock, INFINITE, TRUE))
169 {
170 /* Success */
171 case WAIT_OBJECT_0:
172 break;
173
174 /* Timeout or error */
175 case WAIT_TIMEOUT:
176 default:
177 This->disconnect_reason = 1028;
178
179 /* Aborted, must disconnect ASAP */
181 CancelIo((HANDLE)This->tcp.sock);
182 break;
183 }
184
185 /* Wait for completion. We could hang here, but we shouldn't */
186 if(!GetOverlappedResult((HANDLE)This->tcp.sock, &overlapped, &rcvd, TRUE))
187 return False;
188
189 if (rcvd == 0)
190 {
191 error("Connection closed\n");
192 This->disconnect_reason = 2308;
193 return NULL;
194 }
195
196 s->end += rcvd;
197 length -= rcvd;
198 }
199
200 return s;
201}
int ui_select(int rdp_socket)
Definition: uimain.c:164
#define WAIT_TIMEOUT
Definition: dderror.h:14
BOOL WINAPI CancelIo(IN HANDLE hFile)
Definition: deviceio.c:290
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define INFINITE
Definition: serial.h:102
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI GetOverlappedResult(IN HANDLE hFile, IN LPOVERLAPPED lpOverlapped, OUT LPDWORD lpNumberOfBytesTransferred, IN BOOL bWait)
Definition: iocompl.c:221
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED * overlapped
Definition: sock.c:81
DWORD WINAPI WaitForSingleObjectEx(IN HANDLE hHandle, IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:94
#define WAIT_IO_COMPLETION
Definition: winbase.h:411
#define WAIT_OBJECT_0
Definition: winbase.h:406

◆ tcp_reset_state()

void tcp_reset_state ( RDPCLIENT This)

Definition at line 339 of file tcp.c.

340{
341 This->tcp.sock = -1; /* reset socket */
342
343 /* Clear the incoming stream */
344 if (This->tcp.in.data != NULL)
345 free(This->tcp.in.data);
346 This->tcp.in.p = NULL;
347 This->tcp.in.end = NULL;
348 This->tcp.in.data = NULL;
349 This->tcp.in.size = 0;
350 This->tcp.in.iso_hdr = NULL;
351 This->tcp.in.mcs_hdr = NULL;
352 This->tcp.in.sec_hdr = NULL;
353 This->tcp.in.rdp_hdr = NULL;
354 This->tcp.in.channel_hdr = NULL;
355
356 /* Clear the outgoing stream */
357 if (This->tcp.out.data != NULL)
358 free(This->tcp.out.data);
359 This->tcp.out.p = NULL;
360 This->tcp.out.end = NULL;
361 This->tcp.out.data = NULL;
362 This->tcp.out.size = 0;
363 This->tcp.out.iso_hdr = NULL;
364 This->tcp.out.mcs_hdr = NULL;
365 This->tcp.out.sec_hdr = NULL;
366 This->tcp.out.rdp_hdr = NULL;
367 This->tcp.out.channel_hdr = NULL;
368}

◆ tcp_send()

BOOL tcp_send ( RDPCLIENT This,
STREAM  s 
)

Definition at line 68 of file tcp.c.

69{
70 int length = (int)(s->end - s->data);
71 int total = 0;
72 DWORD sent;
73
75 memset(&overlapped, 0, sizeof(overlapped));
76
77 while (total < length)
78 {
79 WriteFile((HANDLE)This->tcp.sock, s->data + total, length - total, NULL, &overlapped);
80
81 switch(WaitForSingleObjectEx((HANDLE)This->tcp.sock, INFINITE, TRUE))
82 {
83 /* Success */
84 case WAIT_OBJECT_0:
85 break;
86
87 /* Timeout or error */
88 case WAIT_TIMEOUT:
89 default:
90 This->disconnect_reason = 772;
91
92 /* Aborted, must disconnect ASAP */
94 CancelIo((HANDLE)This->tcp.sock);
95 break;
96 }
97
98 /* Wait for completion. We could hang here, but we shouldn't */
100 return False;
101
102 total += sent;
103 }
104
105 return True;
106}
@ sent
Definition: SystemMenu.c:27
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
size_t total

◆ toupper_str()

void toupper_str ( char p)

Definition at line 1223 of file rdesktop.c.

1224{
1225 while (*p)
1226 {
1227 if ((*p >= 'a') && (*p <= 'z'))
1228 *p = toupper((int) *p);
1229 p++;
1230 }
1231}
int toupper(int c)
Definition: utclib.c:881

◆ ui_begin_update()

void ui_begin_update ( RDPCLIENT This)

Definition at line 5622 of file activex.cpp.

5623{
5624 RdpClient::InnerToOuter(This)->GetUI()->Display_BeginUpdate();
5625}

◆ ui_bell()

void ui_bell ( RDPCLIENT This)

Definition at line 5889 of file activex.cpp.

5890{
5891 MessageBeep(0);
5892}
BOOL WINAPI MessageBeep(_In_ UINT uType)

◆ ui_clip_format_announce()

void ui_clip_format_announce ( RDPCLIENT This,
uint8 data,
uint32  length 
)

Definition at line 855 of file xclip.c.

856{
857 This->xclip.acquire_time = This->last_gesturetime;
858
859 XSetSelectionOwner(This->display, This->xclip.primary_atom, This->wnd, This->xclip.acquire_time);
860 if (XGetSelectionOwner(This->display, This->xclip.primary_atom) != This->wnd)
861 warning("Failed to aquire ownership of PRIMARY clipboard\n");
862
863 XSetSelectionOwner(This->display, This->xclip.clipboard_atom, This->wnd, This->xclip.acquire_time);
864 if (XGetSelectionOwner(This->display, This->xclip.clipboard_atom) != This->wnd)
865 warning("Failed to aquire ownership of CLIPBOARD clipboard\n");
866
867 if (This->xclip.formats_data)
868 xfree(This->xclip.formats_data);
869 This->xclip.formats_data = xmalloc(length);
870 memcpy(This->xclip.formats_data, data, length);
871 This->xclip.formats_data_length = length;
872
874}
static void xclip_notify_change(RDPCLIENT *This)
Definition: xclip.c:335

◆ ui_clip_handle_data()

void ui_clip_handle_data ( RDPCLIENT This,
uint8 data,
uint32  length 
)

Definition at line 878 of file xclip.c.

879{
880 BOOL free_data = False;
881
882 if (length == 0)
883 {
884 xclip_refuse_selection(This, &This->xclip.selection_request);
885 This->xclip.has_selection_request = False;
886 return;
887 }
888
889 if (This->xclip.selection_request.target == This->xclip.format_string_atom || This->xclip.selection_request.target == XA_STRING)
890 {
891 /* We're expecting a CF_TEXT response */
892 uint8 *firstnull;
893
894 /* translate linebreaks */
896
897 /* Only send data up to null byte, if any */
898 firstnull = (uint8 *) strchr((char *) data, '\0');
899 if (firstnull)
900 {
901 length = firstnull - data + 1;
902 }
903 }
904#ifdef USE_UNICODE_CLIPBOARD
905 else if (This->xclip.selection_request.target == This->xclip.format_utf8_string_atom)
906 {
907 /* We're expecting a CF_UNICODETEXT response */
909 if (cd != (iconv_t) - 1)
910 {
911 size_t utf8_length = length * 2;
912 char *utf8_data = malloc(utf8_length);
913 size_t utf8_length_remaining = utf8_length;
914 char *utf8_data_remaining = utf8_data;
915 char *data_remaining = (char *) data;
916 size_t length_remaining = (size_t) length;
917 if (utf8_data == NULL)
918 {
920 return;
921 }
922 iconv(cd, (ICONV_CONST char **) &data_remaining, &length_remaining,
923 &utf8_data_remaining, &utf8_length_remaining);
925 free_data = True;
926 data = (uint8 *) utf8_data;
927 length = utf8_length - utf8_length_remaining;
928 }
929 }
930 else if (This->xclip.selection_request.target == This->xclip.format_unicode_atom)
931 {
932 /* We're expecting a CF_UNICODETEXT response, so what we're
933 receiving matches our requirements and there's no need
934 for further conversions. */
935 }
936#endif
937 else if (This->xclip.selection_request.target == This->xclip.rdesktop_native_atom)
938 {
939 /* Pass as-is */
940 }
941 else
942 {
943 DEBUG_CLIPBOARD(("ui_clip_handle_data: BUG! I don't know how to convert selection target %s!\n", XGetAtomName(This->display, This->xclip.selection_request.target)));
944 xclip_refuse_selection(This, &This->xclip.selection_request);
945 This->xclip.has_selection_request = False;
946 return;
947 }
948
949 xclip_provide_selection(This, &This->xclip.selection_request, This->xclip.selection_request.target, 8, data, length - 1);
950 This->xclip.has_selection_request = False;
951
952 if (free_data)
953 free(data);
954}
InitDirComponents & cd
static const char utf8_length[128]
Definition: utf8.c:28
static void crlf2lf(uint8 *data, uint32 *length)
Definition: xclip.c:57
static void xclip_provide_selection(RDPCLIENT *This, XSelectionRequestEvent *req, Atom type, unsigned int format, uint8 *data, uint32 length)
Definition: xclip.c:136
static void xclip_refuse_selection(RDPCLIENT *This, XSelectionRequestEvent *req)
Definition: xclip.c:161

◆ ui_clip_request_data()

void ui_clip_request_data ( RDPCLIENT This,
uint32  format 
)

Definition at line 964 of file xclip.c.

965{
966 Window primary_owner, clipboard_owner;
967
968 DEBUG_CLIPBOARD(("Request from server for format %d\n", format));
969 This->xclip.rdp_clipboard_request_format = format;
970
971 if (This->xclip.probing_selections)
972 {
973 DEBUG_CLIPBOARD(("ui_clip_request_data: Selection probe in progress. Cannot handle request.\n"));
975 return;
976 }
977
979
980 if (This->xclip.rdesktop_is_selection_owner)
981 {
982 XChangeProperty(This->display, This->wnd, This->xclip.rdesktop_clipboard_target_atom,
983 XA_INTEGER, 32, PropModeReplace, (unsigned char *) &format, 1);
984
985 XConvertSelection(This->display, This->xclip.primary_atom, This->xclip.rdesktop_native_atom,
986 This->xclip.rdesktop_clipboard_target_atom, This->wnd, CurrentTime);
987 return;
988 }
989
990 if (This->xclip.auto_mode)
991 primary_owner = XGetSelectionOwner(This->display, This->xclip.primary_atom);
992 else
993 primary_owner = None;
994
995 clipboard_owner = XGetSelectionOwner(This->display, This->xclip.clipboard_atom);
996
997 /* Both available */
998 if ((primary_owner != None) && (clipboard_owner != None))
999 {
1000 This->xclip.primary_timestamp = 0;
1001 This->xclip.clipboard_timestamp = 0;
1002 XConvertSelection(This->display, This->xclip.primary_atom, This->xclip.timestamp_atom,
1003 This->xclip.rdesktop_primary_timestamp_target_atom, This->wnd, CurrentTime);
1004 XConvertSelection(This->display, This->xclip.clipboard_atom, This->xclip.timestamp_atom,
1005 This->xclip.rdesktop_clipboard_timestamp_target_atom, This->wnd, CurrentTime);
1006 return;
1007 }
1008
1009 /* Just PRIMARY */
1010 if (primary_owner != None)
1011 {
1012 XConvertSelection(This->display, This->xclip.primary_atom, This->xclip.targets_atom,
1013 This->xclip.rdesktop_clipboard_target_atom, This->wnd, CurrentTime);
1014 return;
1015 }
1016
1017 /* Just CLIPBOARD */
1018 if (clipboard_owner != None)
1019 {
1020 XConvertSelection(This->display, This->xclip.clipboard_atom, This->xclip.targets_atom,
1021 This->xclip.rdesktop_clipboard_target_atom, This->wnd, CurrentTime);
1022 return;
1023 }
1024
1025 /* No data available */
1027}
@ None
Definition: install.h:14
Definition: window.c:28
static void xclip_clear_target_props(RDPCLIENT *This)
Definition: xclip.c:327
static void helper_cliprdr_send_empty_response(RDPCLIENT *This)
Definition: xclip.c:197

◆ ui_clip_request_failed()

void ui_clip_request_failed ( RDPCLIENT This)

Definition at line 957 of file xclip.c.

958{
959 xclip_refuse_selection(This, &This->xclip.selection_request);
960 This->xclip.has_selection_request = False;
961}

◆ ui_clip_set_mode()

void ui_clip_set_mode ( RDPCLIENT This,
const char optarg 
)

Definition at line 1036 of file xclip.c.

1037{
1038 This->rdpclip = True;
1039
1040 if (str_startswith(optarg, "PRIMARYCLIPBOARD"))
1041 This->xclip.auto_mode = True;
1042 else if (str_startswith(optarg, "CLIPBOARD"))
1043 This->xclip.auto_mode = False;
1044 else
1045 {
1046 warning("Invalid clipboard mode '%s'.\n", optarg);
1047 This->rdpclip = False;
1048 }
1049}
RD_BOOL str_startswith(const char *s, const char *prefix)
Definition: rdesktop.c:1235

◆ ui_clip_sync()

void ui_clip_sync ( RDPCLIENT This)

Definition at line 1030 of file xclip.c.

1031{
1033}
static void xclip_probe_selections(RDPCLIENT *This)
Definition: xclip.c:342

◆ ui_create_bitmap()

HBITMAP ui_create_bitmap ( RDPCLIENT This,
int  width,
int  height,
uint8 data 
)

Definition at line 5762 of file activex.cpp.

5763{
5764 return win32_create_dib(width, height, This->server_depth, data);
5765}
HBITMAP win32_create_dib(LONG width, LONG height, WORD bitcount, const BYTE *data)
Definition: activex.cpp:192

◆ ui_create_colourmap()

HCOLOURMAP ui_create_colourmap ( RDPCLIENT This,
COLOURMAP colours 
)

Definition at line 5773 of file activex.cpp.

5774{
5775 return NULL;
5776}

◆ ui_create_cursor()

HCURSOR ui_create_cursor ( RDPCLIENT This,
unsigned int  x,
unsigned int  y,
int  width,
int  height,
uint8 andmask,
uint8 xormask 
)

Definition at line 5784 of file activex.cpp.

5785{
5786 uint8 * andbuf = NULL;
5787 uint8 * xorbuf = NULL;
5788
5789 uint8 * andbits = win32_convert_scanlines(width, - height, 1, 2, 4, andmask, &andbuf);
5790 uint8 * xorbits = win32_convert_scanlines(width, height, 24, 2, 4, xormask, &xorbuf);
5791
5792 HBITMAP hbmMask = CreateBitmap(width, height, 1, 1, andbits);
5793 HBITMAP hbmColor = win32_create_dib(width, height, 24, xorbits);
5794
5795 ICONINFO iconinfo;
5796 iconinfo.fIcon = FALSE;
5797 iconinfo.xHotspot = x;
5798 iconinfo.yHotspot = y;
5799 iconinfo.hbmMask = hbmMask;
5800 iconinfo.hbmColor = hbmColor;
5801
5802 HICON icon = CreateIconIndirect(&iconinfo);
5803
5804 if(icon == NULL)
5805 error("CreateIconIndirect %dx%d failed\n", width, height);
5806
5807 if(andbuf)
5808 delete[] andbuf;
5809
5810 if(xorbuf)
5811 delete[] xorbuf;
5812
5813 DeleteObject(hbmMask);
5814 DeleteObject(hbmColor);
5815
5816 return icon;
5817}
pKey DeleteObject()
static HICON
Definition: imagelist.c:84
uint8 * win32_convert_scanlines(int width, int height, int bitcount, int fromalign, int toalign, const uint8 *data, uint8 **buffer)
Definition: activex.cpp:141
DWORD yHotspot
Definition: winuser.h:3125
BOOL fIcon
Definition: winuser.h:3123
DWORD xHotspot
Definition: winuser.h:3124
HBITMAP hbmColor
Definition: winuser.h:3127
HBITMAP hbmMask
Definition: winuser.h:3126
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2612

Referenced by ui_create_window().

◆ ui_create_glyph()

HGLYPH ui_create_glyph ( RDPCLIENT This,
int  width,
int  height,
const uint8 data 
)

Definition at line 5825 of file activex.cpp.

5826{
5827 uint8 * databuf = NULL;
5828 uint8 * databits = win32_convert_scanlines(width, height, 1, 1, 2, data, &databuf);
5829
5830 HBITMAP hbm = CreateBitmap(width, height, 1, 1, databits);
5831
5832 if(databuf)
5833 delete[] databuf;
5834
5835 const uint8 * p = data;
5836 int stride = alignup(alignup(width, 8) / 8, 1);
5837
5838#ifdef _DEBUG
5839 printf("glyph %p\n", hbm);
5840
5841 for(int i = 0; i < height; ++ i, p += stride)
5842 {
5843 for(int j = 0; j < width; ++ j)
5844 {
5845 int B = p[j / 8];
5846 int b = 8 - j % 8 - 1;
5847
5848 if(B & (1 << b))
5849 fputs("##", stdout);
5850 else
5851 fputs("..", stdout);
5852 }
5853
5854 fputc('\n', stdout);
5855 }
5856
5857 fputc('\n', stdout);
5858#endif
5859
5860 return hbm;
5861}
Definition: ehthrow.cxx:54
GLsizei stride
Definition: glext.h:5848
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define stdout
Definition: stdio.h:99
_Check_return_opt_ _CRTIMP int __cdecl fputs(_In_z_ const char *_Str, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fputc(_In_ int _Ch, _Inout_ FILE *_File)
T alignup(const T &X, const U &align)
Definition: activex.cpp:135
_In_ HBITMAP hbm
Definition: ntgdi.h:2776

Referenced by ui_create_cursor(), ui_ellipse(), ui_patblt(), and ui_polygon().

◆ ui_create_window()

BOOL ui_create_window ( RDPCLIENT This)

Definition at line 1565 of file xwin.c.

1566{
1567 uint8 null_pointer_mask[1] = { 0x80 };
1568 uint8 null_pointer_data[24] = { 0x00 };
1569
1570 XSetWindowAttributes attribs;
1571 XClassHint *classhints;
1572 XSizeHints *sizehints;
1573 int wndwidth, wndheight;
1574 long input_mask, ic_input_mask;
1575 XEvent xevent;
1576
1577 wndwidth = This->fullscreen ? WidthOfScreen(This->xwin.screen) : This->width;
1578 wndheight = This->fullscreen ? HeightOfScreen(This->xwin.screen) : This->height;
1579
1580 /* Handle -x-y portion of geometry string */
1581 if (This->xpos < 0 || (This->xpos == 0 && (This->pos & 2)))
1582 This->xpos = WidthOfScreen(This->xwin.screen) + This->xpos - This->width;
1583 if (This->ypos < 0 || (This->ypos == 0 && (This->pos & 4)))
1584 This->ypos = HeightOfScreen(This->xwin.screen) + This->ypos - This->height;
1585
1587
1588 This->wnd = XCreateWindow(This->display, RootWindowOfScreen(This->xwin.screen), This->xpos, This->ypos, wndwidth,
1589 wndheight, 0, This->xwin.depth, InputOutput, This->xwin.visual,
1590 CWBackPixel | CWBackingStore | CWOverrideRedirect | CWColormap |
1591 CWBorderPixel, &attribs);
1592
1593 if (This->xwin.gc == NULL)
1594 {
1595 This->xwin.gc = XCreateGC(This->display, This->wnd, 0, NULL);
1597 }
1598
1599 if (This->xwin.create_bitmap_gc == NULL)
1600 This->xwin.create_bitmap_gc = XCreateGC(This->display, This->wnd, 0, NULL);
1601
1602 if ((This->ownbackstore) && (This->xwin.backstore == 0))
1603 {
1604 This->xwin.backstore = XCreatePixmap(This->display, This->wnd, This->width, This->height, This->xwin.depth);
1605
1606 /* clear to prevent rubbish being exposed at startup */
1607 XSetForeground(This->display, This->xwin.gc, BlackPixelOfScreen(This->xwin.screen));
1608 XFillRectangle(This->display, This->xwin.backstore, This->xwin.gc, 0, 0, This->width, This->height);
1609 }
1610
1611 XStoreName(This->display, This->wnd, This->title);
1612
1613 if (This->hide_decorations)
1615
1616 classhints = XAllocClassHint();
1617 if (classhints != NULL)
1618 {
1619 classhints->res_name = classhints->res_class = "rdesktop";
1620 XSetClassHint(This->display, This->wnd, classhints);
1621 XFree(classhints);
1622 }
1623
1624 sizehints = XAllocSizeHints();
1625 if (sizehints)
1626 {
1627 sizehints->flags = PMinSize | PMaxSize;
1628 if (This->pos)
1629 sizehints->flags |= PPosition;
1630 sizehints->min_width = sizehints->max_width = This->width;
1631 sizehints->min_height = sizehints->max_height = This->height;
1632 XSetWMNormalHints(This->display, This->wnd, sizehints);
1633 XFree(sizehints);
1634 }
1635
1636 if (This->embed_wnd)
1637 {
1638 XReparentWindow(This->display, This->wnd, (Window) This->embed_wnd, 0, 0);
1639 }
1640
1641 get_input_mask(This, &input_mask);
1642
1643 if (This->xwin.IM != NULL)
1644 {
1645 This->xwin.IC = XCreateIC(This->xwin.IM, XNInputStyle, (XIMPreeditNothing | XIMStatusNothing),
1646 XNClientWindow, This->wnd, XNFocusWindow, This->wnd, NULL);
1647
1648 if ((This->xwin.IC != NULL)
1649 && (XGetICValues(This->xwin.IC, XNFilterEvents, &ic_input_mask, NULL) == NULL))
1650 input_mask |= ic_input_mask;
1651 }
1652
1653 XSelectInput(This->display, This->wnd, input_mask);
1654 XMapWindow(This->display, This->wnd);
1655
1656 /* wait for VisibilityNotify */
1657 do
1658 {
1659 XMaskEvent(This->display, VisibilityChangeMask, &xevent);
1660 }
1661 while (xevent.type != VisibilityNotify);
1662 This->Unobscured = xevent.xvisibility.state == VisibilityUnobscured;
1663
1664 This->xwin.focused = False;
1665 This->xwin.mouse_in_wnd = False;
1666
1667 /* handle the WM_DELETE_WINDOW protocol */
1668 This->xwin.protocol_atom = XInternAtom(This->display, "WM_PROTOCOLS", True);
1669 This->xwin.kill_atom = XInternAtom(This->display, "WM_DELETE_WINDOW", True);
1670 XSetWMProtocols(This->display, This->wnd, &This->xwin.kill_atom, 1);
1671
1672 /* create invisible 1x1 cursor to be used as null cursor */
1673 if (This->xwin.null_cursor == NULL)
1674 This->xwin.null_cursor = ui_create_cursor(This, 0, 0, 1, 1, null_pointer_mask, null_pointer_data);
1675
1676 return True;
1677}
const GLint * attribs
Definition: glext.h:10538
static void get_window_attribs(RDPCLIENT *This, XSetWindowAttributes *attribs)
Definition: xwin.c:1538
HCURSOR ui_create_cursor(RDPCLIENT *This, unsigned int x, unsigned int y, int width, int height, uint8 *andmask, uint8 *xormask)
Definition: xwin.c:2306
static void get_input_mask(RDPCLIENT *This, long *input_mask)
Definition: xwin.c:1549
static void mwm_hide_decorations(RDPCLIENT *This, Window wnd)
Definition: xwin.c:381

◆ ui_deinit()

void ui_deinit ( RDPCLIENT This)

Definition at line 1510 of file xwin.c.

1511{
1512 while (This->xwin.seamless_windows)
1513 {
1514 XDestroyWindow(This->display, This->xwin.seamless_windows->wnd);
1515 sw_remove_window(This, This->xwin.seamless_windows);
1516 }
1517
1519
1520 if (This->xwin.IM != NULL)
1521 XCloseIM(This->xwin.IM);
1522
1523 if (This->xwin.null_cursor != NULL)
1524 ui_destroy_cursor(This, This->xwin.null_cursor);
1525
1526 XFreeModifiermap(This->xwin.mod_map);
1527
1528 if (This->ownbackstore)
1529 XFreePixmap(This->display, This->xwin.backstore);
1530
1531 XFreeGC(This->display, This->xwin.gc);
1532 XCloseDisplay(This->display);
1533 This->display = NULL;
1534}
void xclip_deinit(void)
static void sw_remove_window(RDPCLIENT *This, seamless_window *win)
Definition: xwin.c:185
void ui_destroy_cursor(RDPCLIENT *This, HCURSOR cursor)
Definition: xwin.c:2385

◆ ui_desktop_restore()

void ui_desktop_restore ( RDPCLIENT This,
uint32  offset,
int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 5755 of file activex.cpp.

5756{
5757 RdpClient::InnerToOuter(This)->GetUI()->Display_RestoreDesktop(offset, x, y, cx, cy);
5758}

◆ ui_desktop_save()

void ui_desktop_save ( RDPCLIENT This,
uint32  offset,
int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 5750 of file activex.cpp.

5751{
5752 RdpClient::InnerToOuter(This)->GetUI()->Display_SaveDesktop(offset, x, y, cx, cy);
5753}

◆ ui_destblt()

void ui_destblt ( RDPCLIENT This,
uint8  opcode,
int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 5643 of file activex.cpp.

5644{
5645 RdpClient::InnerToOuter(This)->GetUI()->Display_DestBlt(opcode, x, y, cx, cy);
5646}

◆ ui_destroy_bitmap()

void ui_destroy_bitmap ( RDPCLIENT This,
HBITMAP  bmp 
)

Definition at line 5767 of file activex.cpp.

5768{
5770}
BITMAP bmp
Definition: alphablend.c:62

◆ ui_destroy_colourmap()

void ui_destroy_colourmap ( RDPCLIENT This,
HCOLOURMAP  map 
)

Definition at line 2504 of file xwin.c.

2505{
2506 if (!This->owncolmap)
2507 xfree(map);
2508 else
2509 XFreeColormap(This->display, (Colormap) map);
2510}

◆ ui_destroy_cursor()

void ui_destroy_cursor ( RDPCLIENT This,
HCURSOR  cursor 
)

Definition at line 5819 of file activex.cpp.

5820{
5822}
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2084

Referenced by ui_deinit().

◆ ui_destroy_glyph()

void ui_destroy_glyph ( RDPCLIENT This,
HGLYPH  glyph 
)

Definition at line 5863 of file activex.cpp.

5864{
5865 DeleteObject(glyph);
5866}

Referenced by ui_create_cursor(), ui_ellipse(), ui_patblt(), and ui_polygon().

◆ ui_destroy_window()

void ui_destroy_window ( RDPCLIENT This)

Definition at line 1713 of file xwin.c.

1714{
1715 if (This->xwin.IC != NULL)
1716 XDestroyIC(This->xwin.IC);
1717
1718 XDestroyWindow(This->display, This->wnd);
1719}

◆ ui_draw_glyph()

void ui_draw_glyph ( RDPCLIENT This,
int  mixmode,
int  x,
int  y,
int  cx,
int  cy,
HGLYPH  glyph,
int  srcx,
int  srcy,
int  bgcolour,
int  fgcolour 
)

Definition at line 2880 of file xwin.c.

2884{
2885 SET_FOREGROUND(fgcolour);
2886 SET_BACKGROUND(bgcolour);
2887
2888 XSetFillStyle(This->display, This->xwin.gc,
2889 (mixmode == MIX_TRANSPARENT) ? FillStippled : FillOpaqueStippled);
2890 XSetStipple(This->display, This->xwin.gc, (Pixmap) glyph);
2891 XSetTSOrigin(This->display, This->xwin.gc, x, y);
2892
2894
2895 XSetFillStyle(This->display, This->xwin.gc, FillSolid);
2896}
#define MIX_TRANSPARENT
Definition: constants.h:272
BOOL APIENTRY FillSolid(SURFOBJ *pso, PRECTL pRect, ULONG iColor)
Definition: paint.c:35
#define SET_BACKGROUND(col)
Definition: xwin.c:134
#define FILL_RECTANGLE_BACKSTORE(x, y, cx, cy)
Definition: xwin.c:99
#define SET_FOREGROUND(col)
Definition: xwin.c:133

◆ ui_draw_text()

void ui_draw_text ( RDPCLIENT This,
uint8  font,
uint8  flags,
uint8  opcode,
int  mixmode,
int  x,
int  y,
int  clipx,
int  clipy,
int  clipcx,
int  clipcy,
int  boxx,
int  boxy,
int  boxcx,
int  boxcy,
BRUSH brush,
int  bgcolour,
int  fgcolour,
uint8 text,
uint8  length 
)

Definition at line 5701 of file activex.cpp.

5724{
5725 RdpClient::InnerToOuter(This)->GetUI()->Display_DrawText
5726 (
5727 font,
5728 flags,
5729 opcode,
5730 mixmode,
5731 x,
5732 y,
5733 clipx,
5734 clipy,
5735 clipcx,
5736 clipcy,
5737 boxx,
5738 boxy,
5739 boxcx,
5740 boxcy,
5741 brush,
5742 bgcolour,
5743 fgcolour,
5744 text,
5745 length
5746 );
5747}

◆ ui_ellipse()

void ui_ellipse ( RDPCLIENT This,
uint8  opcode,
uint8  fillmode,
int  x,
int  y,
int  cx,
int  cy,
BRUSH brush,
int  bgcolour,
int  fgcolour 
)

Definition at line 5674 of file activex.cpp.

5675{
5676 // TODO
5677// RdpClient::InnerToOuter(This)->GetUI()->Display_Ellipse(opcode, fillmode, x, y, cx, cy, brush, bgcolour, fgcolour);
5678}

◆ ui_end_update()

void ui_end_update ( RDPCLIENT This)

Definition at line 5627 of file activex.cpp.

5628{
5629 RdpClient::InnerToOuter(This)->GetUI()->Display_EndUpdate();
5630}

◆ ui_init()

BOOL ui_init ( RDPCLIENT This)

Definition at line 1399 of file xwin.c.

1400{
1401 int screen_num;
1402
1403 This->display = XOpenDisplay(NULL);
1404 if (This->display == NULL)
1405 {
1406 error("Failed to open display: %s\n", XDisplayName(NULL));
1407 return False;
1408 }
1409
1410 {
1411 uint16 endianess_test = 1;
1412 This->xwin.host_be = !(BOOL) (*(uint8 *) (&endianess_test));
1413 }
1414
1415 /*This->xwin.old_error_handler = XSetErrorHandler(error_handler);*/
1416 This->xwin.xserver_be = (ImageByteOrder(This->display) == MSBFirst);
1417 screen_num = DefaultScreen(This->display);
1418 This->xwin.x_socket = ConnectionNumber(This->display);
1419 This->xwin.screen = ScreenOfDisplay(This->display, screen_num);
1420 This->xwin.depth = DefaultDepthOfScreen(This->xwin.screen);
1421
1422 if (!select_visual(This))
1423 return False;
1424
1425 if (This->xwin.no_translate_image)
1426 {
1427 DEBUG(("Performance optimization possible: avoiding image translation (colour depth conversion).\n"));
1428 }
1429
1430 if (This->server_depth > This->xwin.bpp)
1431 {
1432 warning("Remote desktop colour depth %d higher than display colour depth %d.\n",
1433 This->server_depth, This->xwin.bpp);
1434 }
1435
1436 DEBUG(("RDP depth: %d, display depth: %d, display bpp: %d, X server BE: %d, host BE: %d\n",
1437 This->server_depth, This->xwin.depth, This->xwin.bpp, This->xwin.xserver_be, This->xwin.host_be));
1438
1439 if (!This->owncolmap)
1440 {
1441 This->xwin.xcolmap =
1442 XCreateColormap(This->display, RootWindowOfScreen(This->xwin.screen), This->xwin.visual,
1443 AllocNone);
1444 if (This->xwin.depth <= 8)
1445 warning("Display colour depth is %d bit: you may want to use -C for a private colourmap.\n", This->xwin.depth);
1446 }
1447
1448 if ((!This->ownbackstore) && (DoesBackingStore(This->xwin.screen) != Always))
1449 {
1450 warning("External BackingStore not available. Using internal.\n");
1451 This->ownbackstore = True;
1452 }
1453
1454 /*
1455 * Determine desktop size
1456 */
1457 if (This->fullscreen)
1458 {
1459 This->width = WidthOfScreen(This->xwin.screen);
1460 This->height = HeightOfScreen(This->xwin.screen);
1461 This->xwin.using_full_workarea = True;
1462 }
1463 else if (This->width < 0)
1464 {
1465 /* Percent of screen */
1466 if (-This->width >= 100)
1467 This->xwin.using_full_workarea = True;
1468 This->height = HeightOfScreen(This->xwin.screen) * (-This->width) / 100;
1469 This->width = WidthOfScreen(This->xwin.screen) * (-This->width) / 100;
1470 }
1471 else if (This->width == 0)
1472 {
1473 /* Fetch geometry from _NET_WORKAREA */
1474 uint32 x, y, cx, cy;
1475 if (get_current_workarea(This, &x, &y, &cx, &cy) == 0)
1476 {
1477 This->width = cx;
1478 This->height = cy;
1479 This->xwin.using_full_workarea = True;
1480 }
1481 else
1482 {
1483 warning("Failed to get workarea: probably your window manager does not support extended hints\n");
1484 This->width = WidthOfScreen(This->xwin.screen);
1485 This->height = HeightOfScreen(This->xwin.screen);
1486 }
1487 }
1488
1489 /* make sure width is a multiple of 4 */
1490 This->width = (This->width + 3) & ~3;
1491
1492 This->xwin.mod_map = XGetModifierMapping(This->display);
1493
1495
1496 if (This->enable_compose)
1497 This->xwin.IM = XOpenIM(This->display, NULL, NULL, NULL);
1498
1500 ewmh_init(This);
1501 if (This->seamless_rdp)
1503
1504 DEBUG_RDP5(("server bpp %d client bpp %d depth %d\n", This->server_depth, This->xwin.bpp, This->xwin.depth));
1505
1506 return True;
1507}
int get_current_workarea(uint32 *x, uint32 *y, uint32 *width, uint32 *height)
void xclip_init(void)
RD_BOOL seamless_init(void)
void xkeymap_init(void)
void ewmh_init(void)
#define BOOL
Definition: nt_native.h:43
#define MSBFirst
Definition: pcf.h:178
static BOOL select_visual(RDPCLIENT *This)
Definition: xwin.c:1191

◆ ui_line()

void ui_line ( RDPCLIENT This,
uint8  opcode,
int  startx,
int  starty,
int  endx,
int  endy,
PEN pen 
)

Definition at line 5680 of file activex.cpp.

5681{
5682 RdpClient::InnerToOuter(This)->GetUI()->Display_Line(opcode, startx, starty, endx, endy, pen);
5683}

◆ ui_memblt()

void ui_memblt ( RDPCLIENT This,
uint8  opcode,
int  x,
int  y,
int  cx,
int  cy,
HBITMAP  src,
int  srcx,
int  srcy 
)

Definition at line 5648 of file activex.cpp.

5649{
5650 RdpClient::InnerToOuter(This)->GetUI()->Display_MemBlt(opcode, x, y, cx, cy, src, srcx, srcy);
5651}

Referenced by ui_triblt().

◆ ui_move_pointer()

void ui_move_pointer ( RDPCLIENT This,
int  x,
int  y 
)

Definition at line 5869 of file activex.cpp.

5870{
5871 // TODO
5872}

◆ ui_paint_bitmap()

void ui_paint_bitmap ( RDPCLIENT This,
int  x,
int  y,
int  cx,
int  cy,
int  width,
int  height,
uint8 data 
)

Definition at line 5668 of file activex.cpp.

5669{
5670 RdpClient::InnerToOuter(This)->GetUI()->Display_PaintBitmap(x, y, cx, cy, width, height, data);
5671}

◆ ui_patblt()

void ui_patblt ( RDPCLIENT This,
uint8  opcode,
int  x,
int  y,
int  cx,
int  cy,
BRUSH brush,
int  bgcolour,
int  fgcolour 
)

Definition at line 5653 of file activex.cpp.

5654{
5655 RdpClient::InnerToOuter(This)->GetUI()->Display_PatBlt(opcode, x, y, cx, cy, brush, bgcolour, fgcolour);
5656}

Referenced by ui_triblt().

◆ ui_polygon()

void ui_polygon ( RDPCLIENT This,
uint8  opcode,
uint8  fillmode,
POINT point,
int  npoints,
BRUSH brush,
int  bgcolour,
int  fgcolour 
)

Definition at line 5685 of file activex.cpp.

5686{
5687 RdpClient::InnerToOuter(This)->GetUI()->Display_Polygon(opcode, fillmode, point, npoints, brush, bgcolour, fgcolour);
5688}
POINTL point
Definition: edittest.c:50

◆ ui_polyline()

void ui_polyline ( RDPCLIENT This,
uint8  opcode,
POINT points,
int  npoints,
PEN pen 
)

Definition at line 5690 of file activex.cpp.

5691{
5692 RdpClient::InnerToOuter(This)->GetUI()->Display_Polyline(opcode, points, npoints, pen);
5693}
GLsizei const GLfloat * points
Definition: glext.h:8112

◆ ui_rect()

void ui_rect ( RDPCLIENT This,
int  x,
int  y,
int  cx,
int  cy,
int  colour 
)

Definition at line 5695 of file activex.cpp.

5696{
5697 RdpClient::InnerToOuter(This)->GetUI()->Display_Rect(x, y, cx, cy, colour);
5698}

◆ ui_reset_clip()

void ui_reset_clip ( RDPCLIENT This)

Definition at line 5637 of file activex.cpp.

5638{
5639 RdpClient::InnerToOuter(This)->GetUI()->Display_ResetClip();
5640}

◆ ui_resize_window()

void ui_resize_window ( RDPCLIENT This)

Definition at line 5885 of file activex.cpp.

5886{
5887}

◆ ui_screenblt()

void ui_screenblt ( RDPCLIENT This,
uint8  opcode,
int  x,
int  y,
int  cx,
int  cy,
int  srcx,
int  srcy 
)

Definition at line 5658 of file activex.cpp.

5659{
5660 RdpClient::InnerToOuter(This)->GetUI()->Display_ScreenBlt(opcode, x, y, cx, cy, srcx, srcy);
5661}

◆ ui_seamless_ack()

void ui_seamless_ack ( RDPCLIENT This,
unsigned int  serial 
)

Definition at line 3545 of file xwin.c.

3546{
3547 seamless_window *sw;
3548 for (sw = This->xwin.seamless_windows; sw; sw = sw->next)
3549 {
3550 if (sw->outstanding_position && (sw->outpos_serial == serial))
3551 {
3552 sw->xoffset = sw->outpos_xoffset;
3553 sw->yoffset = sw->outpos_yoffset;
3554 sw->width = sw->outpos_width;
3555 sw->height = sw->outpos_height;
3556 sw->outstanding_position = False;
3557
3558 /* Do a complete redraw of the window as part of the
3559 completion of the move. This is to remove any
3560 artifacts caused by our lack of synchronization. */
3561 XCopyArea(This->display, This->xwin.backstore,
3562 sw->wnd, This->xwin.gc,
3563 sw->xoffset, sw->yoffset, sw->width, sw->height, 0, 0);
3564
3565 break;
3566 }
3567 }
3568}
uint32_t serial
Definition: fsck.fat.h:29

◆ ui_seamless_begin()

void ui_seamless_begin ( RDPCLIENT This,
BOOL  hidden 
)

Definition at line 3128 of file xwin.c.

3129{
3130 if (!This->seamless_rdp)
3131 return;
3132
3133 if (This->xwin.seamless_started)
3134 return;
3135
3136 This->xwin.seamless_started = True;
3137 This->xwin.seamless_hidden = hidden;
3138
3139 if (!hidden)
3141}
void ui_seamless_toggle(void)
__u32 hidden
Definition: mkdosfs.c:13

◆ ui_seamless_create_window()

void ui_seamless_create_window ( RDPCLIENT This,
unsigned long  id,
unsigned long  group,
unsigned long  parent,
unsigned long  flags 
)

Definition at line 3209 of file xwin.c.

3211{
3212 Window wnd;
3213 XSetWindowAttributes attribs;
3214 XClassHint *classhints;
3215 XSizeHints *sizehints;
3216 XWMHints *wmhints;
3217 long input_mask;
3218 seamless_window *sw, *sw_parent;
3219
3220 if (!This->xwin.seamless_active)
3221 return;
3222
3223 /* Ignore CREATEs for existing windows */
3224 sw = sw_get_window_by_id(This, id);
3225 if (sw)
3226 return;
3227
3229 wnd = XCreateWindow(This->display, RootWindowOfScreen(This->xwin.screen), -1, -1, 1, 1, 0, This->xwin.depth,
3230 InputOutput, This->xwin.visual,
3231 CWBackPixel | CWBackingStore | CWColormap | CWBorderPixel, &attribs);
3232
3233 XStoreName(This->display, wnd, "SeamlessRDP");
3234 ewmh_set_wm_name(This, wnd, "SeamlessRDP");
3235
3237
3238 classhints = XAllocClassHint();
3239 if (classhints != NULL)
3240 {
3241 classhints->res_name = "rdesktop";
3242 classhints->res_class = "SeamlessRDP";
3243 XSetClassHint(This->display, wnd, classhints);
3244 XFree(classhints);
3245 }
3246
3247 /* WM_NORMAL_HINTS */
3248 sizehints = XAllocSizeHints();
3249 if (sizehints != NULL)
3250 {
3251 sizehints->flags = USPosition;
3252 XSetWMNormalHints(This->display, wnd, sizehints);
3253 XFree(sizehints);
3254 }
3255
3256 /* Parent-less transient windows */
3257 if (parent == 0xFFFFFFFF)
3258 {
3259 XSetTransientForHint(This->display, wnd, RootWindowOfScreen(This->xwin.screen));
3260 /* Some buggy wm:s (kwin) do not handle the above, so fake it
3261 using some other hints. */
3263 }
3264 /* Normal transient windows */
3265 else if (parent != 0x00000000)
3266 {
3267 sw_parent = sw_get_window_by_id(This, parent);
3268 if (sw_parent)
3269 XSetTransientForHint(This->display, wnd, sw_parent->wnd);
3270 else
3271 warning("ui_seamless_create_window: No parent window 0x%lx\n", parent);
3272 }
3273
3275 {
3276 /* We do this to support buggy wm:s (*cough* metacity *cough*)
3277 somewhat at least */
3278 if (parent == 0x00000000)
3279 XSetTransientForHint(This->display, wnd, RootWindowOfScreen(This->xwin.screen));
3281 }
3282
3283 /* FIXME: Support for Input Context:s */
3284
3285 get_input_mask(This, &input_mask);
3286 input_mask |= PropertyChangeMask;
3287
3288 XSelectInput(This->display, wnd, input_mask);
3289
3290 /* handle the WM_DELETE_WINDOW protocol. FIXME: When killing a
3291 seamless window, we could try to close the window on the
3292 serverside, instead of terminating rdesktop */
3293 XSetWMProtocols(This->display, wnd, &This->xwin.kill_atom, 1);
3294
3295 sw = xmalloc(sizeof(seamless_window));
3296 sw->wnd = wnd;
3297 sw->id = id;
3298 sw->behind = 0;
3299 sw->group = sw_find_group(This, group, False);
3300 sw->group->refcnt++;
3301 sw->xoffset = 0;
3302 sw->yoffset = 0;
3303 sw->width = 0;
3304 sw->height = 0;
3305 sw->state = SEAMLESSRDP_NOTYETMAPPED;
3306 sw->desktop = 0;
3307 sw->position_timer = xmalloc(sizeof(struct timeval));
3308 timerclear(sw->position_timer);
3309
3310 sw->outstanding_position = False;
3311 sw->outpos_serial = 0;
3312 sw->outpos_xoffset = sw->outpos_yoffset = 0;
3313 sw->outpos_width = sw->outpos_height = 0;
3314
3315 sw->next = This->xwin.seamless_windows;
3316 This->xwin.seamless_windows = sw;
3317
3318 /* WM_HINTS */
3319 wmhints = XAllocWMHints();
3320 if (wmhints)
3321 {
3322 wmhints->flags = WindowGroupHint;
3323 wmhints->window_group = sw->group->wnd;
3324 XSetWMHints(This->display, sw->wnd, wmhints);
3325 XFree(wmhints);
3326 }
3327}
#define SEAMLESSRDP_CREATE_MODAL
Definition: constants.h:572
#define SEAMLESSRDP_NOTYETMAPPED
Definition: constants.h:566
#define timerclear(tvp)
Definition: rdesktop.h:190
r parent
Definition: btrfs.c:3010
void ewmh_set_wm_name(RDPCLIENT *This, Window wnd, const char *title)
Definition: ewmhints.c:391
int ewmh_set_window_modal(RDPCLIENT *This, Window wnd)
Definition: ewmhints.c:411
int ewmh_set_window_popup(RDPCLIENT *This, Window wnd)
Definition: ewmhints.c:402
GLboolean GLuint group
Definition: glext.h:11120
struct define * next
Definition: compiler.c:65
static seamless_group * sw_find_group(RDPCLIENT *This, unsigned long id, BOOL dont_create)
Definition: xwin.c:352
static seamless_window * sw_get_window_by_id(RDPCLIENT *This, unsigned long id)
Definition: xwin.c:159

◆ ui_seamless_destroy_group()

void ui_seamless_destroy_group ( RDPCLIENT This,
unsigned long  id,
unsigned long  flags 
)

Definition at line 3351 of file xwin.c.

3352{
3353 seamless_window *sw, *sw_next;
3354
3355 if (!This->xwin.seamless_active)
3356 return;
3357
3358 for (sw = This->xwin.seamless_windows; sw; sw = sw_next)
3359 {
3360 sw_next = sw->next;
3361
3362 if (sw->group->id == id)
3363 {
3364 XDestroyWindow(This->display, sw->wnd);
3366 }
3367 }
3368}

◆ ui_seamless_destroy_window()

void ui_seamless_destroy_window ( RDPCLIENT This,
unsigned long  id,
unsigned long  flags 
)

Definition at line 3331 of file xwin.c.

3332{
3333 seamless_window *sw;
3334
3335 if (!This->xwin.seamless_active)
3336 return;
3337
3338 sw = sw_get_window_by_id(This, id);
3339 if (!sw)
3340 {
3341 warning("ui_seamless_destroy_window: No information for window 0x%lx\n", id);
3342 return;
3343 }
3344
3345 XDestroyWindow(This->display, sw->wnd);
3347}

◆ ui_seamless_hide_desktop()

void ui_seamless_hide_desktop ( RDPCLIENT This)

Definition at line 3145 of file xwin.c.

3146{
3147 if (!This->seamless_rdp)
3148 return;
3149
3150 if (!This->xwin.seamless_started)
3151 return;
3152
3153 if (This->xwin.seamless_active)
3155
3156 This->xwin.seamless_hidden = True;
3157}

◆ ui_seamless_move_window()

void ui_seamless_move_window ( RDPCLIENT This,
unsigned long  id,
int  x,
int  y,
int  width,
int  height,
unsigned long  flags 
)

Definition at line 3372 of file xwin.c.

3373{
3374 seamless_window *sw;
3375
3376 if (!This->xwin.seamless_active)
3377 return;
3378
3379 sw = sw_get_window_by_id(This, id);
3380 if (!sw)
3381 {
3382 warning("ui_seamless_move_window: No information for window 0x%lx\n", id);
3383 return;
3384 }
3385
3386 /* We ignore server updates until it has handled our request. */
3387 if (sw->outstanding_position)
3388 return;
3389
3390 if (!width || !height)
3391 /* X11 windows must be at least 1x1 */
3392 return;
3393
3394 sw->xoffset = x;
3395 sw->yoffset = y;
3396 sw->width = width;
3397 sw->height = height;
3398
3399 /* If we move the window in a maximized state, then KDE won't
3400 accept restoration */
3401 switch (sw->state)
3402 {
3405 return;
3406 }
3407
3408 /* FIXME: Perhaps use ewmh_net_moveresize_window instead */
3409 XMoveResizeWindow(This->display, sw->wnd, sw->xoffset, sw->yoffset, sw->width, sw->height);
3410}
#define SEAMLESSRDP_MAXIMIZED
Definition: constants.h:569
#define SEAMLESSRDP_MINIMIZED
Definition: constants.h:568

◆ ui_seamless_restack_window()

void ui_seamless_restack_window ( RDPCLIENT This,
unsigned long  id,
unsigned long  behind,
unsigned long  flags 
)

Definition at line 3414 of file xwin.c.

3415{
3416 seamless_window *sw;
3417
3418 if (!This->xwin.seamless_active)
3419 return;
3420
3421 sw = sw_get_window_by_id(This, id);
3422 if (!sw)
3423 {
3424 warning("ui_seamless_restack_window: No information for window 0x%lx\n", id);
3425 return;
3426 }
3427
3428 if (behind)
3429 {
3430 seamless_window *sw_behind;
3431 Window wnds[2];
3432
3433 sw_behind = sw_get_window_by_id(This, behind);
3434 if (!sw_behind)
3435 {
3436 warning("ui_seamless_restack_window: No information for window 0x%lx\n",
3437 behind);
3438 return;
3439 }
3440
3441 wnds[1] = sw_behind->wnd;
3442 wnds[0] = sw->wnd;
3443
3444 XRestackWindows(This->display, wnds, 2);
3445 }
3446 else
3447 {
3448 XRaiseWindow(This->display, sw->wnd);
3449 }
3450
3451 sw_restack_window(This, sw, behind);
3452}
static THRDCREATEWIN wnds[3]
Definition: multithrdwin.c:20
static void sw_restack_window(RDPCLIENT *This, seamless_window *sw, unsigned long behind)
Definition: xwin.c:272

◆ ui_seamless_setstate()

void ui_seamless_setstate ( RDPCLIENT This,
unsigned long  id,
unsigned int  state,
unsigned long  flags 
)

Definition at line 3477 of file xwin.c.

3478{
3479 seamless_window *sw;
3480
3481 if (!This->xwin.seamless_active)
3482 return;
3483
3484 sw = sw_get_window_by_id(This, id);
3485 if (!sw)
3486 {
3487 warning("ui_seamless_setstate: No information for window 0x%lx\n", id);
3488 return;
3489 }
3490
3491 switch (state)
3492 {
3493 case SEAMLESSRDP_NORMAL:
3495 ewmh_change_state(This, sw->wnd, state);
3496 XMapWindow(This->display, sw->wnd);
3497 break;
3499 /* EWMH says: "if an Application asks to toggle _NET_WM_STATE_HIDDEN
3500 the Window Manager should probably just ignore the request, since
3501 _NET_WM_STATE_HIDDEN is a function of some other aspect of the window
3502 such as minimization, rather than an independent state." Besides,
3503 XIconifyWindow is easier. */
3504 if (sw->state == SEAMLESSRDP_NOTYETMAPPED)
3505 {
3506 XWMHints *hints;
3507 hints = XGetWMHints(This->display, sw->wnd);
3508 if (hints)
3509 {
3510 hints->flags |= StateHint;
3511 hints->initial_state = IconicState;
3512 XSetWMHints(This->display, sw->wnd, hints);
3513 XFree(hints);
3514 }
3515 XMapWindow(This->display, sw->wnd);
3516 }
3517 else
3518 XIconifyWindow(This->display, sw->wnd, DefaultScreen(This->display));
3519 break;
3520 default:
3521 warning("SeamlessRDP: Invalid state %d\n", state);
3522 break;
3523 }
3524
3525 sw->state = state;
3526}
#define SEAMLESSRDP_NORMAL
Definition: constants.h:567
int ewmh_change_state(RDPCLIENT *This, Window wnd, int state)
Definition: ewmhints.c:321

◆ ui_seamless_settitle()

void ui_seamless_settitle ( RDPCLIENT This,
unsigned long  id,
const char title,
unsigned long  flags 
)

Definition at line 3456 of file xwin.c.

3457{
3458 seamless_window *sw;
3459
3460 if (!This->xwin.seamless_active)
3461 return;
3462
3463 sw = sw_get_window_by_id(This, id);
3464 if (!sw)
3465 {
3466 warning("ui_seamless_settitle: No information for window 0x%lx\n", id);
3467 return;
3468 }
3469
3470 /* FIXME: Might want to convert the name for non-EWMH WMs */
3471 XStoreName(This->display, sw->wnd, title);
3472 ewmh_set_wm_name(This, sw->wnd, title);
3473}
static char title[]
Definition: ps.c:92

◆ ui_seamless_syncbegin()

void ui_seamless_syncbegin ( RDPCLIENT This,
unsigned long  flags 
)

Definition at line 3530 of file xwin.c.

3531{
3532 if (!This->xwin.seamless_active)
3533 return;
3534
3535 /* Destroy all seamless windows */
3536 while (This->xwin.seamless_windows)
3537 {
3538 XDestroyWindow(This->display, This->xwin.seamless_windows->wnd);
3539 sw_remove_window(This, This->xwin.seamless_windows);
3540 }
3541}

◆ ui_seamless_toggle()

void ui_seamless_toggle ( RDPCLIENT This)

Definition at line 3176 of file xwin.c.

3177{
3178 if (!This->seamless_rdp)
3179 return;
3180
3181 if (!This->xwin.seamless_started)
3182 return;
3183
3184 if (This->xwin.seamless_hidden)
3185 return;
3186
3187 if (This->xwin.seamless_active)
3188 {
3189 /* Deactivate */
3190 while (This->xwin.seamless_windows)
3191 {
3192 XDestroyWindow(This->display, This->xwin.seamless_windows->wnd);
3193 sw_remove_window(This, This->xwin.seamless_windows);
3194 }
3195 XMapWindow(This->display, This->wnd);
3196 }
3197 else
3198 {
3199 /* Activate */
3200 XUnmapWindow(This->display, This->wnd);
3202 }
3203
3204 This->xwin.seamless_active = !This->xwin.seamless_active;
3205}
unsigned int seamless_send_sync(void)

◆ ui_seamless_unhide_desktop()

void ui_seamless_unhide_desktop ( RDPCLIENT This)

Definition at line 3161 of file xwin.c.

3162{
3163 if (!This->seamless_rdp)
3164 return;
3165
3166 if (!This->xwin.seamless_started)
3167 return;
3168
3169 This->xwin.seamless_hidden = False;
3170
3172}

◆ ui_select()

int ui_select ( RDPCLIENT This,
SOCKET  rdp_socket 
)

Definition at line 5894 of file activex.cpp.

5895{
5896 return SleepEx(0, TRUE) == WAIT_IO_COMPLETION;
5897}
DWORD WINAPI SleepEx(IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:802

◆ ui_set_clip()

void ui_set_clip ( RDPCLIENT This,
int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 5632 of file activex.cpp.

5633{
5634 RdpClient::InnerToOuter(This)->GetUI()->Display_SetClip(x, y, cx, cy);
5635}

◆ ui_set_colourmap()

void ui_set_colourmap ( RDPCLIENT This,
HCOLOURMAP  map 
)

Definition at line 5778 of file activex.cpp.

5779{
5780 // TODO
5781}

◆ ui_set_cursor()

void ui_set_cursor ( RDPCLIENT This,
HCURSOR  cursor 
)

Definition at line 5874 of file activex.cpp.

5875{
5876 // TODO
5877}

Referenced by ui_set_null_cursor().

◆ ui_set_null_cursor()

void ui_set_null_cursor ( RDPCLIENT This)

Definition at line 5879 of file activex.cpp.

5880{
5881 // TODO
5882}

◆ ui_triblt()

void ui_triblt ( RDPCLIENT This,
uint8  opcode,
int  x,
int  y,
int  cx,
int  cy,
HBITMAP  src,
int  srcx,
int  srcy,
BRUSH brush,
int  bgcolour,
int  fgcolour 
)

Definition at line 5663 of file activex.cpp.

5664{
5665 RdpClient::InnerToOuter(This)->GetUI()->Display_TriBlt(opcode, x, y, cx, cy, src, srcx, srcy, brush, bgcolour, fgcolour);
5666}

◆ unimpl()

void unimpl ( char format,
  ... 
)

Definition at line 801 of file uimain.c.

802{
803 va_list ap;
804 char text[512];
805 char text1[512];
806
807 sprintf(text1, "UNIMPL: ");
810 va_end(ap);
811 strcat(text1, text);
812 mi_warning(text1);
813}
void mi_warning(char *msg)
Definition: win32.c:848

Referenced by ui_destblt(), ui_line(), ui_patblt(), and ui_screenblt().

◆ warning()

void warning ( char format,
  ... 
)

Definition at line 785 of file uimain.c.

786{
787 va_list ap;
788 char text[512];
789 char text1[512];
790
791 sprintf(text1, "WARNING: ");
794 va_end(ap);
795 strcat(text1, text);
796 mi_warning(text1);
797}

◆ xclip_deinit()

void xclip_deinit ( RDPCLIENT This)

Definition at line 1102 of file xclip.c.

1103{
1104 if (XGetSelectionOwner(This->display, This->xclip.primary_atom) == This->wnd)
1105 XSetSelectionOwner(This->display, This->xclip.primary_atom, None, This->xclip.acquire_time);
1106 if (XGetSelectionOwner(This->display, This->xclip.clipboard_atom) == This->wnd)
1107 XSetSelectionOwner(This->display, This->xclip.clipboard_atom, None, This->xclip.acquire_time);
1109}

◆ xclip_init()

void xclip_init ( RDPCLIENT This)

Definition at line 1052 of file xclip.c.

1053{
1054 if (!This->rdpclip)
1055 return;
1056
1057 if (!cliprdr_init(This))
1058 return;
1059
1060 This->xclip.primary_atom = XInternAtom(This->display, "PRIMARY", False);
1061 This->xclip.clipboard_atom = XInternAtom(This->display, "CLIPBOARD", False);
1062 This->xclip.targets_atom = XInternAtom(This->display, "TARGETS", False);
1063 This->xclip.timestamp_atom = XInternAtom(This->display, "TIMESTAMP", False);
1064 This->xclip.rdesktop_clipboard_target_atom =
1065 XInternAtom(This->display, "_RDESKTOP_CLIPBOARD_TARGET", False);
1066 This->xclip.rdesktop_primary_timestamp_target_atom =
1067 XInternAtom(This->display, "_RDESKTOP_PRIMARY_TIMESTAMP_TARGET", False);
1068 This->xclip.rdesktop_clipboard_timestamp_target_atom =
1069 XInternAtom(This->display, "_RDESKTOP_CLIPBOARD_TIMESTAMP_TARGET", False);
1070 This->xclip.incr_atom = XInternAtom(This->display, "INCR", False);
1071 This->xclip.format_string_atom = XInternAtom(This->display, "STRING", False);
1072 This->xclip.format_utf8_string_atom = XInternAtom(This->display, "UTF8_STRING", False);
1073 This->xclip.format_unicode_atom = XInternAtom(This->display, "text/unicode", False);
1074
1075 /* rdesktop sets _RDESKTOP_SELECTION_NOTIFY on the root window when acquiring the clipboard.
1076 Other interested rdesktops can use this to notify their server of the available formats. */
1077 This->xclip.rdesktop_selection_notify_atom =
1078 XInternAtom(This->display, "_RDESKTOP_SELECTION_NOTIFY", False);
1079 XSelectInput(This->display, DefaultRootWindow(This->display), PropertyChangeMask);
1080 This->xclip.probing_selections = False;
1081
1082 This->xclip.rdesktop_native_atom = XInternAtom(This->display, "_RDESKTOP_NATIVE", False);
1083 This->xclip.rdesktop_clipboard_formats_atom =
1084 XInternAtom(This->display, "_RDESKTOP_CLIPBOARD_FORMATS", False);
1085 This->xclip.rdesktop_primary_owner_atom = XInternAtom(This->display, "_RDESKTOP_PRIMARY_OWNER", False);
1086 This->xclip.rdesktop_clipboard_owner_atom = XInternAtom(This->display, "_RDESKTOP_CLIPBOARD_OWNER", False);
1087
1088 This->xclip.num_targets = 0;
1089 This->xclip.targets[This->xclip.num_targets++] = This->xclip.targets_atom;
1090 This->xclip.targets[This->xclip.num_targets++] = This->xclip.timestamp_atom;
1091 This->xclip.targets[This->xclip.num_targets++] = This->xclip.rdesktop_native_atom;
1092 This->xclip.targets[This->xclip.num_targets++] = This->xclip.rdesktop_clipboard_formats_atom;
1093#ifdef USE_UNICODE_CLIPBOARD
1094 This->xclip.targets[This->xclip.num_targets++] = This->xclip.format_utf8_string_atom;
1095#endif
1096 This->xclip.targets[This->xclip.num_targets++] = This->xclip.format_unicode_atom;
1097 This->xclip.targets[This->xclip.num_targets++] = This->xclip.format_string_atom;
1098 This->xclip.targets[This->xclip.num_targets++] = XA_STRING;
1099}
RD_BOOL cliprdr_init(void)

◆ xwin_toggle_fullscreen()

void xwin_toggle_fullscreen ( RDPCLIENT This)

Definition at line 1722 of file xwin.c.

1723{
1724 Pixmap contents = 0;
1725
1726 if (This->xwin.seamless_active)
1727 /* Turn off SeamlessRDP mode */
1729
1730 if (!This->ownbackstore)
1731 {
1732 /* need to save contents of window */
1733 contents = XCreatePixmap(This->display, This->wnd, This->width, This->height, This->xwin.depth);
1734 XCopyArea(This->display, This->wnd, contents, This->xwin.gc, 0, 0, This->width, This->height, 0, 0);
1735 }
1736
1738 This->fullscreen = !This->fullscreen;
1740
1741 XDefineCursor(This->display, This->wnd, This->xwin.current_cursor);
1742
1743 if (!This->ownbackstore)
1744 {
1745 XCopyArea(This->display, contents, This->wnd, This->xwin.gc, 0, 0, This->width, This->height, 0, 0);
1746 XFreePixmap(This->display, contents);
1747 }
1748}
void ui_destroy_window(void)
Definition: qtwin.cpp:637
RD_BOOL ui_create_window(void)
Definition: qtwin.cpp:559
static const char * contents
Definition: parser.c:511